summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBUILD/SETUP.sh2
-rw-r--r--VERSION4
-rw-r--r--client/client_priv.h4
-rw-r--r--client/mysql.cc5
-rw-r--r--client/mysqlbinlog.cc469
-rw-r--r--client/mysqldump.c24
-rw-r--r--client/readline.cc7
-rw-r--r--cmake/cpack_rpm.cmake1
-rw-r--r--cmake/install_macros.cmake2
-rw-r--r--debian/additions/mariadb.conf.d/50-server.cnf4
-rw-r--r--debian/additions/source_mariadb.py (renamed from debian/additions/source_mariadb-10.8.py)4
-rwxr-xr-xdebian/autobake-deb.sh2
-rw-r--r--debian/changelog2
-rw-r--r--debian/control175
-rw-r--r--debian/libmariadb-dev.install2
-rw-r--r--debian/libmariadb-dev.links1
-rw-r--r--debian/mariadb-backup.install1
-rw-r--r--debian/mariadb-backup.links1
-rw-r--r--debian/mariadb-client-core-10.8.links1
-rw-r--r--debian/mariadb-client-core.install (renamed from debian/mariadb-client-core-10.8.install)1
-rw-r--r--debian/mariadb-client.README.Debian (renamed from debian/mariadb-client-10.8.README.Debian)0
-rw-r--r--debian/mariadb-client.docs (renamed from debian/mariadb-client-10.8.docs)0
-rw-r--r--debian/mariadb-client.install (renamed from debian/mariadb-client-10.8.install)11
-rw-r--r--debian/mariadb-client.links (renamed from debian/mariadb-client-10.8.links)10
-rw-r--r--debian/mariadb-client.manpages (renamed from debian/mariadb-client-10.8.manpages)0
-rw-r--r--debian/mariadb-client.menu (renamed from debian/mariadb-client-10.8.menu)2
-rw-r--r--debian/mariadb-plugin-hashicorp-key-management.install3
-rw-r--r--debian/mariadb-plugin-rocksdb.install1
-rw-r--r--debian/mariadb-plugin-rocksdb.links1
-rw-r--r--debian/mariadb-server-10.8.links10
-rw-r--r--debian/mariadb-server-core-10.8.links3
-rw-r--r--debian/mariadb-server-core.install (renamed from debian/mariadb-server-core-10.8.install)3
-rw-r--r--debian/mariadb-server.README.Debian (renamed from debian/mariadb-server-10.8.README.Debian)0
-rw-r--r--debian/mariadb-server.config (renamed from debian/mariadb-server-10.8.config)2
-rw-r--r--debian/mariadb-server.dirs (renamed from debian/mariadb-server-10.8.dirs)0
-rw-r--r--debian/mariadb-server.install (renamed from debian/mariadb-server-10.8.install)14
-rw-r--r--debian/mariadb-server.logcheck.ignore.paranoid (renamed from debian/mariadb-server-10.8.logcheck.ignore.paranoid)0
-rw-r--r--debian/mariadb-server.logcheck.ignore.server (renamed from debian/mariadb-server-10.8.logcheck.ignore.server)0
-rw-r--r--debian/mariadb-server.logcheck.ignore.workstation (renamed from debian/mariadb-server-10.8.logcheck.ignore.workstation)0
-rw-r--r--debian/mariadb-server.mariadb.init (renamed from debian/mariadb-server-10.8.mariadb.init)2
-rw-r--r--debian/mariadb-server.mysql-server.logrotate (renamed from debian/mariadb-server-10.8.mysql-server.logrotate)0
-rw-r--r--debian/mariadb-server.mysql.default (renamed from debian/mariadb-server-10.8.mysql.default)0
-rw-r--r--debian/mariadb-server.postinst (renamed from debian/mariadb-server-10.8.postinst)7
-rw-r--r--debian/mariadb-server.postrm (renamed from debian/mariadb-server-10.8.postrm)9
-rw-r--r--debian/mariadb-server.preinst (renamed from debian/mariadb-server-10.8.preinst)9
-rw-r--r--debian/mariadb-server.prerm (renamed from debian/mariadb-server-10.8.prerm)0
-rw-r--r--debian/mariadb-server.templates (renamed from debian/mariadb-server-10.8.templates)6
-rw-r--r--debian/mariadb-server.triggers (renamed from debian/mariadb-server-10.8.triggers)0
-rw-r--r--debian/mariadb-test.install7
-rw-r--r--debian/mariadb-test.links8
-rw-r--r--debian/not-installed82
-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/rules23
-rw-r--r--debian/salsa-ci.yml133
-rw-r--r--debian/source/lintian-overrides31
-rw-r--r--debian/tests/control2
-rw-r--r--debian/tests/smoke4
-rw-r--r--extra/comp_err.c2
-rw-r--r--include/json_lib.h20
-rw-r--r--include/m_ctype.h9
-rw-r--r--include/my_base.h2
-rw-r--r--include/my_global.h3
-rw-r--r--include/mysql_com.h2
-rw-r--r--libmysqld/CMakeLists.txt1
-rw-r--r--man/comp_err.12
-rw-r--r--man/galera_new_cluster.12
-rw-r--r--man/galera_recovery.12
-rw-r--r--man/innochecksum.12
-rw-r--r--man/mariabackup.12
-rw-r--r--man/mariadb-conv.12
-rw-r--r--man/mariadb-service-convert.12
-rw-r--r--man/mbstream.12
-rw-r--r--man/msql2mysql.12
-rw-r--r--man/my_print_defaults.12
-rw-r--r--man/my_safe_process.12
-rw-r--r--man/myisam_ftdump.12
-rw-r--r--man/myisamchk.12
-rw-r--r--man/myisamlog.12
-rw-r--r--man/myisampack.12
-rw-r--r--man/myrocks_hotbackup.12
-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--man/mytop.12
-rw-r--r--man/perror.12
-rw-r--r--man/replace.12
-rw-r--r--man/resolve_stack_dump.12
-rw-r--r--man/resolveip.12
-rw-r--r--man/wsrep_sst_common.12
-rw-r--r--man/wsrep_sst_mariabackup.12
-rw-r--r--man/wsrep_sst_mysqldump.12
-rw-r--r--man/wsrep_sst_rsync.12
-rw-r--r--man/wsrep_sst_rsync_wan.12
-rwxr-xr-xmysql-test/dgcov.pl2
-rw-r--r--mysql-test/include/analyze-format.inc2
-rw-r--r--mysql-test/include/galera_variables_ok.inc2
-rw-r--r--mysql-test/include/galera_variables_ok_debug.inc2
-rw-r--r--mysql-test/main/cast.result8
-rw-r--r--mysql-test/main/ctype_collate_column.result11816
-rw-r--r--mysql-test/main/ctype_collate_column.test627
-rw-r--r--mysql-test/main/ctype_collate_context.result1960
-rw-r--r--mysql-test/main/ctype_collate_context.test366
-rw-r--r--mysql-test/main/ctype_collate_database.result130
-rw-r--r--mysql-test/main/ctype_collate_database.test124
-rw-r--r--mysql-test/main/ctype_collate_table.result57
-rw-r--r--mysql-test/main/ctype_collate_table.test51
-rw-r--r--mysql-test/main/ctype_create.result96
-rw-r--r--mysql-test/main/ctype_create.test46
-rw-r--r--mysql-test/main/ctype_filename.result19
-rw-r--r--mysql-test/main/ctype_filename.test24
-rw-r--r--mysql-test/main/ctype_latin1.result60
-rw-r--r--mysql-test/main/ctype_latin1.test48
-rw-r--r--mysql-test/main/ctype_utf8.result43
-rw-r--r--mysql-test/main/ctype_utf8.test38
-rw-r--r--mysql-test/main/ctype_utf8mb4.result60
-rw-r--r--mysql-test/main/ctype_utf8mb4.test48
-rw-r--r--mysql-test/main/dyncol.result2
-rw-r--r--mysql-test/main/func_json.result894
-rw-r--r--mysql-test/main/func_json.test650
-rw-r--r--mysql-test/main/func_time.result2
-rw-r--r--mysql-test/main/func_time_hires.result6
-rw-r--r--mysql-test/main/json_debug_nonembedded.result14
-rw-r--r--mysql-test/main/json_debug_nonembedded.test14
-rw-r--r--mysql-test/main/lock_sync.result25
-rw-r--r--mysql-test/main/lock_sync.test119
-rw-r--r--mysql-test/main/mysql_binary_mode.result4
-rw-r--r--mysql-test/main/mysql_binary_mode.test28
-rw-r--r--mysql-test/main/mysqld--help.result5
-rw-r--r--mysql-test/main/mysqldump-order-by-size.result48
-rw-r--r--mysql-test/main/mysqldump-order-by-size.test15
-rw-r--r--mysql-test/main/opt_trace.result19
-rw-r--r--mysql-test/main/opt_trace_index_merge_innodb.result1
-rw-r--r--mysql-test/main/partition_charset.result21
-rw-r--r--mysql-test/main/partition_charset.test20
-rw-r--r--mysql-test/main/partition_utf8-debug.result2
-rw-r--r--mysql-test/main/show_analyze.result435
-rw-r--r--mysql-test/main/show_analyze.test366
-rw-r--r--mysql-test/main/show_analyze_json.result1242
-rw-r--r--mysql-test/main/show_analyze_json.test389
-rw-r--r--mysql-test/main/show_explain.result142
-rw-r--r--mysql-test/main/show_explain.test123
-rw-r--r--mysql-test/main/show_explain_json.result1308
-rw-r--r--mysql-test/main/show_explain_json.test502
-rw-r--r--mysql-test/main/subselect4.test1
-rw-r--r--mysql-test/main/type_blob.result10
-rw-r--r--mysql-test/main/type_blob.test4
-rw-r--r--mysql-test/main/type_datetime_hires.result2
-rw-r--r--mysql-test/main/type_decimal.result2
-rw-r--r--mysql-test/main/type_float.result37
-rw-r--r--mysql-test/main/type_float.test41
-rw-r--r--mysql-test/main/type_newdecimal.result14
-rw-r--r--mysql-test/main/type_time_hires.result23
-rw-r--r--mysql-test/main/type_time_hires.test27
-rw-r--r--mysql-test/main/type_timestamp_hires.result2
-rw-r--r--mysql-test/main/view_debug.result3
-rw-r--r--mysql-test/main/view_debug.test5
-rw-r--r--mysql-test/main/win.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result161
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test477
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_log.result1
-rw-r--r--mysql-test/suite/encryption/r/tempfiles_encrypted.result2
-rw-r--r--mysql-test/suite/encryption/t/innodb_encrypt_log.test5
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_decimal.result2
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result8
-rw-r--r--mysql-test/suite/galera/r/MDEV-22458.result2
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result3
-rw-r--r--mysql-test/suite/galera_sr/disabled.def2
-rw-r--r--mysql-test/suite/innodb/r/ibuf_delete.result4
-rw-r--r--mysql-test/suite/innodb/r/ibuf_not_empty.result2
-rw-r--r--mysql-test/suite/innodb/r/log_file_size_online.result47
-rw-r--r--mysql-test/suite/innodb/t/log_file_size_online.combinations11
-rw-r--r--mysql-test/suite/innodb/t/log_file_size_online.test44
-rw-r--r--mysql-test/suite/json/r/json_no_table.result56
-rw-r--r--mysql-test/suite/json/r/json_table.result126
-rw-r--r--mysql-test/suite/json/t/json_table.test121
-rw-r--r--mysql-test/suite/perfschema/r/max_program_zero.result2
-rw-r--r--mysql-test/suite/perfschema/r/nesting.result84
-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_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/roles/create_and_drop_role_invalid_user_table.result2
-rw-r--r--mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test2
-rw-r--r--mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc194
-rw-r--r--mysql-test/suite/rpl/include/rpl_check_table_consistency.inc63
-rw-r--r--mysql-test/suite/rpl/include/sql_multisource.inc45
-rw-r--r--mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc43
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result1343
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test401
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_client_basic.result38
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_connection_basic.result42
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_database_basic.result22
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result11
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_results_basic.resultbin16295 -> 16895 bytes
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_server_basic.result38
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/old_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/old_mode_basic.result43
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result15
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_client_basic.test37
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_connection_basic.test37
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_database_basic.test20
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test10
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_results_basic.test33
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_server_basic.test32
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test5
-rw-r--r--mysql-test/suite/sys_vars/t/old_mode_basic.test35
-rw-r--r--mysql-test/suite/versioning/common.inc1
-rw-r--r--mysql-test/suite/versioning/common_finish.inc1
-rw-r--r--mysql-test/suite/versioning/r/debug.result42
-rw-r--r--mysql-test/suite/versioning/r/delete_history.result19
-rw-r--r--mysql-test/suite/versioning/r/not_embedded.result23
-rw-r--r--mysql-test/suite/versioning/r/partition,heap.rdiff137
-rw-r--r--mysql-test/suite/versioning/r/partition.result1239
-rw-r--r--mysql-test/suite/versioning/r/rpl.result220
-rw-r--r--mysql-test/suite/versioning/r/rpl_mix.result55
-rw-r--r--mysql-test/suite/versioning/r/rpl_row.result55
-rw-r--r--mysql-test/suite/versioning/r/rpl_stmt.result50
-rw-r--r--mysql-test/suite/versioning/r/update-big.result74
-rw-r--r--mysql-test/suite/versioning/t/debug.test63
-rw-r--r--mysql-test/suite/versioning/t/delete_history.test16
-rw-r--r--mysql-test/suite/versioning/t/load_data.test2
-rw-r--r--mysql-test/suite/versioning/t/not_embedded.test28
-rw-r--r--mysql-test/suite/versioning/t/partition.test865
-rw-r--r--mysql-test/suite/versioning/t/rpl.test163
-rw-r--r--mysql-test/suite/versioning/t/rpl_common.inc30
-rw-r--r--mysql-test/suite/versioning/t/rpl_mix.test2
-rw-r--r--mysql-test/suite/versioning/t/rpl_row.test2
-rw-r--r--mysql-test/suite/versioning/t/rpl_stmt.test4
-rw-r--r--mysql-test/suite/versioning/t/update-big.test74
-rw-r--r--mysql-test/suite/wsrep/r/variables.result1
-rw-r--r--mysql-test/suite/wsrep/r/variables_debug.result1
-rw-r--r--mysys/my_fopen.c2
-rw-r--r--mysys/my_init.c19
-rw-r--r--plugin/func_test/plugin.cc2
-rw-r--r--plugin/hashicorp_key_management/CMakeLists.txt23
-rw-r--r--plugin/hashicorp_key_management/hashicorp_key_management.cnf117
-rw-r--r--plugin/hashicorp_key_management/hashicorp_key_management.txt181
-rw-r--r--plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc1385
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.inc4
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.opt6
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/include/have_mariabackup.inc3
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_after_recreate.result9
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_timeout_update.result19
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_check_kv_version.result9
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_encode.result49
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_migration.result39
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_rotation_age.result97
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_mariabackup.result13
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_url_prefix.result31
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/suite.pm16
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.opt2
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test35
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.opt2
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.test23
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test54
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_deinit.inc1
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_encode.test25
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_init.inc7
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test57
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.opt1
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test135
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test39
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_plugin.inc2
-rw-r--r--plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test93
-rw-r--r--plugin/type_inet/item_inetfunc.h8
-rw-r--r--plugin/type_uuid/item_uuidfunc.h2
-rw-r--r--plugin/user_variables/user_variables.cc2
-rw-r--r--scripts/fill_help_tables.sql173
-rw-r--r--sql/CMakeLists.txt2
-rw-r--r--sql/field.cc26
-rw-r--r--sql/field.h29
-rw-r--r--sql/ha_partition.cc11
-rw-r--r--sql/ha_partition.h4
-rw-r--r--sql/handler.cc24
-rw-r--r--sql/handler.h90
-rw-r--r--sql/item.cc46
-rw-r--r--sql/item.h69
-rw-r--r--sql/item_cmpfunc.cc47
-rw-r--r--sql/item_cmpfunc.h44
-rw-r--r--sql/item_create.cc28
-rw-r--r--sql/item_create.h2
-rw-r--r--sql/item_func.cc68
-rw-r--r--sql/item_func.h166
-rw-r--r--sql/item_geofunc.cc6
-rw-r--r--sql/item_geofunc.h48
-rw-r--r--sql/item_jsonfunc.cc695
-rw-r--r--sql/item_jsonfunc.h76
-rw-r--r--sql/item_strfunc.cc74
-rw-r--r--sql/item_strfunc.h156
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/item_sum.cc36
-rw-r--r--sql/item_sum.h26
-rw-r--r--sql/item_timefunc.cc28
-rw-r--r--sql/item_timefunc.h90
-rw-r--r--sql/item_vers.h8
-rw-r--r--sql/item_windowfunc.cc6
-rw-r--r--sql/item_windowfunc.h12
-rw-r--r--sql/item_xmlfunc.cc10
-rw-r--r--sql/item_xmlfunc.h2
-rw-r--r--sql/json_table.cc36
-rw-r--r--sql/json_table.h2
-rw-r--r--sql/lex_charset.cc700
-rw-r--r--sql/lex_charset.h642
-rw-r--r--sql/lock.cc32
-rw-r--r--sql/lock.h2
-rw-r--r--sql/log.cc24
-rw-r--r--sql/log_event.cc13
-rw-r--r--sql/log_event.h9
-rw-r--r--sql/log_event_server.cc22
-rw-r--r--sql/my_apc.cc4
-rw-r--r--sql/mysqld.cc11
-rw-r--r--sql/mysqld.h4
-rw-r--r--sql/partition_info.cc228
-rw-r--r--sql/partition_info.h34
-rw-r--r--sql/privilege.h1
-rw-r--r--sql/rpl_gtid.cc267
-rw-r--r--sql/rpl_gtid.h132
-rw-r--r--sql/rpl_rli.h2
-rw-r--r--sql/share/errmsg-utf8.txt24
-rw-r--r--sql/slave.cc10
-rw-r--r--sql/sp_head.cc1
-rw-r--r--sql/sql_alter.cc2
-rw-r--r--sql/sql_analyze_stmt.cc2
-rw-r--r--sql/sql_analyze_stmt.h2
-rw-r--r--sql/sql_base.cc308
-rw-r--r--sql/sql_base.h12
-rw-r--r--sql/sql_class.cc49
-rw-r--r--sql/sql_class.h65
-rw-r--r--sql/sql_cmd.h3
-rw-r--r--sql/sql_db.cc2
-rw-r--r--sql/sql_delete.cc24
-rw-r--r--sql/sql_explain.cc190
-rw-r--r--sql/sql_explain.h109
-rw-r--r--sql/sql_insert.cc16
-rw-r--r--sql/sql_lex.cc132
-rw-r--r--sql/sql_lex.h29
-rw-r--r--sql/sql_parse.cc87
-rw-r--r--sql/sql_parse.h2
-rw-r--r--sql/sql_partition.cc68
-rw-r--r--sql/sql_partition_admin.cc3
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_priv.h5
-rw-r--r--sql/sql_select.cc44
-rw-r--r--sql/sql_select.h1
-rw-r--r--sql/sql_show.cc115
-rw-r--r--sql/sql_show.h25
-rw-r--r--sql/sql_table.cc405
-rw-r--r--sql/sql_table.h11
-rw-r--r--sql/sql_test.cc4
-rw-r--r--sql/sql_truncate.cc2
-rw-r--r--sql/sql_type.cc75
-rw-r--r--sql/sql_type.h51
-rw-r--r--sql/sql_type_fixedbin.h6
-rw-r--r--sql/sql_type_geom.cc3
-rw-r--r--sql/sql_type_geom.h3
-rw-r--r--sql/sql_update.cc46
-rw-r--r--sql/sql_window.cc6
-rw-r--r--sql/sql_yacc.yy550
-rw-r--r--sql/structs.h160
-rw-r--r--sql/sys_vars.cc52
-rw-r--r--sql/table.cc20
-rw-r--r--sql/table.h19
-rw-r--r--sql/transaction.cc14
-rw-r--r--sql/wsrep_mutex.h1
-rw-r--r--sql/wsrep_mysqld.cc5
-rw-r--r--sql/wsrep_mysqld.h1
-rw-r--r--sql/wsrep_notify.cc3
-rw-r--r--sql/wsrep_plugin.cc2
-rw-r--r--sql/wsrep_sst.cc137
-rw-r--r--sql/wsrep_status.cc60
-rw-r--r--sql/wsrep_status.h62
-rw-r--r--sql/wsrep_trans_observer.h2
-rw-r--r--sql/wsrep_utils.h21
-rw-r--r--sql/xa.cc8
-rw-r--r--storage/connect/json.cpp6
-rw-r--r--storage/connect/tabmul.cpp13
-rw-r--r--storage/innobase/buf/buf0flu.cc116
-rw-r--r--storage/innobase/handler/ha_innodb.cc58
-rw-r--r--storage/innobase/include/log0log.h68
-rw-r--r--storage/innobase/log/log0log.cc316
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc116
-rw-r--r--storage/innobase/srv/srv0start.cc19
-rw-r--r--storage/rocksdb/ha_rocksdb.cc9
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/checksum_table.result4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_unsigned.result8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result1
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_log_dir.result8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_fixed.result6
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_float.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.opt2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.test15
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_log_dir_basic.result7
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_log_dir_basic.test6
-rw-r--r--storage/rocksdb/nosql_access.cc2
-rw-r--r--storage/rocksdb/nosql_access.h2
-rw-r--r--storage/rocksdb/rdb_converter.cc2
-rw-r--r--storage/rocksdb/rdb_converter.h2
-rw-r--r--storage/rocksdb/rdb_global.h2
-rw-r--r--storage/spider/CMakeLists.txt41
-rw-r--r--storage/spider/Makefile.am89
-rw-r--r--storage/spider/configure.in95
-rw-r--r--storage/spider/ha_spider.cc2503
-rw-r--r--storage/spider/ha_spider.h348
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc8
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc4
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc4
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc140
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc140
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc140
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc109
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc24
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc12
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc12
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc192
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc94
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc15
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_master_1.inc149
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc10
-rw-r--r--storage/spider/mysql-test/spider/oracle/include/init_spider.inc105
-rw-r--r--storage/spider/mysql-test/spider/oracle/my.cnf146
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/basic_sql.result634
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result121
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result91
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result82
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/direct_update.result138
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/direct_update_part.result129
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/function.result149
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/ha.result240
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/ha_part.result262
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result194
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result192
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/spider_fixes.result552
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result199
-rw-r--r--storage/spider/mysql-test/spider/oracle/r/vp_fixes.result80
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/basic_sql.test2699
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test571
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test179
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test192
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/direct_update.test198
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/direct_update_part.test211
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/function.test253
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/ha.test878
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/ha_part.test1017
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc30
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc30
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/have_engine.inc7
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/have_func.inc5
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/have_partition.inc7
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/have_trigger.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc17
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc17
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc44
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test292
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test345
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/spider_fixes.test1419
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test645
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/test_deinit.inc37
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/test_init.inc74
-rw-r--r--storage/spider/mysql-test/spider/oracle/t/vp_fixes.test335
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc8
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc4
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc4
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc140
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc140
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc140
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc109
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc24
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc12
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc0
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc12
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc192
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc94
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc15
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc3
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc150
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc10
-rw-r--r--storage/spider/mysql-test/spider/oracle2/include/init_spider.inc105
-rw-r--r--storage/spider/mysql-test/spider/oracle2/my.cnf146
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/basic_sql.result634
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result121
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result91
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result82
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/direct_update.result138
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result129
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/function.result149
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/ha.result240
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/ha_part.result262
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result210
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result208
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result556
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result203
-rw-r--r--storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result80
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/basic_sql.test2699
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test571
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc1
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test179
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test192
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/direct_update.test198
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test211
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/function.test253
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/ha.test878
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/ha_part.test1017
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc30
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc30
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/have_engine.inc7
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/have_func.inc5
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/have_partition.inc7
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc2
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc17
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc17
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc6
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc44
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test292
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test345
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test1419
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test645
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc37
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/test_init.inc74
-rw-r--r--storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test335
-rw-r--r--storage/spider/spd_conn.cc296
-rw-r--r--storage/spider/spd_conn.h6
-rw-r--r--storage/spider/spd_copy_tables.cc48
-rw-r--r--storage/spider/spd_copy_tables.h2
-rw-r--r--storage/spider/spd_db_conn.cc984
-rw-r--r--storage/spider/spd_db_conn.h59
-rw-r--r--storage/spider/spd_db_include.cc13
-rw-r--r--storage/spider/spd_db_include.h82
-rw-r--r--storage/spider/spd_db_mysql.cc278
-rw-r--r--storage/spider/spd_db_mysql.h28
-rw-r--r--storage/spider/spd_db_oracle.cc13609
-rw-r--r--storage/spider/spd_db_oracle.h1559
-rw-r--r--storage/spider/spd_direct_sql.cc107
-rw-r--r--storage/spider/spd_direct_sql.h2
-rw-r--r--storage/spider/spd_environ.h31
-rw-r--r--storage/spider/spd_group_by_handler.cc49
-rw-r--r--storage/spider/spd_group_by_handler.h4
-rw-r--r--storage/spider/spd_i_s.cc13
-rw-r--r--storage/spider/spd_include.h242
-rw-r--r--storage/spider/spd_init_query.h2
-rw-r--r--storage/spider/spd_malloc.cc5
-rw-r--r--storage/spider/spd_param.cc201
-rw-r--r--storage/spider/spd_param.h20
-rw-r--r--storage/spider/spd_ping_table.cc81
-rw-r--r--storage/spider/spd_sys_table.cc179
-rw-r--r--storage/spider/spd_sys_table.h3
-rw-r--r--storage/spider/spd_table.cc668
-rw-r--r--storage/spider/spd_table.h30
-rw-r--r--storage/spider/spd_trx.cc153
-rw-r--r--storage/spider/spd_trx.h6
-rw-r--r--storage/spider/spd_udf.cc2
-rw-r--r--storage/spider/spd_udf.h2
-rw-r--r--strings/ctype-bin.c4
-rw-r--r--strings/json_lib.c194
-rw-r--r--unittest/json_lib/json_lib-t.c2
715 files changed, 38758 insertions, 52753 deletions
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 0ddf02813e3..d990608f14e 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -214,7 +214,7 @@ fi
max_plugins="--with-plugins=max"
max_no_embedded_configs="$SSL_LIBRARY $max_plugins"
max_no_qc_configs="$SSL_LIBRARY $max_plugins --without-query-cache"
-max_configs="$SSL_LIBRARY $max_plugins --with-embedded-server --with-libevent --with-plugin-rocksdb=dynamic --with-plugin-test_sql_discovery=DYNAMIC --with-plugin-file_key_management=DYNAMIC"
+max_configs="$SSL_LIBRARY $max_plugins --with-embedded-server --with-libevent --with-plugin-rocksdb=dynamic --with-plugin-test_sql_discovery=DYNAMIC --with-plugin-file_key_management=DYNAMIC --with-plugin-hashicorp_key_management=DYNAMIC"
all_configs="$SSL_LIBRARY $max_plugins --with-embedded-server --with-innodb_plugin --with-libevent"
#
diff --git a/VERSION b/VERSION
index 215e558a471..d2c4c84b782 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
-MYSQL_VERSION_MINOR=8
-MYSQL_VERSION_PATCH=8
+MYSQL_VERSION_MINOR=9
+MYSQL_VERSION_PATCH=6
SERVER_MATURITY=stable
diff --git a/client/client_priv.h b/client/client_priv.h
index bde5a697b24..597c074c9c2 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -107,6 +107,10 @@ enum options_client
OPT_COPY_S3_TABLES,
OPT_PRINT_TABLE_METADATA,
OPT_ASOF_TIMESTAMP,
+ OPT_IGNORE_DOMAIN_IDS,
+ OPT_DO_DOMAIN_IDS,
+ OPT_IGNORE_SERVER_IDS,
+ OPT_DO_SERVER_IDS,
OPT_MAX_CLIENT_OPTION /* should be always the last */
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 48330257554..fff0c5984ad 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3659,7 +3659,10 @@ static char *fieldflags2str(uint f) {
ff2s_check_flag(NUM);
ff2s_check_flag(PART_KEY);
ff2s_check_flag(GROUP);
- ff2s_check_flag(BINCMP);
+ /*
+ CONTEXT_COLLATION_FLAG (former BINCMP_FLAG) is used at parse
+ time only and should never show up on the client side. Don't test it.
+ */
ff2s_check_flag(ON_UPDATE_NOW);
#undef ff2s_check_flag
if (f)
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 4808090aaf2..ab41680ab15 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -47,6 +47,7 @@
#include "sql_common.h"
#include "my_dir.h"
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
+#include "rpl_gtid.h"
#include "sql_string.h" // needed for Rpl_filter
#include "sql_list.h" // needed for Rpl_filter
#include "rpl_filter.h"
@@ -82,7 +83,7 @@ extern "C" {
char server_version[SERVER_VERSION_LENGTH];
}
-ulong server_id = 0;
+static char *server_id_str;
// needed by net_serv.c
ulong bytes_sent = 0L, bytes_received = 0L;
@@ -142,6 +143,8 @@ static char *charset= 0;
static uint verbose= 0;
+static char *ignore_domain_ids_str, *do_domain_ids_str;
+static char *ignore_server_ids_str, *do_server_ids_str;
static char *start_pos_str, *stop_pos_str;
static ulonglong start_position= BIN_LOG_HEADER_SIZE,
stop_position= (longlong)(~(my_off_t)0) ;
@@ -149,7 +152,10 @@ static ulonglong start_position= BIN_LOG_HEADER_SIZE,
#define stop_position_mot ((my_off_t)stop_position)
static Binlog_gtid_state_validator *gtid_state_validator= NULL;
-static Domain_gtid_event_filter *domain_gtid_filter= NULL;
+static Gtid_event_filter *gtid_event_filter= NULL;
+static Domain_gtid_event_filter *position_gtid_filter= NULL;
+static Domain_gtid_event_filter *domain_id_gtid_filter= NULL;
+static Server_gtid_event_filter *server_id_gtid_filter= NULL;
static char *start_datetime_str, *stop_datetime_str;
static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX;
@@ -985,9 +991,16 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
return result;
}
-static inline my_bool is_gtid_filtering_enabled()
+/*
+ Check if the server id should be excluded from the output.
+*/
+static inline my_bool is_server_id_excluded(uint32 server_id)
{
- return domain_gtid_filter != NULL;
+ static rpl_gtid server_tester_gtid;
+ server_tester_gtid.server_id= server_id;
+ return server_id_gtid_filter == NULL
+ ? FALSE // No server id filter exists
+ : server_id_gtid_filter->exclude(&server_tester_gtid);
}
/**
@@ -1059,14 +1072,15 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
glev->count))
goto err;
- if (domain_gtid_filter && !domain_gtid_filter->get_num_start_gtids())
+ if (position_gtid_filter &&
+ !position_gtid_filter->get_num_start_gtids())
{
/*
We need to validate the GTID list from --stop-position because we
couldn't prove it intrinsically (i.e. using stop > start)
*/
- rpl_gtid *stop_gtids= domain_gtid_filter->get_stop_gtids();
- size_t n_stop_gtids= domain_gtid_filter->get_num_stop_gtids();
+ rpl_gtid *stop_gtids= position_gtid_filter->get_stop_gtids();
+ size_t n_stop_gtids= position_gtid_filter->get_num_stop_gtids();
if (gtid_state_validator->verify_stop_state(stderr, stop_gtids,
n_stop_gtids))
{
@@ -1099,15 +1113,15 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
If the binlog output should be filtered using GTIDs, test the new event
group to see if its events should be ignored.
*/
- if (domain_gtid_filter)
+ if (gtid_event_filter)
{
- if (domain_gtid_filter->has_finished())
+ if (gtid_event_filter->has_finished())
{
retval= OK_STOP;
goto end;
}
- if (!domain_gtid_filter->exclude(&ev_gtid))
+ if (!gtid_event_filter->exclude(&ev_gtid))
print_event_info->activate_current_event_group();
else
print_event_info->deactivate_current_event_group();
@@ -1122,7 +1136,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
If we don't care about ensuring GTID validity, just delete the auditor
object to disable it for future checks.
*/
- if (gtid_state_validator)
+ if (gtid_state_validator && print_event_info->is_event_group_active())
{
if (!(opt_gtid_strict_mode || verbose >= 3))
{
@@ -1178,8 +1192,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
the format_description event so that we can parse subsequent
events.
*/
- if (ev_type != ROTATE_EVENT &&
- server_id && (server_id != ev->server_id))
+ if (ev_type != ROTATE_EVENT && is_server_id_excluded(ev->server_id))
goto end;
}
if ((ev->when >= stop_datetime)
@@ -1767,9 +1780,42 @@ static struct my_option my_options[] =
"Print row event positions",
&print_row_event_positions, &print_row_event_positions, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
- {"server-id", 0,
- "Extract only binlog entries created by the server having the given id.",
- &server_id, &server_id, 0, GET_ULONG,
+ {"ignore-domain-ids", OPT_IGNORE_DOMAIN_IDS,
+ "A list of positive integers, separated by commas, that form a blacklist "
+ "of domain ids. Any log event with a GTID that originates from a domain id "
+ "specified in this list is hidden. Cannot be used with "
+ "--do-domain-ids. When used with --(ignore|do)-server-ids, the result is the "
+ "intersection between the two datasets.",
+ &ignore_domain_ids_str, &ignore_domain_ids_str, 0, GET_STR_ALLOC,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"do-domain-ids", OPT_DO_DOMAIN_IDS,
+ "A list of positive integers, separated by commas, that form a whitelist "
+ "of domain ids. Any log event with a GTID that originates from a domain id "
+ "specified in this list is displayed. Cannot be used with "
+ "--ignore-domain-ids. When used with --(ignore|do)-server-ids, the result "
+ "is the intersection between the two datasets.",
+ &do_domain_ids_str, &do_domain_ids_str, 0, GET_STR_ALLOC, REQUIRED_ARG, 0,
+ 0, 0, 0, 0, 0},
+ {"ignore-server-ids", OPT_IGNORE_SERVER_IDS,
+ "A list of positive integers, separated by commas, that form a blacklist "
+ "of server ids. Any log event originating from a server id "
+ "specified in this list is hidden. Cannot be used with "
+ "--do-server-ids. When used with --(ignore|do)-domain-ids, the result is "
+ "the intersection between the two datasets.",
+ &ignore_server_ids_str, &ignore_server_ids_str, 0, GET_STR_ALLOC,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"do-server-ids", OPT_DO_SERVER_IDS,
+ "A list of positive integers, separated by commas, that form a whitelist "
+ "of server ids. Any log event originating from a server id "
+ "specified in this list is displayed. Cannot be used with "
+ "--ignore-server-ids. When used with --(ignore|do)-domain-ids, the result "
+ "is the intersection between the two datasets. Alias for --server-id.",
+ &do_server_ids_str, &do_server_ids_str, 0, GET_STR_ALLOC,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"server-id", OPT_SERVER_ID,
+ "Extract only binlog entries created by the server having the given id. "
+ "Alias for --do-server-ids.",
+ &server_id_str, &server_id_str, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES character_set' to the output.", &charset,
@@ -1974,9 +2020,31 @@ static void cleanup()
my_free(stop_datetime_str);
my_free(start_pos_str);
my_free(stop_pos_str);
+ my_free(ignore_domain_ids_str);
+ my_free(do_domain_ids_str);
+ my_free(ignore_server_ids_str);
+ my_free(do_server_ids_str);
+ my_free(server_id_str);
free_root(&glob_root, MYF(0));
- delete domain_gtid_filter;
+ if (gtid_event_filter)
+ {
+ delete gtid_event_filter;
+ }
+ else
+ {
+ /*
+ If there was an error during input parsing, gtid_event_filter will not
+ be set, so we need to ensure the comprising filters are cleaned up
+ properly.
+ */
+ if (domain_id_gtid_filter)
+ delete domain_id_gtid_filter;
+ if (position_gtid_filter)
+ delete position_gtid_filter;
+ if (server_id_gtid_filter)
+ delete server_id_gtid_filter;
+ }
if (gtid_state_validator)
delete gtid_state_validator;
@@ -1997,6 +2065,89 @@ static void cleanup()
DBUG_VOID_RETURN;
}
+/*
+ Parse a list of positive numbers separated by commas.
+ Returns a list of numbers on success, NULL on parsing/resource error
+*/
+static uint32 *parse_u32_list(const char *str, size_t str_len, uint32 *n_vals)
+{
+ const char *str_begin= const_cast<char *>(str);
+ const char *str_end= str_begin + str_len;
+ const char *p = str_begin;
+ uint32 len= 0, alloc_len= (uint32) ceil(str_len/2.0);
+ uint32 *list= NULL;
+ int err;
+
+ for (;;)
+ {
+ uint32 val;
+
+ /*
+ Set it to the end of the string overall, but when parsing, it will be
+ moved to the end of the element
+ */
+ char *el_end= (char*) str_begin + str_len;
+
+ if (len >= (((uint32)1 << 28)-1))
+ {
+ my_free(list);
+ list= NULL;
+ goto end;
+ }
+
+ val= (uint32)my_strtoll10(p, &el_end, &err);
+ if (err)
+ {
+ my_free(list);
+ list= NULL;
+ goto end;
+ }
+ p = el_end;
+
+ if ((!list || len >= alloc_len) &&
+ !(list=
+ (uint32 *)my_realloc(PSI_INSTRUMENT_ME, list,
+ (alloc_len= alloc_len*2) * sizeof(uint32),
+ MYF(MY_FREE_ON_ERROR|MY_ALLOW_ZERO_PTR))))
+ return NULL;
+ list[len++]= val;
+
+ if (el_end == str_end)
+ break;
+ if (*p != ',')
+ {
+ my_free(list);
+ return NULL;
+ }
+ ++p;
+ }
+ *n_vals= len;
+
+end:
+ return list;
+}
+
+/*
+ If multiple different types of Gtid_event_filters are used, the result
+ should be the intersection between the filter types.
+*/
+static void extend_main_gtid_event_filter(Gtid_event_filter *new_filter)
+{
+ if (gtid_event_filter == NULL)
+ {
+ gtid_event_filter= new_filter;
+ }
+ else
+ {
+ if (gtid_event_filter->get_filter_type() !=
+ Gtid_event_filter::INTERSECTING_GTID_FILTER_TYPE)
+ gtid_event_filter=
+ new Intersecting_gtid_event_filter(gtid_event_filter, new_filter);
+ else
+ ((Intersecting_gtid_event_filter *) gtid_event_filter)
+ ->add_filter(new_filter);
+ }
+}
static void die(int err)
{
@@ -2050,6 +2201,110 @@ static my_time_t convert_str_to_timestamp(const char* str)
my_system_gmt_sec(&l_time, &dummy_my_timezone, &dummy_in_dst_time_gap);
}
+/**
+ Parses a start or stop position argument and populates either
+ start_position/stop_position (if a log offset) or position_gtid_filter
+ (if a gtid position)
+
+ @param[in] option_name : Name of the command line option provided (used for
+ error message)
+ @param[in] option_val : The user-provided value of the option_name
+ @param[out] fallback : Pointer to a global variable to set if using log
+ offsets
+ @param[in] add_gtid : Function pointer to a class method to add a GTID to a
+ Gtid_event_filter
+ @param[in] add_zero_seqno : If using GTID positions, this boolean specifies
+ if GTIDs with a sequence number of 0 should be added to the filter
+*/
+int parse_position_argument(
+ const char *option_name, char *option_val, ulonglong *fallback,
+ int (Domain_gtid_event_filter::*add_gtid)(rpl_gtid *),
+ my_bool add_zero_seqno)
+{
+ uint32 n_gtids= 0;
+ rpl_gtid *gtid_list=
+ gtid_parse_string_to_list(option_val, strlen(option_val), &n_gtids);
+
+ if (gtid_list == NULL)
+ {
+ int err= 0;
+ char *end_ptr= NULL;
+ /*
+ No GTIDs specified in position specification. Treat the value
+ as a singular index.
+ */
+ *fallback= my_strtoll10(option_val, &end_ptr, &err);
+
+ if (err || *end_ptr)
+ {
+ // Can't parse the position from the user
+ sql_print_error("%s argument value is invalid. Should be either a "
+ "positive integer or GTID.",
+ option_name);
+ return 1;
+ }
+ }
+ else if (n_gtids > 0)
+ {
+ uint32 gtid_idx;
+
+ if (position_gtid_filter == NULL)
+ position_gtid_filter= new Domain_gtid_event_filter();
+
+ for (gtid_idx = 0; gtid_idx < n_gtids; gtid_idx++)
+ {
+ rpl_gtid *gtid= &gtid_list[gtid_idx];
+ if ((gtid->seq_no || add_zero_seqno) &&
+ (position_gtid_filter->*add_gtid)(gtid))
+ {
+ my_free(gtid_list);
+ return 1;
+ }
+ }
+ my_free(gtid_list);
+ }
+ else
+ {
+ DBUG_ASSERT(0);
+ }
+ return 0;
+}
+
+/**
+ Parses a do/ignore domain/server ids option and populates the corresponding
+ gtid filter
+
+ @param[in] option_name : Name of the command line option provided (used for
+ error message)
+ @param[in] option_value : The user-provided list of domain or server ids
+ @param[in] filter : The filter to update with the provided domain/server id
+ @param[in] mode : Specifies whether the list should be a blacklist or
+ whitelist
+*/
+template <typename T>
+int parse_gtid_filter_option(
+ const char *option_name, char *option_val, T **filter,
+ Gtid_event_filter::id_restriction_mode mode)
+{
+ uint32 n_ids= 0;
+ uint32 *id_list= parse_u32_list(option_val, strlen(option_val), &n_ids);
+
+ if (id_list == NULL)
+ {
+ DBUG_ASSERT(n_ids == 0);
+ sql_print_error(
+ "Input for %s is invalid. Should be a list of positive integers",
+ option_name);
+ return 1;
+ }
+
+ if (!(*filter))
+ (*filter)= new T();
+
+ int err= (*filter)->set_id_restrictions(id_list, n_ids, mode);
+ my_free(id_list);
+ return err;
+}
extern "C" my_bool
get_one_option(const struct my_option *opt, const char *argument,
@@ -2209,105 +2464,72 @@ get_one_option(const struct my_option *opt, const char *argument,
case OPT_STOP_POSITION:
{
/* Stop position was already specified, so reset it and use the new list */
- if (domain_gtid_filter && domain_gtid_filter->get_num_stop_gtids() > 0)
- domain_gtid_filter->clear_stop_gtids();
-
- uint32 n_stop_gtid_ranges= 0;
- rpl_gtid *stop_gtids= gtid_parse_string_to_list(
- stop_pos_str, strlen(stop_pos_str), &n_stop_gtid_ranges);
- if (stop_gtids == NULL)
- {
- int err= 0;
- char *end_ptr= NULL;
- /*
- No GTIDs specified in OPT_STOP_POSITION specification. Treat the value
- as a singular index.
- */
- stop_position= my_strtoll10(stop_pos_str, &end_ptr, &err);
-
- if (err || *end_ptr)
- {
- // Can't parse the position from the user
- sql_print_error("Stop position argument value is invalid. Should be "
- "either a positive integer or GTID.");
- return 1;
- }
- }
- else if (n_stop_gtid_ranges > 0)
- {
- uint32 gtid_idx;
-
- if (domain_gtid_filter == NULL)
- domain_gtid_filter= new Domain_gtid_event_filter();
+ if (position_gtid_filter &&
+ position_gtid_filter->get_num_stop_gtids() > 0)
+ position_gtid_filter->clear_stop_gtids();
- for (gtid_idx = 0; gtid_idx < n_stop_gtid_ranges; gtid_idx++)
- {
- rpl_gtid *stop_gtid= &stop_gtids[gtid_idx];
- if (domain_gtid_filter->add_stop_gtid(stop_gtid))
- {
- my_free(stop_gtids);
- return 1;
- }
- }
- my_free(stop_gtids);
- }
- else
- {
- DBUG_ASSERT(0);
- }
+ if (parse_position_argument(
+ "--stop-position", stop_pos_str, &stop_position,
+ &Domain_gtid_event_filter::add_stop_gtid, TRUE))
+ return 1;
break;
}
case 'j':
{
/* Start position was already specified, so reset it and use the new list */
- if (domain_gtid_filter && domain_gtid_filter->get_num_start_gtids() > 0)
- domain_gtid_filter->clear_start_gtids();
-
- uint32 n_start_gtid_ranges= 0;
- rpl_gtid *start_gtids= gtid_parse_string_to_list(
- start_pos_str, strlen(start_pos_str), &n_start_gtid_ranges);
-
- if (start_gtids == NULL)
- {
- int err= 0;
- char *end_ptr= NULL;
- /*
- No GTIDs specified in OPT_START_POSITION specification. Treat the value
- as a singular index.
- */
- start_position= my_strtoll10(start_pos_str, &end_ptr, &err);
-
- if (err || *end_ptr)
- {
- // Can't parse the position from the user
- sql_print_error("Start position argument value is invalid. Should be "
- "either a positive integer or GTID.");
- return 1;
- }
- }
- else if (n_start_gtid_ranges > 0)
- {
- uint32 gtid_idx;
-
- if (domain_gtid_filter == NULL)
- domain_gtid_filter= new Domain_gtid_event_filter();
+ if (position_gtid_filter &&
+ position_gtid_filter->get_num_start_gtids() > 0)
+ position_gtid_filter->clear_start_gtids();
- for (gtid_idx = 0; gtid_idx < n_start_gtid_ranges; gtid_idx++)
- {
- rpl_gtid *start_gtid= &start_gtids[gtid_idx];
- if (start_gtid->seq_no &&
- domain_gtid_filter->add_start_gtid(start_gtid))
- {
- my_free(start_gtids);
- return 1;
- }
- }
- my_free(start_gtids);
- }
- else
- {
- DBUG_ASSERT(0);
- }
+ if (parse_position_argument(
+ "--start-position", start_pos_str, &start_position,
+ &Domain_gtid_event_filter::add_start_gtid, FALSE))
+ return 1;
+ break;
+ }
+ case OPT_IGNORE_DOMAIN_IDS:
+ {
+ if (parse_gtid_filter_option<Domain_gtid_event_filter>(
+ "--ignore-domain-ids", ignore_domain_ids_str,
+ &domain_id_gtid_filter,
+ Gtid_event_filter::id_restriction_mode::BLACKLIST_MODE))
+ return 1;
+ break;
+ }
+ case OPT_DO_DOMAIN_IDS:
+ {
+ if (parse_gtid_filter_option<Domain_gtid_event_filter>(
+ "--do-domain-ids", do_domain_ids_str,
+ &domain_id_gtid_filter,
+ Gtid_event_filter::id_restriction_mode::WHITELIST_MODE))
+ return 1;
+ break;
+ }
+ case OPT_IGNORE_SERVER_IDS:
+ {
+ if (parse_gtid_filter_option<Server_gtid_event_filter>(
+ "--ignore-server-ids", ignore_server_ids_str,
+ &server_id_gtid_filter,
+ Gtid_event_filter::id_restriction_mode::BLACKLIST_MODE))
+ return 1;
+ break;
+ }
+ case OPT_DO_SERVER_IDS:
+ {
+ if (parse_gtid_filter_option<Server_gtid_event_filter>(
+ "--do-server-ids", do_server_ids_str,
+ &server_id_gtid_filter,
+ Gtid_event_filter::id_restriction_mode::WHITELIST_MODE))
+ return 1;
+ break;
+ }
+ case OPT_SERVER_ID:
+ {
+ if (parse_gtid_filter_option<Server_gtid_event_filter>(
+ "--server-id", server_id_str,
+ &server_id_gtid_filter,
+ Gtid_event_filter::id_restriction_mode::WHITELIST_MODE))
+ return 1;
break;
}
case '?':
@@ -2321,7 +2543,6 @@ get_one_option(const struct my_option *opt, const char *argument,
return 0;
}
-
static int parse_args(int *argc, char*** argv)
{
int ho_error;
@@ -2351,9 +2572,10 @@ static int parse_args(int *argc, char*** argv)
*/
gtid_state_validator= new Binlog_gtid_state_validator();
- if (domain_gtid_filter)
+ if (position_gtid_filter)
{
- if (opt_gtid_strict_mode && domain_gtid_filter->validate_window_filters())
+ if (opt_gtid_strict_mode &&
+ position_gtid_filter->validate_window_filters())
{
/*
In strict mode, if any --start/stop-position GTID ranges are invalid,
@@ -2362,17 +2584,24 @@ static int parse_args(int *argc, char*** argv)
*/
die(1);
}
+ extend_main_gtid_event_filter(position_gtid_filter);
/*
GTIDs before a start position shouldn't be validated, so we initialize
the stream auditor to only monitor GTIDs after these positions.
*/
- size_t n_start_gtids= domain_gtid_filter->get_num_start_gtids();
- rpl_gtid *start_gtids= domain_gtid_filter->get_start_gtids();
+ size_t n_start_gtids= position_gtid_filter->get_num_start_gtids();
+ rpl_gtid *start_gtids= position_gtid_filter->get_start_gtids();
gtid_state_validator->initialize_start_gtids(start_gtids, n_start_gtids);
my_free(start_gtids);
}
+ if(domain_id_gtid_filter)
+ extend_main_gtid_event_filter(domain_id_gtid_filter);
+
+ if(server_id_gtid_filter)
+ extend_main_gtid_event_filter(server_id_gtid_filter);
+
return 0;
}
@@ -2454,8 +2683,9 @@ static Exit_status dump_log_entries(const char* logname)
if (!print_event_info.init_ok())
return ERROR_STOP;
- if (domain_gtid_filter)
+ if (position_gtid_filter || domain_id_gtid_filter)
print_event_info.enable_event_group_filtering();
+
/*
Set safe delimiter, to dump things
like CREATE PROCEDURE safely
@@ -2557,7 +2787,8 @@ static Exit_status check_master_version()
goto err;
}
- if (domain_gtid_filter && domain_gtid_filter->get_num_start_gtids() > 0)
+ if (position_gtid_filter &&
+ position_gtid_filter->get_num_start_gtids() > 0)
{
char str_buf[256];
String query_str(str_buf, sizeof(str_buf), system_charset_info);
@@ -2565,8 +2796,8 @@ static Exit_status check_master_version()
query_str.append(STRING_WITH_LEN("SET @slave_connect_state='"),
system_charset_info);
- size_t n_start_gtids= domain_gtid_filter->get_num_start_gtids();
- rpl_gtid *start_gtids= domain_gtid_filter->get_start_gtids();
+ size_t n_start_gtids= position_gtid_filter->get_num_start_gtids();
+ rpl_gtid *start_gtids= position_gtid_filter->get_start_gtids();
for (size_t gtid_idx = 0; gtid_idx < n_start_gtids; gtid_idx++)
{
@@ -3513,7 +3744,7 @@ int main(int argc, char** argv)
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;\n");
- if (is_gtid_filtering_enabled())
+ if (gtid_event_filter)
{
fprintf(result_file,
"/*!100001 SET @@SESSION.SERVER_ID=@@GLOBAL.SERVER_ID */;\n"
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 52c1dc94537..2d6584aa05b 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -121,8 +121,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
opt_autocommit=0,opt_disable_keys=1,opt_xml=0,
opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
- opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
- opt_complete_insert= 0, opt_drop_database= 0,
+ opt_hex_blob=0, opt_order_by_primary=0, opt_order_by_size = 0,
+ opt_ignore=0, opt_complete_insert= 0, opt_drop_database= 0,
opt_replace_into= 0,
opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1,
opt_slave_apply= 0,
@@ -510,6 +510,10 @@ static struct my_option my_long_options[] =
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
&opt_order_by_primary, &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"order-by-size", 0,
+ "Dump tables in the order of their size, smaller first. Useful when using --single-transaction on tables which get truncated often. "
+ "Dumping smaller tables first reduces chances of often truncated tables to get altered before being dumped.",
+ &opt_order_by_size, &opt_order_by_size, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -1300,6 +1304,12 @@ static int get_options(int *argc, char ***argv)
MY_CS_PRIMARY,
MYF(MY_UTF8_IS_UTF8MB3 | MY_WME))))
exit(1);
+ if (opt_order_by_size && (*argc > 1 && !opt_databases))
+ {
+ fprintf(stderr, "%s: --order-by-size can't be used when dumping selected tables\n",
+ my_progname_short);
+ return EX_USAGE;
+ }
if ((*argc < 1 && (!opt_alldbs && !opt_system)) || (*argc > 0 && opt_alldbs))
{
short_usage(stderr);
@@ -4518,12 +4528,18 @@ err:
static char *getTableName(int reset, int want_sequences)
{
MYSQL_ROW row;
+ const char *query;
if (!get_table_name_result)
{
- if (mysql_get_server_version(mysql) >= FIRST_SEQUENCE_VERSION)
+ if (opt_order_by_size || mysql_get_server_version(mysql) >= FIRST_SEQUENCE_VERSION)
{
- const char *query= "SHOW FULL TABLES";
+ if (opt_order_by_size) {
+ query= "SELECT table_name, table_type FROM INFORMATION_SCHEMA.TABLES "
+ "WHERE table_schema = DATABASE() ORDER BY data_length, table_name";
+ } else {
+ query = "SHOW FULL TABLES";
+ }
if (mysql_query_with_error_report(mysql, 0, query))
return (NULL);
diff --git a/client/readline.cc b/client/readline.cc
index 6b9e8239984..e4014658c08 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -64,13 +64,8 @@ char *batch_readline(LINE_BUFFER *line_buff, bool binary_mode)
return 0;
if (out_length && pos[out_length-1] == '\n')
{
- /*
- On Windows platforms we also need to remove '\r', unconditionally. On
- Unix-like platforms we only remove it if we are not on binary mode.
- */
-
/* Remove '\n' */
- if (--out_length && IF_WIN(1,!binary_mode) && pos[out_length-1] == '\r')
+ if (--out_length && !binary_mode && pos[out_length-1] == '\r')
/* Remove '\r' */
out_length--;
}
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 34e97773c42..4811eec8f8c 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -227,6 +227,7 @@ IF(WITH_WSREP)
SETA(CPACK_RPM_server_PACKAGE_REQUIRES
"galera-4" "rsync" "lsof" "grep" "gawk" "iproute"
"coreutils" "findutils" "tar")
+ SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "pv")
ENDIF()
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index 344f0b8ecbb..f14c0145bc8 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -140,7 +140,7 @@ FUNCTION(INSTALL_DOCUMENTATION)
IF(RPM)
SET(destination "${destination}/MariaDB-${group}-${VERSION}")
ELSEIF(DEB)
- SET(destination "${destination}/mariadb-${group}-${MAJOR_VERSION}.${MINOR_VERSION}")
+ SET(destination "${destination}/mariadb-${group}")
ENDIF()
INSTALL(FILES ${files} DESTINATION ${destination} COMPONENT ${ARG_COMPONENT})
diff --git a/debian/additions/mariadb.conf.d/50-server.cnf b/debian/additions/mariadb.conf.d/50-server.cnf
index 28e37445888..953a34034c6 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.8 servers.
+# This group is only read by MariaDB-10.9 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.8]
+[mariadb-10.9]
diff --git a/debian/additions/source_mariadb-10.8.py b/debian/additions/source_mariadb.py
index 9b672189fdc..74c3633512b 100644
--- a/debian/additions/source_mariadb-10.8.py
+++ b/debian/additions/source_mariadb.py
@@ -1,4 +1,4 @@
-'''apport package hook for mariadb-10.8
+'''apport package hook for mariadb
(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.8', conffiles=None)
+ attach_conffiles(report, 'mariadb-server', 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 5c223c07648..abced44cdb2 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -36,7 +36,7 @@ then
then
cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/
echo >> debian/control
- sed "s/10.6/${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}/" <storage/columnstore/columnstore/debian/control >> debian/control
+ sed "s/-10.6//" <storage/columnstore/columnstore/debian/control >> debian/control
fi
fi
diff --git a/debian/changelog b/debian/changelog
index 72bd7ddc685..0ebfb0a61c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mariadb-10.8 (1:10.8.0) unstable; urgency=medium
+mariadb (1:10.9.0) unstable; urgency=medium
* Initial Release
diff --git a/debian/control b/debian/control
index 5c5c89f256f..2c59314bb4b 100644
--- a/debian/control
+++ b/debian/control
@@ -1,4 +1,4 @@
-Source: mariadb-10.8
+Source: mariadb
Section: database
Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
@@ -94,6 +94,7 @@ Depends: libmariadb-dev (= ${binary:Version}),
${misc:Depends}
Conflicts: libmariadb-client-lgpl-dev,
libmariadb-client-lgpl-dev-compat,
+ libmariadbclient-dev (<< ${source:Version}),
libmariadbclient-dev-compat,
libmysqlclient-dev,
libmysqlclient10-dev,
@@ -108,6 +109,7 @@ Breaks: libmariadb-dev (<< ${source:Version})
Replaces: libmariadb-client-lgpl-dev,
libmariadb-client-lgpl-dev-compat,
libmariadb-dev (<< ${source:Version}),
+ libmariadbclient-dev (<< ${source:Version}),
libmariadbclient-dev-compat,
libmysqlclient-dev
Description: MariaDB Connector/C, compatibility symlinks
@@ -263,13 +265,14 @@ Description: MariaDB common configuration files
.
This package includes configuration files common to all MariaDB programs.
-Package: mariadb-client-core-10.8
+Package: mariadb-client-core
Architecture: any
Depends: libmariadb3 (>= 10.5.4),
mariadb-common (>= ${source:Version}),
${misc:Depends},
${shlibs:Depends}
-Conflicts: mariadb-client-10.0,
+Conflicts: mariadb-client (<< ${source:Version}),
+ mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
@@ -277,7 +280,7 @@ Conflicts: mariadb-client-10.0,
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
- mariadb-client-10.8 (<< ${source:Version}),
+ mariadb-client-10.8,
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -290,6 +293,7 @@ Conflicts: mariadb-client-10.0,
mariadb-client-core-10.5,
mariadb-client-core-10.6,
mariadb-client-core-10.7,
+ mariadb-client-core-10.8,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
@@ -306,6 +310,7 @@ Conflicts: mariadb-client-10.0,
virtual-mysql-client-core
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
+ mariadb-server-core (<< ${source:Version}),
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
@@ -314,7 +319,7 @@ Breaks: mariadb-server-10.0,
mariadb-server-core-10.5,
mariadb-server-core-10.6,
mariadb-server-core-10.7,
- mariadb-server-core-10.8 (<< ${source:Version}),
+ mariadb-server-core-10.8,
mysql-cluster-community-client-plugins,
mysql-server-core-5.5,
mysql-server-core-5.6,
@@ -326,7 +331,8 @@ Breaks: mariadb-server-10.0,
percona-xtradb-cluster-server-5.6,
percona-xtradb-cluster-server-5.7,
percona-xtradb-cluster-server-8.0
-Replaces: mariadb-client-10.0,
+Replaces: mariadb-client (<< ${source:Version}),
+ mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
@@ -334,7 +340,8 @@ Replaces: mariadb-client-10.0,
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
- mariadb-client-10.8 (<< ${source:Version}),
+ mariadb-client-10.8,
+ mariadb-client-10.9 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -347,12 +354,14 @@ Replaces: mariadb-client-10.0,
mariadb-client-core-10.5,
mariadb-client-core-10.6,
mariadb-client-core-10.7,
+ mariadb-client-core-10.8,
mariadb-client-core-5.1,
mariadb-client-core-5.2,
mariadb-client-core-5.3,
mariadb-client-core-5.5,
mariadb-server-10.0,
mariadb-server-10.1,
+ mariadb-server-core (<< ${source:Version}),
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
@@ -361,7 +370,8 @@ Replaces: mariadb-client-10.0,
mariadb-server-core-10.5,
mariadb-server-core-10.6,
mariadb-server-core-10.7,
- mariadb-server-core-10.8 (<< ${source:Version}),
+ mariadb-server-core-10.8,
+ mariadb-server-core-10.9 (<< ${source:Version}),
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
@@ -384,6 +394,7 @@ Replaces: mariadb-client-10.0,
percona-xtradb-cluster-server-8.0,
virtual-mysql-client-core
Provides: default-mysql-client-core,
+ mariadb-client-core-10.9,
virtual-mysql-client-core
Description: MariaDB database core client binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
@@ -393,11 +404,11 @@ Description: MariaDB database core client binaries
.
This package includes the core client files, as used by Akonadi.
-Package: mariadb-client-10.8
+Package: mariadb-client
Architecture: any
Depends: debianutils (>=1.6),
libconfig-inifiles-perl,
- mariadb-client-core-10.8 (>= ${source:Version}),
+ mariadb-client-core (>= ${source:Version}),
mariadb-common,
${misc:Depends},
${perl:Depends},
@@ -411,7 +422,8 @@ Conflicts: mariadb-client (<< ${source:Version}),
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
- mariadb-client-10.8 (<< ${source:Version}),
+ mariadb-client-10.8,
+ mariadb-client-10.9 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
@@ -431,7 +443,8 @@ Conflicts: mariadb-client (<< ${source:Version}),
mysql-client-core-8.0,
mytop,
virtual-mysql-client
-Breaks: mariadb-client-core-10.0,
+Breaks: mariadb-client-core (<< ${source:Version}),
+ mariadb-client-core-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
mariadb-client-core-10.3,
@@ -439,7 +452,9 @@ Breaks: mariadb-client-core-10.0,
mariadb-client-core-10.5,
mariadb-client-core-10.6,
mariadb-client-core-10.7,
- mariadb-client-core-10.8 (<< ${source:Version}),
+ mariadb-client-core-10.8,
+ mariadb-client-core-10.9 (<< ${source:Version}),
+ mariadb-server (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
@@ -448,7 +463,9 @@ Breaks: mariadb-client-core-10.0,
mariadb-server-10.5,
mariadb-server-10.6,
mariadb-server-10.7,
- mariadb-server-10.8 (<< ${source:Version}),
+ mariadb-server-10.8,
+ mariadb-server-10.9 (<< ${source:Version}),
+ mariadb-server-core (<< ${source:Version}),
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
@@ -457,7 +474,7 @@ Breaks: mariadb-client-core-10.0,
mariadb-server-core-10.5,
mariadb-server-core-10.6,
mariadb-server-core-10.7,
- mariadb-server-core-10.8 (<< ${source:Version}),
+ mariadb-server-core-10.8,
mysql-server-5.5,
mysql-server-5.6,
mysql-server-5.7,
@@ -478,10 +495,13 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
+ mariadb-client-10.8,
+ mariadb-client-10.9 (<< ${source:Version}),
mariadb-client-5.1,
mariadb-client-5.2,
mariadb-client-5.3,
mariadb-client-5.5,
+ mariadb-client-core (<< ${source:Version}),
mariadb-client-core-10.0,
mariadb-client-core-10.1,
mariadb-client-core-10.2,
@@ -490,7 +510,9 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-client-core-10.5,
mariadb-client-core-10.6,
mariadb-client-core-10.7,
- mariadb-client-core-10.8 (<< ${source:Version}),
+ mariadb-client-core-10.8,
+ mariadb-client-core-10.9 (<< ${source:Version}),
+ mariadb-server (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
@@ -499,7 +521,9 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-server-10.5,
mariadb-server-10.6,
mariadb-server-10.7,
- mariadb-server-10.8 (<< ${source:Version}),
+ mariadb-server-10.8,
+ mariadb-server-10.9 (<< ${source:Version}),
+ mariadb-server-core (<< ${source:Version}),
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
@@ -508,7 +532,8 @@ Replaces: mariadb-client (<< ${source:Version}),
mariadb-server-core-10.5,
mariadb-server-core-10.6,
mariadb-server-core-10.7,
- mariadb-server-core-10.8 (<< ${source:Version}),
+ mariadb-server-core-10.8,
+ mariadb-server-core-10.9 (<< ${source:Version}),
mysql-client (<< 5.0.51),
mysql-client-5.0,
mysql-client-5.1,
@@ -536,6 +561,7 @@ Replaces: mariadb-client (<< ${source:Version}),
percona-xtradb-cluster-server-5.7,
virtual-mysql-client
Provides: default-mysql-client,
+ mariadb-client-10.9,
virtual-mysql-client
Recommends: libdbd-mariadb-perl | libdbd-mysql-perl,
libdbi-perl,
@@ -549,7 +575,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.8
+Package: mariadb-server-core
Architecture: any
Depends: mariadb-common (>= ${source:Version}),
${misc:Depends},
@@ -562,6 +588,8 @@ Conflicts: mariadb-server-core-10.0,
mariadb-server-core-10.5,
mariadb-server-core-10.6,
mariadb-server-core-10.7,
+ mariadb-server-core-10.8,
+ mariadb-server-core-10.9 (<< ${source:Version}),
mariadb-server-core-5.1,
mariadb-server-core-5.2,
mariadb-server-core-5.3,
@@ -574,7 +602,8 @@ Conflicts: mariadb-server-core-10.0,
mysql-server-core-5.7,
mysql-server-core-8.0,
virtual-mysql-server-core
-Breaks: mariadb-client-10.0,
+Breaks: mariadb-client (<< ${source:Version}),
+ mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
@@ -582,7 +611,9 @@ Breaks: mariadb-client-10.0,
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
- mariadb-client-10.8 (<< ${source:Version}),
+ mariadb-client-10.8,
+ mariadb-client-10.9 (<< ${source:Version}),
+ mariadb-server (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
@@ -591,7 +622,8 @@ Breaks: mariadb-client-10.0,
mariadb-server-10.5,
mariadb-server-10.6,
mariadb-server-10.7,
- mariadb-server-10.8 (<< ${source:Version}),
+ mariadb-server-10.8,
+ mariadb-server-10.9 (<< ${source:Version}),
mysql-client-5.5,
mysql-server-5.5,
mysql-server-5.6,
@@ -600,7 +632,8 @@ Breaks: mariadb-client-10.0,
percona-server-server-5.6,
percona-xtradb-cluster-server-5.6,
percona-xtradb-cluster-server-5.7
-Replaces: mariadb-client-10.0,
+Replaces: mariadb-client (<< ${source:Version}),
+ mariadb-client-10.0,
mariadb-client-10.1,
mariadb-client-10.2,
mariadb-client-10.3,
@@ -608,7 +641,9 @@ Replaces: mariadb-client-10.0,
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
- mariadb-client-10.8 (<< ${source:Version}),
+ mariadb-client-10.8,
+ mariadb-client-10.9 (<< ${source:Version}),
+ mariadb-server (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2,
@@ -617,7 +652,8 @@ Replaces: mariadb-client-10.0,
mariadb-server-10.5,
mariadb-server-10.6,
mariadb-server-10.7,
- mariadb-server-10.8 (<< ${source:Version}),
+ mariadb-server-10.8,
+ mariadb-server-10.9 (<< ${source:Version}),
mariadb-server-core-10.0,
mariadb-server-core-10.1,
mariadb-server-core-10.2,
@@ -645,6 +681,7 @@ Replaces: mariadb-client-10.0,
percona-xtradb-cluster-server-5.7,
virtual-mysql-server-core
Provides: default-mysql-server-core,
+ mariadb-server-core-10.9,
virtual-mysql-server-core
Description: MariaDB database core server files
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
@@ -654,12 +691,13 @@ Description: MariaDB database core server files
.
This package includes the core server files, as used by Akonadi.
-Package: mariadb-server-10.8
+Package: mariadb-server
Architecture: any
Suggests: mailx,
mariadb-test,
netcat-openbsd
-Recommends: libhtml-template-perl
+Recommends: libhtml-template-perl,
+ pv
Pre-Depends: adduser (>= 3.40),
debconf,
mariadb-common (>= ${source:Version})
@@ -669,8 +707,8 @@ Depends: galera-4 (>= 26.4),
libdbi-perl,
lsb-base (>= 3.0-10),
lsof [linux-any],
- mariadb-client-10.8 (>= ${source:Version}),
- mariadb-server-core-10.8 (>= ${source:Version}),
+ mariadb-client (>= ${source:Version}),
+ mariadb-server-core (>= ${source:Version}),
passwd,
perl (>= 5.6),
procps,
@@ -689,6 +727,8 @@ Conflicts: mariadb-server (<< ${source:Version}),
mariadb-server-10.5,
mariadb-server-10.6,
mariadb-server-10.7,
+ mariadb-server-10.8,
+ mariadb-server-10.9 (<< ${source:Version}),
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
@@ -718,10 +758,12 @@ Breaks: handlersocket-mysql-5.5,
Replaces: handlersocket-mysql-5.5,
libmariadbclient-dev (<< 5.5.0),
libmariadbclient16,
+ mariadb-client (<< ${source:Version}),
mariadb-client-10.5,
mariadb-client-10.6,
mariadb-client-10.7,
- mariadb-client-10.8 (<< ${source:Version}),
+ mariadb-client-10.8,
+ mariadb-client-10.9 (<< ${source:Version}),
mariadb-server (<< ${source:Version}),
mariadb-server-10.0,
mariadb-server-10.1,
@@ -731,6 +773,8 @@ Replaces: handlersocket-mysql-5.5,
mariadb-server-10.5,
mariadb-server-10.6,
mariadb-server-10.7,
+ mariadb-server-10.8,
+ mariadb-server-10.9 (<< ${source:Version}),
mariadb-server-5.1,
mariadb-server-5.2,
mariadb-server-5.3,
@@ -753,6 +797,7 @@ Replaces: handlersocket-mysql-5.5,
percona-xtradb-cluster-server-5.7,
virtual-mysql-server
Provides: default-mysql-server,
+ mariadb-server-10.9,
virtual-mysql-server
Description: MariaDB database server binaries
MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
@@ -762,32 +807,6 @@ Description: MariaDB database server binaries
.
This package includes the server binaries.
-Package: mariadb-server
-Architecture: all
-Depends: mariadb-server-10.8 (>= ${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.8), 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.
- .
- MariaDB is a fast, stable and true multi-user, multi-threaded SQL database
- server. SQL (Structured Query Language) is the most popular database query
- language in the world. The main goals of MariaDB are speed, robustness and
- ease of use.
-
-Package: mariadb-client
-Architecture: all
-Depends: mariadb-client-10.8 (>= ${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.8), 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.
-
Package: mariadb-backup
Architecture: any
Breaks: mariadb-backup-10.1,
@@ -798,7 +817,7 @@ Replaces: mariadb-backup-10.1,
mariadb-backup-10.2,
mariadb-backup-10.3,
mariadb-client-10.1
-Depends: mariadb-client-core-10.8 (= ${binary:Version}),
+Depends: mariadb-client-core (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: Backup tool for MariaDB server
@@ -811,7 +830,7 @@ Description: Backup tool for MariaDB server
Package: mariadb-plugin-connect
Architecture: any
Depends: libxml2,
- mariadb-server-10.8 (= ${server:Version}),
+ mariadb-server (= ${server:Version}),
unixodbc,
${misc:Depends},
${shlibs:Depends}
@@ -839,7 +858,7 @@ Description: Connect storage engine for MariaDB
Package: mariadb-plugin-s3
Architecture: any
Depends: libcurl4,
- mariadb-server-10.8 (= ${server:Version}),
+ mariadb-server (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Description: Amazon S3 archival storage engine for MariaDB
@@ -849,7 +868,7 @@ Description: Amazon S3 archival storage engine for MariaDB
Package: mariadb-plugin-rocksdb
Architecture: amd64 arm64 mips64el ppc64el
-Depends: mariadb-server-10.8 (= ${server:Version}),
+Depends: mariadb-server (= ${server:Version}),
python3:any,
rocksdb-tools,
${misc:Depends},
@@ -869,7 +888,7 @@ Description: RocksDB storage engine for MariaDB
Package: mariadb-plugin-oqgraph
Architecture: any
Depends: libjudydebian1,
- mariadb-server-10.8 (= ${server:Version}),
+ mariadb-server (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-oqgraph-engine-10.0,
@@ -893,7 +912,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.8 (= ${server:Version}),
+Depends: mariadb-server (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
@@ -913,7 +932,7 @@ Description: Mroonga storage engine for MariaDB
Package: mariadb-plugin-spider
Architecture: any
-Depends: mariadb-server-10.8 (= ${server:Version}),
+Depends: mariadb-server (= ${server:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
@@ -935,7 +954,7 @@ Description: Spider storage engine for MariaDB
Package: mariadb-plugin-gssapi-server
Architecture: any
Depends: libgssapi-krb5-2,
- mariadb-server-10.8,
+ mariadb-server,
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-gssapi-server-10.1,
@@ -960,7 +979,7 @@ Package: mariadb-plugin-gssapi-client
Architecture: any
Multi-Arch: same
Depends: libgssapi-krb5-2,
- mariadb-client-10.8 (= ${binary:Version}),
+ mariadb-client (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-gssapi-client-10.1,
@@ -980,7 +999,7 @@ Description: GSSAPI authentication plugin for MariaDB client
Package: mariadb-plugin-cracklib-password-check
Architecture: any
Depends: libcrack2 (>= 2.9.0),
- mariadb-server-10.8,
+ mariadb-server,
${misc:Depends},
${shlibs:Depends}
Description: CrackLib Password Validation Plugin for MariaDB
@@ -989,9 +1008,19 @@ Description: CrackLib Password Validation Plugin for MariaDB
.
Install and configure this to enforce stronger passwords for MariaDB users.
+Package: mariadb-plugin-hashicorp-key-management
+Architecture: any
+Depends: libcurl4,
+ mariadb-server,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: Hashicorp Key Management plugin for MariaDB
+ This encryption plugin uses Hashicorp Vault for storing encryption
+ keys for MariaDB Data-at-Rest encryption.
+
Package: mariadb-plugin-provider-bzip2
Architecture: any
-Depends: mariadb-server-10.8,
+Depends: mariadb-server,
${misc:Depends},
${shlibs:Depends}
Description: BZip2 compression support in the server and storage engines
@@ -1005,7 +1034,7 @@ Description: BZip2 compression support in the server and storage engines
Package: mariadb-plugin-provider-lz4
Architecture: any
-Depends: mariadb-server-10.8,
+Depends: mariadb-server,
${misc:Depends},
${shlibs:Depends}
Description: LZ4 compression support in the server and storage engines
@@ -1019,7 +1048,7 @@ Description: LZ4 compression support in the server and storage engines
Package: mariadb-plugin-provider-lzma
Architecture: any
-Depends: mariadb-server-10.8,
+Depends: mariadb-server,
${misc:Depends},
${shlibs:Depends}
Description: LZMA compression support in the server and storage engines
@@ -1033,7 +1062,7 @@ Description: LZMA compression support in the server and storage engines
Package: mariadb-plugin-provider-lzo
Architecture: any
-Depends: mariadb-server-10.8,
+Depends: mariadb-server,
${misc:Depends},
${shlibs:Depends}
Description: LZO compression support in the server and storage engines
@@ -1047,7 +1076,7 @@ Description: LZO compression support in the server and storage engines
Package: mariadb-plugin-provider-snappy
Architecture: any
-Depends: mariadb-server-10.8,
+Depends: mariadb-server,
${misc:Depends},
${shlibs:Depends}
Description: Snappy compression support in the server and storage engines
@@ -1061,8 +1090,8 @@ Description: Snappy compression support in the server and storage engines
Package: mariadb-test
Architecture: any
-Depends: mariadb-client-10.8 (= ${binary:Version}),
- mariadb-server-10.8 (= ${server:Version}),
+Depends: mariadb-client (= ${binary:Version}),
+ mariadb-server (= ${server:Version}),
mariadb-test-data (= ${source:Version}),
virtual-mysql-testsuite,
${misc:Depends},
diff --git a/debian/libmariadb-dev.install b/debian/libmariadb-dev.install
index 08be370ca6d..c015d59ae9b 100644
--- a/debian/libmariadb-dev.install
+++ b/debian/libmariadb-dev.install
@@ -1,3 +1,4 @@
+usr/bin/mariadb-config
usr/bin/mariadb_config
usr/include/mariadb/errmsg.h
usr/include/mariadb/ma_list.h
@@ -32,3 +33,4 @@ usr/lib/*/pkgconfig/libmariadb.pc
usr/share/aclocal/mysql.m4
usr/share/man/man1/mariadb_config.1
usr/share/man/man1/mysql_config.1
+usr/share/man/man3/*.3
diff --git a/debian/libmariadb-dev.links b/debian/libmariadb-dev.links
index 31a5f655555..b6d84cc8369 100644
--- a/debian/libmariadb-dev.links
+++ b/debian/libmariadb-dev.links
@@ -1,2 +1 @@
-usr/bin/mariadb_config usr/bin/mariadb-config
usr/share/man/man1/mariadb_config.1.gz usr/share/man/man1/mariadb-config.1.gz
diff --git a/debian/mariadb-backup.install b/debian/mariadb-backup.install
index b332b8724d5..e450f8f46a0 100644
--- a/debian/mariadb-backup.install
+++ b/debian/mariadb-backup.install
@@ -1,3 +1,4 @@
+usr/bin/mariabackup
usr/bin/mariadb-backup
usr/bin/mbstream
usr/share/man/man1/mariabackup.1
diff --git a/debian/mariadb-backup.links b/debian/mariadb-backup.links
deleted file mode 100644
index 924b476393b..00000000000
--- a/debian/mariadb-backup.links
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin/mariadb-backup usr/bin/mariabackup
diff --git a/debian/mariadb-client-core-10.8.links b/debian/mariadb-client-core-10.8.links
deleted file mode 100644
index 5134dd814b5..00000000000
--- a/debian/mariadb-client-core-10.8.links
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin/mariadb usr/bin/mysql
diff --git a/debian/mariadb-client-core-10.8.install b/debian/mariadb-client-core.install
index 421b62d2a1a..bcc3515a02f 100644
--- a/debian/mariadb-client-core-10.8.install
+++ b/debian/mariadb-client-core.install
@@ -1,6 +1,7 @@
usr/bin/mariadb
usr/bin/mariadb-check
usr/bin/my_print_defaults
+usr/bin/mysql
usr/share/man/man1/mariadb-check.1
usr/share/man/man1/mariadb.1
usr/share/man/man1/my_print_defaults.1
diff --git a/debian/mariadb-client-10.8.README.Debian b/debian/mariadb-client.README.Debian
index 64f0f509951..64f0f509951 100644
--- a/debian/mariadb-client-10.8.README.Debian
+++ b/debian/mariadb-client.README.Debian
diff --git a/debian/mariadb-client-10.8.docs b/debian/mariadb-client.docs
index c09092629c3..c09092629c3 100644
--- a/debian/mariadb-client-10.8.docs
+++ b/debian/mariadb-client.docs
diff --git a/debian/mariadb-client-10.8.install b/debian/mariadb-client.install
index 3a92ded15b6..fba8d093810 100644
--- a/debian/mariadb-client-10.8.install
+++ b/debian/mariadb-client.install
@@ -22,6 +22,17 @@ usr/bin/mariadb-slap
usr/bin/mariadb-tzinfo-to-sql
usr/bin/mariadb-waitpid
usr/bin/msql2mysql
+usr/bin/mysql_find_rows
+usr/bin/mysql_fix_extensions
+usr/bin/mysql_waitpid
+usr/bin/mysqlaccess
+usr/bin/mysqladmin
+usr/bin/mysqlcheck
+usr/bin/mysqldump
+usr/bin/mysqldumpslow
+usr/bin/mysqlimport
+usr/bin/mysqlshow
+usr/bin/mysqlslap
usr/bin/mytop
usr/bin/perror
usr/bin/replace
diff --git a/debian/mariadb-client-10.8.links b/debian/mariadb-client.links
index bc42197629b..62e3651daf5 100644
--- a/debian/mariadb-client-10.8.links
+++ b/debian/mariadb-client.links
@@ -1,5 +1,3 @@
-usr/bin/mariadb-access usr/bin/mysqlaccess
-usr/bin/mariadb-admin usr/bin/mysqladmin
usr/bin/mariadb-check usr/bin/mariadb-analyze
usr/bin/mariadb-check usr/bin/mariadb-optimize
usr/bin/mariadb-check usr/bin/mariadb-repair
@@ -8,15 +6,7 @@ usr/bin/mariadb-check usr/bin/mysqlanalyze
usr/bin/mariadb-check usr/bin/mysqlcheck
usr/bin/mariadb-check usr/bin/mysqloptimize
usr/bin/mariadb-check usr/bin/mysqlrepair
-usr/bin/mariadb-dump usr/bin/mysqldump
-usr/bin/mariadb-dumpslow usr/bin/mysqldumpslow
-usr/bin/mariadb-find-rows usr/bin/mysql_find_rows
-usr/bin/mariadb-fix-extensions usr/bin/mysql_fix_extensions
-usr/bin/mariadb-import usr/bin/mysqlimport
usr/bin/mariadb-report usr/bin/mysqlreport
-usr/bin/mariadb-show usr/bin/mysqlshow
-usr/bin/mariadb-slap usr/bin/mysqlslap
-usr/bin/mariadb-waitpid usr/bin/mysql_waitpid
usr/share/man/man1/mariadb-check.1.gz usr/share/man/man1/mariadb-analyze.1.gz
usr/share/man/man1/mariadb-check.1.gz usr/share/man/man1/mariadb-optimize.1.gz
usr/share/man/man1/mariadb-check.1.gz usr/share/man/man1/mariadb-repair.1.gz
diff --git a/debian/mariadb-client-10.8.manpages b/debian/mariadb-client.manpages
index 8735caeea8b..8735caeea8b 100644
--- a/debian/mariadb-client-10.8.manpages
+++ b/debian/mariadb-client.manpages
diff --git a/debian/mariadb-client-10.8.menu b/debian/mariadb-client.menu
index 0667c93e8f3..b452218bfe7 100644
--- a/debian/mariadb-client-10.8.menu
+++ b/debian/mariadb-client.menu
@@ -1,3 +1,3 @@
# According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/
-?package(mariadb-client-10.8):needs="text" section="Applications/Data Management"\
+?package(mariadb-client):needs="text" section="Applications/Data Management"\
title="Innotop" command="/usr/bin/innotop"
diff --git a/debian/mariadb-plugin-hashicorp-key-management.install b/debian/mariadb-plugin-hashicorp-key-management.install
new file mode 100644
index 00000000000..ca63f3df403
--- /dev/null
+++ b/debian/mariadb-plugin-hashicorp-key-management.install
@@ -0,0 +1,3 @@
+etc/mysql/mariadb.conf.d/hashicorp_key_management.cnf
+usr/lib/mysql/plugin/hashicorp_key_management.so
+usr/share/doc/mariadb-plugin-hashicorp-key-management/hashicorp_key_management.txt
diff --git a/debian/mariadb-plugin-rocksdb.install b/debian/mariadb-plugin-rocksdb.install
index dcc576ea937..67b8026d697 100644
--- a/debian/mariadb-plugin-rocksdb.install
+++ b/debian/mariadb-plugin-rocksdb.install
@@ -1,6 +1,7 @@
etc/mysql/mariadb.conf.d/rocksdb.cnf
usr/bin/mariadb-ldb
usr/bin/myrocks_hotbackup
+usr/bin/mysql_ldb
usr/lib/mysql/plugin/ha_rocksdb.so
usr/share/man/man1/mariadb-ldb.1
usr/share/man/man1/myrocks_hotbackup.1
diff --git a/debian/mariadb-plugin-rocksdb.links b/debian/mariadb-plugin-rocksdb.links
deleted file mode 100644
index d24682a5a66..00000000000
--- a/debian/mariadb-plugin-rocksdb.links
+++ /dev/null
@@ -1 +0,0 @@
-usr/bin/mariadb-ldb usr/bin/mysql_ldb
diff --git a/debian/mariadb-server-10.8.links b/debian/mariadb-server-10.8.links
deleted file mode 100644
index 9cc3a436ba8..00000000000
--- a/debian/mariadb-server-10.8.links
+++ /dev/null
@@ -1,10 +0,0 @@
-usr/bin/mariadb-binlog usr/bin/mysqlbinlog
-usr/bin/mariadb-convert-table-format usr/bin/mysql_convert_table_format
-usr/bin/mariadb-hotcopy usr/bin/mysqlhotcopy
-usr/bin/mariadb-plugin usr/bin/mysql_plugin
-usr/bin/mariadb-secure-installation usr/bin/mysql_secure_installation
-usr/bin/mariadb-setpermission usr/bin/mysql_setpermission
-usr/bin/mariadb-tzinfo-to-sql usr/bin/mysql_tzinfo_to_sql
-usr/bin/mariadbd-multi usr/bin/mysqld_multi
-usr/bin/mariadbd-safe usr/bin/mysqld_safe
-usr/bin/mariadbd-safe-helper usr/bin/mysqld_safe_helper
diff --git a/debian/mariadb-server-core-10.8.links b/debian/mariadb-server-core-10.8.links
deleted file mode 100644
index c2be98f38fb..00000000000
--- a/debian/mariadb-server-core-10.8.links
+++ /dev/null
@@ -1,3 +0,0 @@
-usr/bin/mariadb-install-db usr/bin/mysql_install_db
-usr/bin/mariadb-upgrade usr/bin/mysql_upgrade
-usr/sbin/mariadbd usr/sbin/mysqld
diff --git a/debian/mariadb-server-core-10.8.install b/debian/mariadb-server-core.install
index 6d159ba4c6a..4eee370672a 100644
--- a/debian/mariadb-server-core-10.8.install
+++ b/debian/mariadb-server-core.install
@@ -1,8 +1,11 @@
usr/bin/innochecksum
usr/bin/mariadb-install-db
usr/bin/mariadb-upgrade
+usr/bin/mysql_install_db
+usr/bin/mysql_upgrade
usr/bin/resolveip
usr/sbin/mariadbd
+usr/sbin/mysqld
usr/share/man/man1/innochecksum.1
usr/share/man/man1/mariadb-install-db.1
usr/share/man/man1/mariadb-upgrade.1
diff --git a/debian/mariadb-server-10.8.README.Debian b/debian/mariadb-server.README.Debian
index 6042249a706..6042249a706 100644
--- a/debian/mariadb-server-10.8.README.Debian
+++ b/debian/mariadb-server.README.Debian
diff --git a/debian/mariadb-server-10.8.config b/debian/mariadb-server.config
index 448b51584ea..7875b1843ac 100644
--- a/debian/mariadb-server-10.8.config
+++ b/debian/mariadb-server.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.8/nis_warning || true
+ db_input high mariadb-server/nis_warning || true
db_go
fi
diff --git a/debian/mariadb-server-10.8.dirs b/debian/mariadb-server.dirs
index 5057fe806c3..5057fe806c3 100644
--- a/debian/mariadb-server-10.8.dirs
+++ b/debian/mariadb-server.dirs
diff --git a/debian/mariadb-server-10.8.install b/debian/mariadb-server.install
index 71fe6bc77d5..254e9cc8945 100644
--- a/debian/mariadb-server-10.8.install
+++ b/debian/mariadb-server.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.8.py usr/share/apport/package-hooks
+debian/additions/source_mariadb.py usr/share/apport/package-hooks
etc/apparmor.d/usr.sbin.mariadbd
etc/security/user_map.conf
lib/*/security/pam_user_map.so
@@ -26,6 +26,16 @@ usr/bin/myisam_ftdump
usr/bin/myisamchk
usr/bin/myisamlog
usr/bin/myisampack
+usr/bin/mysql_convert_table_format
+usr/bin/mysql_plugin
+usr/bin/mysql_secure_installation
+usr/bin/mysql_setpermission
+usr/bin/mysql_tzinfo_to_sql
+usr/bin/mysqlbinlog
+usr/bin/mysqld_multi
+usr/bin/mysqld_safe
+usr/bin/mysqld_safe_helper
+usr/bin/mysqlhotcopy
usr/bin/wsrep_sst_common
usr/bin/wsrep_sst_mariabackup
usr/bin/wsrep_sst_mysqldump
@@ -53,7 +63,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.8/mariadbd.sym.gz
+usr/share/doc/mariadb-server/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.8.logcheck.ignore.paranoid b/debian/mariadb-server.logcheck.ignore.paranoid
index 407d4063270..407d4063270 100644
--- a/debian/mariadb-server-10.8.logcheck.ignore.paranoid
+++ b/debian/mariadb-server.logcheck.ignore.paranoid
diff --git a/debian/mariadb-server-10.8.logcheck.ignore.server b/debian/mariadb-server.logcheck.ignore.server
index a64fc54e15c..a64fc54e15c 100644
--- a/debian/mariadb-server-10.8.logcheck.ignore.server
+++ b/debian/mariadb-server.logcheck.ignore.server
diff --git a/debian/mariadb-server-10.8.logcheck.ignore.workstation b/debian/mariadb-server.logcheck.ignore.workstation
index a64fc54e15c..a64fc54e15c 100644
--- a/debian/mariadb-server-10.8.logcheck.ignore.workstation
+++ b/debian/mariadb-server.logcheck.ignore.workstation
diff --git a/debian/mariadb-server-10.8.mariadb.init b/debian/mariadb-server.mariadb.init
index 9dc8ebdfa07..f4051d4b007 100644
--- a/debian/mariadb-server-10.8.mariadb.init
+++ b/debian/mariadb-server.mariadb.init
@@ -183,7 +183,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.8/README.Debian.gz!"
+ log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server/README.Debian.gz!"
exit -1
else
log_end_msg 0
diff --git a/debian/mariadb-server-10.8.mysql-server.logrotate b/debian/mariadb-server.mysql-server.logrotate
index 11e4480c427..11e4480c427 100644
--- a/debian/mariadb-server-10.8.mysql-server.logrotate
+++ b/debian/mariadb-server.mysql-server.logrotate
diff --git a/debian/mariadb-server-10.8.mysql.default b/debian/mariadb-server.mysql.default
index 36079edecb2..36079edecb2 100644
--- a/debian/mariadb-server-10.8.mysql.default
+++ b/debian/mariadb-server.mysql.default
diff --git a/debian/mariadb-server-10.8.postinst b/debian/mariadb-server.postinst
index a259a50ac55..2da1c736dec 100644
--- a/debian/mariadb-server-10.8.postinst
+++ b/debian/mariadb-server.postinst
@@ -3,16 +3,13 @@ set -e
. /usr/share/debconf/confmodule
-# Automatically set version to ease maintenance of this file
-MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
-
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
-ERR_LOGGER="logger -p daemon.err -t mariadb-server-$MAJOR_VER.postinst -i"
+ERR_LOGGER="logger -p daemon.err -t mariadb-server.postinst -i"
# Specify syslog tag name so it is clear the entry came from this postinst script.
# This will make an error in a logged command immediately apparent by aborting
# the install, rather than failing silently and leaving a broken install.
@@ -161,7 +158,7 @@ EOF
# Clean up old flags before setting new one
rm -f $mysql_datadir/debian-*.flag
# Flag data dir to avoid downgrades
- touch "$mysql_datadir/debian-$MAJOR_VER.flag"
+ touch "$mysql_datadir/debian-__MARIADB_MAJOR_VER__.flag"
# initiate databases. Output is not allowed by debconf :-(
# This will fail if we are upgrading an existing database; in this case
diff --git a/debian/mariadb-server-10.8.postrm b/debian/mariadb-server.postrm
index 94ce91db31d..035f10bbb8a 100644
--- a/debian/mariadb-server-10.8.postrm
+++ b/debian/mariadb-server.postrm
@@ -3,9 +3,6 @@ set -e
. /usr/share/debconf/confmodule
-# Automatically set version to ease maintenance of this file
-MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
-
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
@@ -54,14 +51,14 @@ esac
# - Remove the mysql user only after all his owned files are purged.
# - Cleanup the initscripts only if this was the last provider of them
#
-if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then
+if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-__MARIADB_MAJOR_VER__.flag" ]; then
# we remove the mysql user only after all his owned files are purged
rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz}
rm -rf /var/log/mysql
- db_input high "mariadb-server-$MAJOR_VER/postrm_remove_databases" || true
+ db_input high "mariadb-server/postrm_remove_databases" || true
db_go || true
- db_get "mariadb-server-$MAJOR_VER/postrm_remove_databases" || true
+ db_get "mariadb-server/postrm_remove_databases" || true
if [ "$RET" = "true" ]; then
# never remove the debian.cnf when the databases are still existing
# else we ran into big trouble on the next install!
diff --git a/debian/mariadb-server-10.8.preinst b/debian/mariadb-server.preinst
index c865173e29e..2204d230bdd 100644
--- a/debian/mariadb-server-10.8.preinst
+++ b/debian/mariadb-server.preinst
@@ -9,9 +9,6 @@
. /usr/share/debconf/confmodule
-# Automatically set version to ease maintenance of this file
-MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}"
-
# Just kill the invalid insserv.conf.d directory without fallback
if [ -d "/etc/insserv.conf.d/mariadb/" ]; then
rm -rf "/etc/insserv.conf.d/mariadb/"
@@ -51,7 +48,9 @@ stop_server() {
################################ main() ##########################
-this_version=$MAJOR_VER
+# @TODO: Rewrite this to use the new upstream /var/lib/mysql_upgrade_info file
+# instead of the legacy /var/lib/debian-XX.X.flag file
+this_version=__MARIADB_MAJOR_VER__
max_upgradeable_version=5.7
# Check if a flag file is found that indicates a previous MariaDB or MySQL
@@ -136,7 +135,7 @@ fi
# Instead simply move the old datadir and create a new for this_version.
if [ ! -z "$downgrade_detected" ]
then
- db_input critical "mariadb-server-$MAJOR_VER/old_data_directory_saved" || true
+ db_input critical "mariadb-server/old_data_directory_saved" || true
db_go
echo "The file $mysql_datadir/debian-$found_version.flag indicates a" 1>&2
echo "version that cannot automatically be upgraded. Therefore the" 1>&2
diff --git a/debian/mariadb-server-10.8.prerm b/debian/mariadb-server.prerm
index 8fd172da9d2..8fd172da9d2 100644
--- a/debian/mariadb-server-10.8.prerm
+++ b/debian/mariadb-server.prerm
diff --git a/debian/mariadb-server-10.8.templates b/debian/mariadb-server.templates
index 910ba82f108..3f790bcd250 100644
--- a/debian/mariadb-server-10.8.templates
+++ b/debian/mariadb-server.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.8/old_data_directory_saved
+Template: mariadb-server/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.8/nis_warning
+Template: mariadb-server/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.8/postrm_remove_databases
+Template: mariadb-server/postrm_remove_databases
Type: boolean
Default: false
_Description: Remove all MariaDB databases?
diff --git a/debian/mariadb-server-10.8.triggers b/debian/mariadb-server.triggers
index d1f5f5e14f1..d1f5f5e14f1 100644
--- a/debian/mariadb-server-10.8.triggers
+++ b/debian/mariadb-server.triggers
diff --git a/debian/mariadb-test.install b/debian/mariadb-test.install
index e587a3bf73d..5dda38d665c 100644
--- a/debian/mariadb-test.install
+++ b/debian/mariadb-test.install
@@ -2,6 +2,10 @@ usr/bin/mariadb-client-test
usr/bin/mariadb-client-test-embedded
usr/bin/mariadb-test
usr/bin/mariadb-test-embedded
+usr/bin/mysql_client_test
+usr/bin/mysql_client_test_embedded
+usr/bin/mysqltest
+usr/bin/mysqltest_embedded
usr/lib/*/libmariadb3/plugin/auth_test_plugin.so
usr/lib/*/libmariadb3/plugin/qa_auth_client.so
usr/lib/*/libmariadb3/plugin/qa_auth_interface.so
@@ -37,7 +41,10 @@ usr/share/mysql/mysql-test/README.stress
usr/share/mysql/mysql-test/dgcov.pl
usr/share/mysql/mysql-test/lib
usr/share/mysql/mysql-test/mariadb-stress-test.pl
+usr/share/mysql/mysql-test/mariadb-test-run
usr/share/mysql/mysql-test/mariadb-test-run.pl
+usr/share/mysql/mysql-test/mtr
+usr/share/mysql/mysql-test/mysql-test-run
usr/share/mysql/mysql-test/mysql-test-run.pl
usr/share/mysql/mysql-test/purify.supp
usr/share/mysql/mysql-test/suite.pm
diff --git a/debian/mariadb-test.links b/debian/mariadb-test.links
deleted file mode 100644
index c7e4ae10063..00000000000
--- a/debian/mariadb-test.links
+++ /dev/null
@@ -1,8 +0,0 @@
-usr/bin/mariadb-client-test usr/bin/mysql_client_test
-usr/bin/mariadb-client-test-embedded usr/bin/mysql_client_test_embedded
-usr/bin/mariadb-test usr/bin/mysqltest
-usr/bin/mariadb-test-embedded usr/bin/mysqltest_embedded
-usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mariadb-test-run
-usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mtr
-usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mysql-test-run
-usr/share/mysql/mysql-test/mariadb-test-run.pl usr/share/mysql/mysql-test/mysql-test-run.pl
diff --git a/debian/not-installed b/debian/not-installed
index c7566c237d1..e92a8f77ad0 100644
--- a/debian/not-installed
+++ b/debian/not-installed
@@ -1,53 +1,73 @@
etc/columnstore/storagemanager.cnf.example # Copy of etc/columnstore/storagemanager.cnf that is installed
+etc/logrotate.d/mysql # Debian packaging uses mariadb-server.mysql-server.logrotate
+etc/my.cnf # Debian packaging has /etc/mysql/my.cnf, which is a symlink to mariadb.cnf
+etc/mysql/mariadb.conf.d/client.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/
+etc/mysql/mariadb.conf.d/enable_encryption.preset # Debian packaging uses files from debian/additions/mariadb.cnf.d/
+etc/mysql/mariadb.conf.d/mysql-clients.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/
+etc/mysql/mariadb.conf.d/server.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/
+lib/systemd/system/mariadb-extra.socket # Installed by rules file
+lib/systemd/system/mariadb-extra@.socket # Installed by rules file
lib/systemd/system/mariadb.service # Installed by rules file
lib/systemd/system/mariadb.socket # Installed by rules file
-lib/systemd/system/mariadb-extra.socket # Installed by rules file
lib/systemd/system/mariadb@.service # Installed by rules file
lib/systemd/system/mariadb@.socket # Installed by rules file
-lib/systemd/system/mariadb-extra@.socket # Installed by rules file
-usr/bin/mysql_config # We already have the MariaDB variant
-usr/bin/mytop # Mytop is distributed from a separate source package
+usr/bin/mariadb-embedded # Shipping the embedded server in distro packaging does not make sense
+usr/bin/mysql_config # Debian packaging has mysql_config as symlink to mariadb_config
+usr/bin/mysql_embedded # Symlink to mariadb-embedded which is intentionally not included
usr/bin/sst_dump # Use the one from rocksdb-tools package
-usr/lib/mysql/plugin/JavaWrappers.jar # These are only built if JNI/libjawt.so is installed from e.g. openjdk-8-jre-headless
-usr/lib/mysql/plugin/JdbcInterface.jar # These are only built if JNI/libjawt.so is installed from e.g. openjdk-8-jre-headless
-usr/lib/sysusers.d/sysusers.conf
-usr/lib/tmpfiles.d/tmpfiles.conf
-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.8/COPYING
-usr/share/doc/mariadb-server-10.8/COPYING.AGPLv3
-usr/share/doc/mariadb-server-10.8/COPYING.GPLv2
-usr/share/doc/mariadb-server-10.8/COPYING.thirdparty
-usr/share/doc/mariadb-server-10.8/CREDITS
-usr/share/doc/mariadb-server-10.8/EXCEPTIONS-CLIENT
-usr/share/doc/mariadb-server-10.8/INSTALL-BINARY
-usr/share/doc/mariadb-server-10.8/PATENTS
-usr/share/doc/mariadb-server-10.8/README-wsrep
-usr/share/groonga/COPYING
-usr/share/groonga-normalizer-mysql/lgpl-2.0.txt
+usr/lib/aarch64-linux-gnu/libdbbc.a # ColumnStore header file
+usr/lib/aarch64-linux-gnu/libidbboot.a # ColumnStore header file
+usr/lib/aarch64-linux-gnu/libprocessor.a # ColumnStore header file
+usr/lib/aarch64-linux-gnu/libwe_xml.a # ColumnStore header file
+usr/lib/x86_64-linux-gnu/libdbbc.a # ColumnStore header file
+usr/lib/x86_64-linux-gnu/libidbboot.a # ColumnStore header file
+usr/lib/x86_64-linux-gnu/libprocessor.a # ColumnStore header file
+usr/lib/x86_64-linux-gnu/libwe_xml.a # ColumnStore header file
+usr/bin/test-connect-t
+usr/bin/wsrep_sst_backup
+usr/lib/mysql/plugin/type_test.so
+usr/lib/sysusers.d/mariadb.conf # Not used (yet) in Debian systemd
+usr/lib/tmpfiles.d/mariadb.conf # Not used (yet) in Debian systemd
+usr/sbin/rcmysql
+usr/share/doc/mariadb-server/COPYING (related file: "debian/tmp/usr/share/mysql/mroonga/COPYING")
+usr/share/doc/mariadb-server/CREDITS
+usr/share/doc/mariadb-server/INSTALL-BINARY
+usr/share/doc/mariadb-server/README-wsrep
+usr/share/doc/mariadb-server/README.md
+usr/share/doc/mariadb-server/THIRDPARTY
usr/share/groonga-normalizer-mysql/README.md
+usr/share/groonga-normalizer-mysql/lgpl-2.0.txt
+usr/share/groonga/COPYING
usr/share/groonga/README.md
+usr/share/man/man1/mariadb-embedded.1 # Shipping the embedded server in distro packaging does not make sense
+usr/share/man/man1/mysql_embedded.1 # Symlink to mariadb-embedded.1 which is intentionally not included
usr/share/man/man1/my_safe_process.1
+usr/share/man/man1/mysql-stress-test.pl.1
usr/share/man/man1/mysql.server.1
+usr/share/mysql/JavaWrappers.jar
+usr/share/mysql/JdbcInterface.jar
+usr/share/mysql/Mongo2.jar
+usr/share/mysql/Mongo3.jar
usr/share/mysql/binary-configure
usr/share/mysql/magic
-usr/share/mysql/maria_add_gis_sp.sql
+usr/share/mysql/maria_add_gis_sp.sql # mariadb-server-core.install has *_bootstrap.sql
+usr/share/mysql/mysql-log-rotate # Debian packaging uses mariadb-server.mysql-server.logrotate
+usr/share/mysql/mysql-test/asan.supp
+usr/share/mysql/mysql-test/lsan.supp
+usr/share/mysql/mysql-test/unstable-tests
+usr/share/mysql/mysql.server # Debian packaging uses mariadb-server.mariadb.init
usr/share/mysql/mysqld_multi.server
-usr/share/mysql/mysql-log-rotate
-usr/share/mysql/mysql.server
-usr/share/mysql/mysql-test/mtr # Already created by mariadb-test.links
-usr/share/mysql/mysql-test/mysql-test-run # Already created by mariadb-test.links
-usr/share/mysql/mysql_to_mariadb.sql
usr/share/mysql/policy/apparmor/README # In MariaDB we don't want to use AppArmor at the moment
usr/share/mysql/policy/apparmor/usr.sbin.mysqld # In MariaDB we don't want to use AppArmor at the moment
usr/share/mysql/policy/apparmor/usr.sbin.mysqld.local # In MariaDB we don't want to use AppArmor at the moment
+usr/share/mysql/policy/selinux/README # In MariaDB we don't want to use SELinux at the moment
usr/share/mysql/policy/selinux/mariadb-server.fc # In MariaDB we don't want to use SELinux at the moment
usr/share/mysql/policy/selinux/mariadb-server.te # In MariaDB we don't want to use SELinux at the moment
usr/share/mysql/policy/selinux/mariadb.te # In MariaDB we don't want to use SELinux at the moment
-usr/share/mysql/policy/selinux/README # In MariaDB we don't want to use SELinux at the moment
+usr/share/mysql/systemd/mariadb-extra@.socket # Installed by rules file
usr/share/mysql/systemd/mariadb.service # Installed by rules file
usr/share/mysql/systemd/mariadb@.service # Installed by rules file
+usr/share/mysql/systemd/mariadb@.socket # Installed by rules file
+usr/share/mysql/systemd/mysql.service # Installed by rules file
+usr/share/mysql/systemd/mysqld.service # Installed by rules file
usr/share/mysql/systemd/use_galera_new_cluster.conf
-usr/share/mysql/wsrep.cnf
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
index dd5f492240d..460c8f7c4de 100644
--- a/debian/po/POTFILES.in
+++ b/debian/po/POTFILES.in
@@ -1 +1 @@
-[type: gettext/rfc822deb] mariadb-server-10.8.templates
+[type: gettext/rfc822deb] mariadb-server.templates
diff --git a/debian/po/ar.po b/debian/po/ar.po
index 0a68a467664..171200593c4 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "ملاحظة هامة لمستخدمي NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "إزالة جميع قواعد بيانات MariaDB؟"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 d8fe9eeb97e..5eb310971d1 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.8 package.
+# his file is distributed under the same license as the mariadb package.
# Aleix Badia i Bosch <abadia@ica.es> 2004
# Innocent De Marchi <tangram.peces@gmail.com> 2017
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota important pels usuaris de «NIS/YP»"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Eliminar totes les bases de dades MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 4eefea44b5c..67619ca1c6c 100644
--- a/debian/po/cs.po
+++ b/debian/po/cs.po
@@ -13,8 +13,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Odstranit všechny MariaDB databáze?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 c4b43d2bf38..c639f03a938 100644
--- a/debian/po/da.po
+++ b/debian/po/da.po
@@ -1,13 +1,13 @@
-# Danish translation mariadb-10.8.
-# Copyright (C) 2014 mariadb-10.8 og nedenstående oversættere.
-# This file is distributed under the same license as the mariadb-10.8 package.
+# Danish translation mariadb.
+# Copyright (C) 2014 mariadb og nedenstående oversættere.
+# This file is distributed under the same license as the mariadb package.
# Claus Hindsgaul <claus.hindsgaul@gmail.com>, 2005, 2006, 2007.
# Joe Hansen <joedalton2@yahoo.dk>, 2014, 2016.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Vigtig oplysning til NIS/YP-brugere"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Fjern alle MariaDB-databaser?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 1d0f80e42e2..9d305601355 100644
--- a/debian/po/de.po
+++ b/debian/po/de.po
@@ -1,4 +1,4 @@
-# German translation of mariadb-10.8 10.0.13-1
+# German translation of mariadb 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Wichtige Anmerkung für NIS/YP-Benutzer!"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Alle MariaDB-Datenbanken entfernen?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 367e8ee2fe0..1dd0877822b 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para los usuarios de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "¿Desea eliminar todas las bases de datos MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 715cff3f39d..ee7191356e0 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP erabiltzaileentzat ohar garrantzitsua"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Ezabatu MariaDB datubase guztiak?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 1e10a5042c7..d5a1b6d7b5e 100644
--- a/debian/po/fi.po
+++ b/debian/po/fi.po
@@ -1,11 +1,11 @@
-# Finnish translations for mariadb-10.8 package
-# This file is distributed under the same license as the mariadb-10.8 package.
+# Finnish translations for mariadb package
+# This file is distributed under the same license as the mariadb package.
# Antti Järvinen <antti.jarvinen@katiska.org>, 2017.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Merkittävä huomio NIS/YP -käyttäjille"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Poistetaanko kaikki MariaDB-tietokannat?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 bb408ebbf18..14b4c84a156 100644
--- a/debian/po/fr.po
+++ b/debian/po/fr.po
@@ -1,6 +1,6 @@
-# Translation of mariadb-10.8 debconf templates to French
+# Translation of mariadb 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.8 packages.
+# This file is distributed under the same license as the mariadb 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Note importante pour les utilisateurs NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Faut-il supprimer toutes les bases de données MariaDB ?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 267a78e3cd4..5567c609829 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para os usuarios de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "¿Eliminar tódalas bases de datos de MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 10bf8a78671..56f134fd50e 100644
--- a/debian/po/it.po
+++ b/debian/po/it.po
@@ -1,11 +1,11 @@
-# Italian (it) translation of debconf templates for mariadb-10.8
-# This file is distributed under the same license as the mariadb-10.8 package.
+# Italian (it) translation of debconf templates for mariadb
+# This file is distributed under the same license as the mariadb package.
# Luca Monducci <luca.mo@tiscali.it>, 2006-2017.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8 10.0.13 Italian debconf templates\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb 10.0.13 Italian debconf templates\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante per gli utenti NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Eliminare tutti i database MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 9131a8382f5..a8b2a0a9685 100644
--- a/debian/po/ja.po
+++ b/debian/po/ja.po
@@ -15,8 +15,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8 10.0.32-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb 10.0.32-1\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "å¤ã„データディレクトリã¯ã€æ–°ã—ã„場所ã«ä¿å­˜ã•ã‚Œã¾ã™"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "NIS/YP ユーザã¸ã®é‡è¦ãªæ³¨æ„"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "ã™ã¹ã¦ã® MariaDB データベースを削除ã—ã¾ã™ã‹?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 92f0b0eb55d..e4255bdea50 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 e1907112182..2cf0a2b1fe8 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.8 package.
+# This file is distributed under the same license as the mariadb 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Belangrijke opmerking voor gebruikers van NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Wilt u alle MariaDB-databases verwijderen?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 997dfccd617..fae123972cc 100644
--- a/debian/po/pt.po
+++ b/debian/po/pt.po
@@ -6,8 +6,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Nota importante para os utilizadores de NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Remover todas as bases de dados MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 ac94a297e2a..0249342c54b 100644
--- a/debian/po/pt_BR.po
+++ b/debian/po/pt_BR.po
@@ -1,12 +1,12 @@
-# Debconf translations for mariadb-10.8.
-# This file is distributed under the same license as the mariadb-10.8 package.
+# Debconf translations for mariadb.
+# This file is distributed under the same license as the mariadb 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.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Aviso importante para usuários NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Remover todas as bases de dados do MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 b728a4e4235..66ea63ef766 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 db74169593b..9b36c68fd92 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.8 10.0.25-1\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb 10.0.25-1\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr "Каталог Ñо Ñтарыми данными будет Ñохранён в новом меÑте"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Важное замечание Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»ÐµÐ¹ NIS/YP"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Удалить вÑе базы данных MariaDB?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 85674730c3a..4cd09734e10 100644
--- a/debian/po/sv.po
+++ b/debian/po/sv.po
@@ -1,13 +1,13 @@
-# Translation of mariadb-10.8 debconf template to Swedish
+# Translation of mariadb debconf template to Swedish
# Copyright (C) 2017 Martin Bagge <brother@bsnet.se>
-# This file is distributed under the same license as the mariadb-10.8 package.
+# This file is distributed under the same license as the mariadb 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.8@packages.debian.org\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr "Viktig information för NIS/YP-användare"
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Ta bort alla MariaDB-databaser?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 904d356ce1e..102b6214c73 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.8 package.
+# This file is distributed under the same license as the mariadb package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid "The old data directory will be saved at new location"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.templates:2001
msgid ""
"Please manually export/import your data (e.g. with mysqldump) if needed."
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.templates:3001
msgid "Important note for NIS/YP users"
msgstr ""
#. Type: note
#. Description
-#: ../mariadb-server-10.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr ""
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 cacd305029e..74320c147a0 100644
--- a/debian/po/tr.po
+++ b/debian/po/tr.po
@@ -5,8 +5,8 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.templates:4001
msgid "Remove all MariaDB databases?"
msgstr "Tüm MariaDB veritabanları kaldırılsın mı?"
#. Type: boolean
#. Description
-#: ../mariadb-server-10.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 c1dd1c22e10..bd048b56b5a 100644
--- a/debian/po/vi.po
+++ b/debian/po/vi.po
@@ -1,12 +1,12 @@
-# Vietnamese translations for mariadb-10.8 package
-# Bản dịch Tiếng Việt dành cho gói mariadb-10.8.
-# This file is distributed under the same license as the mariadb-10.8 package.
+# Vietnamese translations for mariadb package
+# Bản dịch Tiếng Việt dành cho gói mariadb.
+# This file is distributed under the same license as the mariadb package.
# Trần Ngá»c Quân <vnwildman@gmail.com>, 2017.
#
msgid ""
msgstr ""
-"Project-Id-Version: mariadb-10.8\n"
-"Report-Msgid-Bugs-To: mariadb-10.8@packages.debian.org\n"
+"Project-Id-Version: mariadb\n"
+"Report-Msgid-Bugs-To: mariadb@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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:2001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:3001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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.8.templates:4001
+#: ../mariadb-server.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 fb28b4fc7ce..81f313a1511 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,6 +25,8 @@ endif
BUILDDIR := builddir
DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*-//')
+DEB_VERSION_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/')
+DEB_VERSION_MAJOR := $(shell echo $(DEB_VERSION_VERSION) | sed -e 's/^\(.*\)\..*$$/\1/')
RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead?
TMP:=$(CURDIR)/debian/tmp
@@ -86,6 +88,10 @@ endif
echo "server:Version=$(DEB_VERSION)" >> debian/substvars
+ # As packages does not have major version any more on package name there is no way as it not set by dpkg
+ # to use this on postinst script. Use sed to determine major version
+ sed -i 's/__MARIADB_MAJOR_VER__/$(DEB_VERSION_MAJOR)/g' debian/mariadb-server.post* debian/mariadb-server.preinst
+
# Don't build ColumnStore as part of the native build as it does not meet the
# quality standards in Debian. Also building it requires an extra 4 GB of disk
# space which makes native Debian builds fail as the total disk space needed
@@ -139,12 +145,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.8.mariadb.service
- cp $(BUILDDIR)/support-files/mariadb.socket debian/mariadb-server-10.8.mariadb.socket
- cp $(BUILDDIR)/support-files/mariadb-extra.socket debian/mariadb-server-10.8.mariadb-extra.socket
- cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.8.mariadb@.service
- cp $(BUILDDIR)/support-files/mariadb@.socket debian/mariadb-server-10.8.mariadb@.socket
- cp $(BUILDDIR)/support-files/mariadb-extra@.socket debian/mariadb-server-10.8.mariadb-extra@.socket
+ cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server.mariadb.service
+ cp $(BUILDDIR)/support-files/mariadb.socket debian/mariadb-server.mariadb.socket
+ cp $(BUILDDIR)/support-files/mariadb-extra.socket debian/mariadb-server.mariadb-extra.socket
+ cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server.mariadb@.service
+ cp $(BUILDDIR)/support-files/mariadb@.socket debian/mariadb-server.mariadb@.socket
+ cp $(BUILDDIR)/support-files/mariadb-extra@.socket debian/mariadb-server.mariadb-extra@.socket
endif
# Run 'make install' without output since it is uninteresting and
@@ -163,7 +169,8 @@ 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.8/mariadbd.sym.gz
+ mkdir -p $(TMP)/usr/share/doc/mariadb-server
+ nm --defined-only $(BUILDDIR)/sql/mariadbd | LC_ALL=C sort | gzip -n -9 > $(TMP)/usr/share/doc/mariadb-server/mariadbd.sym.gz
# Rename and install AppArmor profile
install -D -m 644 debian/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mariadbd
@@ -214,6 +221,6 @@ override_dh_gencontrol:
# white list file only starting from Debian Stretch and Ubuntu Xenial.
# To find more, grep build logs for 'but is not installed to anywhere'.
%:
- dh $@ --parallel --with systemd --list-missing
+ dh $@ --parallel --with systemd --fail-missing
# vim: ts=8
diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml
index 162186b9386..e30a96c41e2 100644
--- a/debian/salsa-ci.yml
+++ b/debian/salsa-ci.yml
@@ -63,20 +63,6 @@ build sid:
variables:
RELEASE: sid
-build buster-backports:
- extends: .build-package
- script:
- # Increase default backports priority policy from '100' to '500' so it can actually be used
- - |
- cat << EOF > /etc/apt/preferences.d/enable-backports-to-satisfy-dependencies
- Package: *
- Pin: release n=buster-*
- Pin-Priority: 500
- EOF
- - *autobake-deb-steps
- variables:
- RELEASE: buster-backports
-
# Build native deb without using autobake-deb.sh. This way we will detect
# if the debian/control file and other packaging is correct as-is for Debian Sid.
build native deb amd64:
@@ -468,27 +454,6 @@ default-libmysqlclient-dev Buster upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-default-libmysqlclient-dev with Buster backports upgrade:
- stage: upgrade extras
- needs:
- - job: build buster-backports
- image: debian:buster
- artifacts:
- when: always
- name: "$CI_BUILD_NAME"
- paths:
- - ${WORKING_DIR}/debug
- script:
- - *test-prepare-container
- - apt-get install -y pkg-config default-libmysqlclient-dev
- - pkg-config --list-all
- - *test-enable-buster-backports-repos
- - *test-install-all-libs
- - *test-verify-libs
- except:
- variables:
- - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-
# 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.
#
@@ -525,6 +490,72 @@ mysql-8.0 from Ubuntu 22.04 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
+mariadb.org 10.9 to mariadb upgrade:
+ stage: upgrade extras
+ needs:
+ - job: build
+ image: debian:${RELEASE}
+ artifacts:
+ when: always
+ name: "$CI_BUILD_NAME"
+ paths:
+ - ${WORKING_DIR}/debug
+ script:
+ - *test-prepare-container
+ - apt install -y curl
+ - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
+ - echo "deb https://deb.mariadb.org/10.9/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
+ - apt-get update
+ - apt-get install -y mariadb-server-10.9
+ - *test-verify-initial
+ # Install MariaDB built in this commit
+ # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid
+ - apt-get install -y --allow-downgrades ./*.deb
+ # Verify installation of MariaDB built in this commit
+ - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
+ - mariadb --version # Client version
+ - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
+ - *test-verify-final
+ variables:
+ GIT_STRATEGY: none
+ except:
+ variables:
+ - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
+ allow_failure: true
+
+mariadb.org-10.8 to mariadb upgrade:
+ stage: upgrade extras
+ needs:
+ - job: build
+ image: debian:${RELEASE}
+ artifacts:
+ when: always
+ name: "$CI_BUILD_NAME"
+ paths:
+ - ${WORKING_DIR}/debug
+ script:
+ - *test-prepare-container
+ - apt install -y curl
+ - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
+ - echo "deb https://deb.mariadb.org/10.8/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
+ - apt-get update
+ - apt-get install -y mariadb-server-10.8
+ - *test-verify-initial
+ # Install MariaDB built in this commit
+ # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid
+ - apt-get install -y --allow-downgrades ./*.deb
+ # Verify installation of MariaDB built in this commit
+ - dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
+ - mariadb --version # Client version
+ - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
+ - *test-verify-final
+ variables:
+ GIT_STRATEGY: none
+ except:
+ variables:
+ - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
+ allow_failure: true
+
# 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-community-cluster-8.0 from MySQL.com upgrade:
@@ -562,7 +593,7 @@ mysql-community-cluster-8.0 from MySQL.com upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.7 to mariadb-10.8 upgrade:
+mariadb.org-10.7 to mariadb upgrade:
stage: upgrade extras
needs:
- job: build
@@ -578,18 +609,15 @@ mariadb.org-10.7 to mariadb-10.8 upgrade:
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
- echo "deb https://deb.mariadb.org/10.7/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- apt-get update
- # Package libmariadbclient-dev from mariadb.org conflicts with libmariadb-dev in Sid, so cannot use wildcard that would include it
- # Enable this line when there is a way to install them only from the mariadb.org repo
- # - apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*'
- apt-get install -y mariadb-server-10.7
- *test-verify-initial
# Install MariaDB built in this commit
- # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.5.5-1 vs 1:10.5.5+mariadb~sid
+ # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid
- apt-get install -y --allow-downgrades ./*.deb
# Verify installation of MariaDB built in this commit
- dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
- mariadb --version # Client version
- - service mariadb status # There is no init.d/mysql in MariaDB 10.8
+ - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- *test-verify-final
variables:
GIT_STRATEGY: none
@@ -597,12 +625,8 @@ mariadb.org-10.7 to mariadb-10.8 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
allow_failure: true
- # Installation on Sid fails on missing liburing1 because upstream 10.8
- # MariaDB.org buildbot has not run 'apt upgrade' for a long time.
- # Remove this allow_failure once buildbot has built a new 10.8
- # release using latest liburing-dev in Debian Sid.
-mariadb.org-10.6 to mariadb-10.8 upgrade:
+mariadb.org-10.6 to mariadb upgrade:
stage: upgrade extras
needs:
- job: build
@@ -618,13 +642,10 @@ mariadb.org-10.6 to mariadb-10.8 upgrade:
- curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc
- echo "deb https://deb.mariadb.org/10.6/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list
- apt-get update -qq
- # Package libmariadbclient-dev from mariadb.org conflicts with libmariadb-dev in Sid, so cannot use wildcard that would include it
- # Enable this line when there is a way to install them only from the mariadb.org repo
- # - apt-get install -y 'mariadb*' libmariadb3 'libmariadb-*' 'libmariadbd*'
- apt-get install -y mariadb-server-10.6
- *test-verify-initial
# Install MariaDB built in this commit
- # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.5.5-1 vs 1:10.5.5+mariadb~sid
+ # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid
- apt-get install -y --allow-downgrades ./*.deb
# Verify installation of MariaDB built in this commit
- dpkg -l | grep -iE 'maria|mysql|galera' || true # List installed
@@ -637,7 +658,7 @@ mariadb.org-10.6 to mariadb-10.8 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.5 to mariadb-10.8 upgrade:
+mariadb.org-10.5 to mariadb upgrade:
stage: upgrade extras
needs:
- job: build
@@ -664,7 +685,7 @@ mariadb.org-10.5 to mariadb-10.8 upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.4 to mariadb-10.8 with Buster backports upgrade:
+mariadb.org-10.4 to mariadb with Buster backports upgrade:
stage: upgrade extras
needs:
- job: build buster-backports
@@ -698,11 +719,11 @@ mariadb.org-10.4 to mariadb-10.8 with Buster backports upgrade:
variables:
- $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
-mariadb.org-10.3 to mariadb-10.8 with Buster backports upgrade:
+mariadb.org-10.3 to mariadb with Buster backports upgrade:
stage: upgrade extras
needs:
- - job: build buster-backports
- image: debian:buster
+ - job: build bullseye-backports
+ image: debian:bullseye
artifacts:
when: always
name: "$CI_BUILD_NAME"
@@ -762,7 +783,7 @@ mysql.com-5.7 upgrade:
# works. Thus the step to test it now intentionally has a fallback to use
# the service name 'mariadb' instead, and the fallback is always used.
- sleep 5 # Give the mysql_upgrade a bit of time to complete before querying the server
- - service mysql status || service mariadb status
+ - service mariadb status # There is no init.d/mysql in MariaDB 10.5+
- sleep 15 # Give the mysql_upgrade a bit of extra time to complete with MySQL 5.7 before querying the server
- *test-verify-final
variables:
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
index a3f95200f5d..0666044ac38 100644
--- a/debian/source/lintian-overrides
+++ b/debian/source/lintian-overrides
@@ -1,14 +1,31 @@
# 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.8 -> mysql-client-5.5
-version-substvar-for-external-package mariadb-server-10.8 -> mysql-server
+version-substvar-for-external-package mariadb-client-core -> mysql-client-5.5
+version-substvar-for-external-package mariadb-server -> 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.8 -> mysql-client-5.*
-version-substvar-for-external-package mariadb-server-10.8 -> mysql-client-8.*
-version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-5.*
-version-substvar-for-external-package mariadb-client-10.8 -> mysql-client-core-8.*
+version-substvar-for-external-package mariadb-server-10.9 -> mysql-client-5.*
+version-substvar-for-external-package mariadb-server-10.9 -> mysql-client-8.*
+version-substvar-for-external-package mariadb-client-10.9 -> mysql-client-core-5.*
+version-substvar-for-external-package mariadb-client-10.9 -> mysql-client-core-8.*
version-substvar-for-external-package libmariadbd-dev -> libmariadbclient-dev
+# Intentional version-substvar-for-external-package as long as mariadb-server
+# provides mariadb-server-10.9 and mariadb-client provides mariadb-client-10.9
+version-substvar-for-external-package Conflicts (line 408) ${source:Version} mariadb-client -> mariadb-client-10.9
+version-substvar-for-external-package Conflicts (line 575) ${source:Version} mariadb-server-core -> mariadb-server-core-10.9
+version-substvar-for-external-package Conflicts (line 711) ${source:Version} mariadb-server -> mariadb-server-10.9
+version-substvar-for-external-package Conflicts (line 95) ${source:Version} libmariadb-dev-compat -> libmariadbclient-dev
+version-substvar-for-external-package Replaces (line 109) ${source:Version} libmariadb-dev-compat -> libmariadbclient-dev
+version-substvar-for-external-package Replaces (line 330) ${source:Version} mariadb-client-core -> mariadb-client-10.9
+version-substvar-for-external-package Replaces (line 330) ${source:Version} mariadb-client-core -> mariadb-server-core-10.9
+version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-client-10.9
+version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-client-core-10.9
+version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-server-10.9
+version-substvar-for-external-package Replaces (line 481) ${source:Version} mariadb-client -> mariadb-server-core-10.9
+version-substvar-for-external-package Replaces (line 626) ${source:Version} mariadb-server-core -> mariadb-client-10.9
+version-substvar-for-external-package Replaces (line 626) ${source:Version} mariadb-server-core -> mariadb-server-10.9
+version-substvar-for-external-package Replaces (line 748) ${source:Version} mariadb-server -> mariadb-client-10.9
+version-substvar-for-external-package Replaces (line 748) ${source:Version} mariadb-server -> mariadb-server-10.9
# 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
source-is-missing [storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2]
@@ -25,8 +42,6 @@ version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqld-dev
version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqlclient-dev [debian/control:*]
version-substvar-for-external-package Replaces * libmariadb-dev -> libmysqld-dev [debian/control:*]
version-substvar-for-external-package Replaces * libmariadbd-dev -> libmariadbclient-dev [debian/control:*]
-# We can't change build dependencies on a stable branch (10.5..10.8) so just override this
-missing-build-dependency-for-dh-addon systemd *
# Data or test files where long lines are justified
very-long-line-length-in-source-file *.test *
very-long-line-length-in-source-file *.result *
diff --git a/debian/tests/control b/debian/tests/control
index 743f6497702..bc9c7d91874 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -3,7 +3,7 @@ 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.8,
+Depends: mariadb-plugin-rocksdb | mariadb-server,
mariadb-plugin-provider-bzip2,
mariadb-plugin-provider-lz4,
mariadb-plugin-provider-lzma,
diff --git a/debian/tests/smoke b/debian/tests/smoke
index 9e001f9692f..b3e09acc8ae 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.8).
+# mariadb-server).
#
# This test should be declared in debian/tests/control with the
# following restrictions:
@@ -93,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.8, which happens before that of the plugin.
+ # mariadb-server, which happens before that of the plugin.
[ -e $LOG ] || mariadb -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 2b84f1cbca7..40562aeae5d 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -494,7 +494,7 @@ static uint parse_input_file(const char *file_name, struct errors **top_error,
section_start= er_offset;
section_count= 0;
- if (!(file= my_fopen(file_name, O_RDONLY | O_SHARE, MYF(MY_WME))))
+ if (!(file= my_fopen(file_name, O_RDONLY | O_TEXT | O_SHARE, MYF(MY_WME))))
DBUG_RETURN(0);
while ((str= fgets(buff, sizeof(buff), file)))
diff --git a/include/json_lib.h b/include/json_lib.h
index dfb76cadfad..f7231b07636 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -83,7 +83,9 @@ enum json_path_step_types
JSON_PATH_KEY_WILD= 1+4,
JSON_PATH_KEY_DOUBLEWILD= 1+8,
JSON_PATH_ARRAY_WILD= 2+4,
- JSON_PATH_ARRAY_DOUBLEWILD= 2+8
+ JSON_PATH_ARRAY_DOUBLEWILD= 2+8,
+ JSON_PATH_NEGATIVE_INDEX= 16,
+ JSON_PATH_ARRAY_RANGE= 32
};
@@ -93,7 +95,8 @@ typedef struct st_json_path_step_t
/* see json_path_step_types */
const uchar *key; /* Pointer to the beginning of the key. */
const uchar *key_end; /* Pointer to the end of the key. */
- uint n_item; /* Item number in an array. No meaning for the key step. */
+ int n_item; /* Item number in an array. No meaning for the key step. */
+ int n_item_end; /* Last index of the range. */
} json_path_step_t;
@@ -356,7 +359,7 @@ int json_skip_level_and_count(json_engine_t *j, int *n_items_skipped);
*/
int json_find_path(json_engine_t *je,
json_path_t *p, json_path_step_t **p_cur_step,
- uint *array_counters);
+ int *array_counters);
typedef struct st_json_find_paths_t
@@ -365,7 +368,7 @@ typedef struct st_json_find_paths_t
json_path_t *paths;
uint cur_depth;
uint *path_depths;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
} json_find_paths_t;
@@ -425,13 +428,8 @@ int json_get_path_start(json_engine_t *je, CHARSET_INFO *i_cs,
int json_get_path_next(json_engine_t *je, json_path_t *p);
-
-int json_path_parts_compare(
- const json_path_step_t *a, const json_path_step_t *a_end,
- const json_path_step_t *b, const json_path_step_t *b_end,
- enum json_value_types vt);
int json_path_compare(const json_path_t *a, const json_path_t *b,
- enum json_value_types vt);
+ enum json_value_types vt, const int* array_size_counter);
int json_valid(const char *js, size_t js_len, CHARSET_INFO *cs);
@@ -443,6 +441,8 @@ int json_locate_key(const char *js, const char *js_end,
int json_normalize(DYNAMIC_STRING *result,
const char *s, size_t size, CHARSET_INFO *cs);
+int json_skip_array_and_count(json_engine_t *j, int* n_item);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 872a9e16b79..4b7378b4ecd 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -1292,6 +1292,15 @@ extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci;
+/*
+ Contextually typed collations, e.g.:
+ CHAR(10) COLLATE DEFAULT
+ CHAR(10) BINARY
+*/
+extern struct charset_info_st my_collation_contextually_typed_default;
+extern struct charset_info_st my_collation_contextually_typed_binary;
+
+
#define MY_UTF8MB3 "utf8mb3"
#define MY_UTF8MB4 "utf8mb4"
diff --git a/include/my_base.h b/include/my_base.h
index 026e4bf347b..22f1ea0a5df 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -35,7 +35,7 @@
#define HA_OPEN_ABORT_IF_LOCKED 0U /* default */
#define HA_OPEN_WAIT_IF_LOCKED 1U
-#define HA_OPEN_IGNORE_IF_LOCKED 2U
+#define HA_OPEN_IGNORE_IF_LOCKED 2U /* Ignore lock error */
#define HA_OPEN_TMP_TABLE 4U /* Table is a temp table */
#define HA_OPEN_DELAY_KEY_WRITE 8U /* Don't update index */
#define HA_OPEN_ABORT_IF_CRASHED 16U
diff --git a/include/my_global.h b/include/my_global.h
index 962f7396008..54f76bf5d91 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -592,6 +592,9 @@ typedef SOCKET_SIZE_TYPE size_socket;
#else
#define HAVE_SOCK_CLOEXEC
#endif
+#ifndef O_TEXT
+#define O_TEXT 0
+#endif
/* additional file share flags for win32 */
#ifdef _WIN32
diff --git a/include/mysql_com.h b/include/mysql_com.h
index b0d5b026dd8..a2befe2d324 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -180,7 +180,7 @@ enum enum_indicator_type
#define NUM_FLAG 32768U /* Field is num (for clients) */
#define PART_KEY_FLAG 16384U /* Intern; Part of some key */
#define GROUP_FLAG 32768U /* Intern: Group field */
-#define BINCMP_FLAG 131072U /* Intern: Used by sql_yacc */
+#define CONTEXT_COLLATION_FLAG 131072U /* Intern: Used by sql_yacc */
#define GET_FIXED_FIELDS_FLAG (1U << 18) /* Used to get fields in item tree */
#define FIELD_IN_PART_FUNC_FLAG (1U << 19)/* Field part of partition func */
#define PART_INDIRECT_KEY_FLAG (1U << 20)
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 490c2ed41b5..5d5cc35e1be 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -126,6 +126,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/sql_analyze_stmt.cc ../sql/sql_analyze_stmt.h
../sql/compat56.cc
../sql/sql_schema.cc
+ ../sql/lex_charset.cc
../sql/sql_type.cc ../sql/sql_type.h
../sql/sql_mode.cc
../sql/sql_type_string.cc
diff --git a/man/comp_err.1 b/man/comp_err.1
index 260295d56ab..6be91925bcc 100644
--- a/man/comp_err.1
+++ b/man/comp_err.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBCOMP_ERR\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBCOMP_ERR\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1
index 271f743c068..8330668f983 100644
--- a/man/galera_new_cluster.1
+++ b/man/galera_new_cluster.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBGALERA_NEW_CLUSTER\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/galera_recovery.1 b/man/galera_recovery.1
index 90b90282d78..4261e81db79 100644
--- a/man/galera_recovery.1
+++ b/man/galera_recovery.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBGALERA_RECOVERY\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBGALERA_RECOVERY\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/innochecksum.1 b/man/innochecksum.1
index 94aad5ca0a1..eefeddfc67e 100644
--- a/man/innochecksum.1
+++ b/man/innochecksum.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBINNOCHECKSUM\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBINNOCHECKSUM\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mariabackup.1 b/man/mariabackup.1
index b6828f22f92..27354687f52 100644
--- a/man/mariabackup.1
+++ b/man/mariabackup.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mariadb-conv.1 b/man/mariadb-conv.1
index 16fb112f7f2..282b194f9df 100644
--- a/man/mariadb-conv.1
+++ b/man/mariadb-conv.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-CONV" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-CONV" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1
index 5132ae9c03f..f10af9cb8cd 100644
--- a/man/mariadb-service-convert.1
+++ b/man/mariadb-service-convert.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-SERVICE-CONVERT\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mbstream.1 b/man/mbstream.1
index 955768122dc..5cf23447e66 100644
--- a/man/mbstream.1
+++ b/man/mbstream.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMBSTREAM\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMBSTREAM\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/msql2mysql.1 b/man/msql2mysql.1
index 870d73558fd..d2a362eceee 100644
--- a/man/msql2mysql.1
+++ b/man/msql2mysql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMSQL2MYSQL\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMSQL2MYSQL\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1
index cb3c6f3ad12..7ce606f0bc2 100644
--- a/man/my_print_defaults.1
+++ b/man/my_print_defaults.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMY_PRINT_DEFAULTS" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMY_PRINT_DEFAULTS" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/my_safe_process.1 b/man/my_safe_process.1
index bc31526214b..5fdb3195605 100644
--- a/man/my_safe_process.1
+++ b/man/my_safe_process.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMY_SAFE_PROCESS\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMY_SAFE_PROCESS\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1
index 480935bb713..396c8341c8b 100644
--- a/man/myisam_ftdump.1
+++ b/man/myisam_ftdump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAM_FTDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMYISAM_FTDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/myisamchk.1 b/man/myisamchk.1
index 3c930bedcf1..203f0564f6a 100644
--- a/man/myisamchk.1
+++ b/man/myisamchk.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/myisamlog.1 b/man/myisamlog.1
index ce8f8c6011b..b77a16d58f8 100644
--- a/man/myisamlog.1
+++ b/man/myisamlog.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAMLOG\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMYISAMLOG\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/myisampack.1 b/man/myisampack.1
index 551c4a6088a..7a2127dfaac 100644
--- a/man/myisampack.1
+++ b/man/myisampack.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYISAMPACK\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMYISAMPACK\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/myrocks_hotbackup.1 b/man/myrocks_hotbackup.1
index 7e6384ea2c1..712bcd0cad4 100644
--- a/man/myrocks_hotbackup.1
+++ b/man/myrocks_hotbackup.1
@@ -1,4 +1,4 @@
-.TH MYROCKS_HOTBACKUP "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH MYROCKS_HOTBACKUP "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.SH NAME
myrocks_hotbackup \- streaming backup for MariaDB MyRocks
.SH DESCRIPTION
diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1
index f36b65f352e..f122c0f92ae 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\&.8" "MariaDB Database System"
+.TH "\FBMYSQL\-STRESS\-TE" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1
index 1e45e65190f..9f6909f9c66 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\&.8" "MariaDB Database System"
+.TH "\FBMYSQL\-TEST\-RUN\" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql.1 b/man/mysql.1
index 80a7c8cd360..6b51e0f46f9 100644
--- a/man/mysql.1
+++ b/man/mysql.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql.server.1 b/man/mysql.server.1
index 1b2582052f0..475b2dd717d 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\&.8" "MariaDB Database System"
+.TH "\FBMYSQL\&.SERVER\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_client_test.1 b/man/mysql_client_test.1
index 2ed454a19a3..2ed1527be72 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-CLIENT-TEST" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_config.1 b/man/mysql_config.1
index 579acdd7a84..9b45f894c92 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\&.8" "MariaDB Database System"
+.TH "\FBMYSQL_CONFIG\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_convert_table_format.1 b/man/mysql_convert_table_format.1
index df811abe02d..4561270f801 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-CONVERT-TAB" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_find_rows.1 b/man/mysql_find_rows.1
index b711460102e..fb5c0269878 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-FIND-ROWS\F" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_fix_extensions.1 b/man/mysql_fix_extensions.1
index d19bc821232..5ad730ffb2d 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-FIX-EXTENSI" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1
index 27369057a8d..17b260277c1 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-INSTALL-DB\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_ldb.1 b/man/mysql_ldb.1
index 783c49eb052..2903d5f7ae6 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-LDB\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_plugin.1 b/man/mysql_plugin.1
index 0e60671478b..f1180c6e0c0 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-PLUGIN\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/man/mysql_secure_installation.1 b/man/mysql_secure_installation.1
index 32540c56209..f4f8b9b54b6 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-SECURE-INST" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_setpermission.1 b/man/mysql_setpermission.1
index b23ac9f7156..e40d4fe4207 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-SETPERMISSI" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1
index e07442e30b1..9e11ac048f3 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-TZINFO-TO-S" "1" "22 April 2022" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1
index 0b48f039484..40486f7cf41 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysql_waitpid.1 b/man/mysql_waitpid.1
index 2502d66c5a7..40b79ba6a41 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-WAITPID\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlaccess.1 b/man/mysqlaccess.1
index c77ee4276dd..874dbaa01ec 100644
--- a/man/mysqlaccess.1
+++ b/man/mysqlaccess.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-ACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-ACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqladmin.1 b/man/mysqladmin.1
index f5af9065961..b118e8d8a04 100644
--- a/man/mysqladmin.1
+++ b/man/mysqladmin.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-ADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-ADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlbinlog.1 b/man/mysqlbinlog.1
index 6efd08d10b1..a4baf39c22c 100644
--- a/man/mysqlbinlog.1
+++ b/man/mysqlbinlog.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-BINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-BINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlcheck.1 b/man/mysqlcheck.1
index 250fe0017a7..0138c9a2ff1 100644
--- a/man/mysqlcheck.1
+++ b/man/mysqlcheck.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-CHECK\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-CHECK\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld.8 b/man/mysqld.8
index b04271ab4d6..a28d6a46fa5 100644
--- a/man/mysqld.8
+++ b/man/mysqld.8
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_multi.1 b/man/mysqld_multi.1
index c88ce6e4924..d333ffea80c 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADBD-MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_safe.1 b/man/mysqld_safe.1
index 1fdf23a0970..49d7b30bbd8 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADBD-SAFE\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqld_safe_helper.1 b/man/mysqld_safe_helper.1
index b24ccde8b88..bfd91f890aa 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\&.8" "MariaDB Database System"
+.TH "\FBMARIADBD-SAFE-HELPER\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqldump.1 b/man/mysqldump.1
index 21203f9d7cb..c3b526db891 100644
--- a/man/mysqldump.1
+++ b/man/mysqldump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-DUMP\FR" "1" "24 October 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-DUMP\FR" "1" "24 October 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqldumpslow.1 b/man/mysqldumpslow.1
index 164209db300..ef154b04302 100644
--- a/man/mysqldumpslow.1
+++ b/man/mysqldumpslow.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-DUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-DUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlhotcopy.1 b/man/mysqlhotcopy.1
index 5193abc3e87..fb819cd146c 100644
--- a/man/mysqlhotcopy.1
+++ b/man/mysqlhotcopy.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-HOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-HOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlimport.1 b/man/mysqlimport.1
index 32ab3c01574..3b34c8a809b 100644
--- a/man/mysqlimport.1
+++ b/man/mysqlimport.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-IMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-IMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlshow.1 b/man/mysqlshow.1
index fdea9f5842d..d33b3ad1523 100644
--- a/man/mysqlshow.1
+++ b/man/mysqlshow.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SHOW\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-SHOW\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqlslap.1 b/man/mysqlslap.1
index a3c7191bc22..7641574b526 100644
--- a/man/mysqlslap.1
+++ b/man/mysqlslap.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-SLAP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-SLAP\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mysqltest.1 b/man/mysqltest.1
index 56bb1996e69..415627f7b95 100644
--- a/man/mysqltest.1
+++ b/man/mysqltest.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMARIADB-TEST\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBMARIADB-TEST\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/mytop.1 b/man/mytop.1
index 32c7639975b..057c60d5066 100644
--- a/man/mytop.1
+++ b/man/mytop.1
@@ -1,4 +1,4 @@
-.TH MYTOP "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH MYTOP "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.SH NAME
mytop \- display MariaDB server performance info like 'top'
.SH "SEE ALSO"
diff --git a/man/perror.1 b/man/perror.1
index 4f80aad3b6a..5d4a08d9c5a 100644
--- a/man/perror.1
+++ b/man/perror.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBPERROR\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBPERROR\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/replace.1 b/man/replace.1
index c9ffd898815..b4e60d21901 100644
--- a/man/replace.1
+++ b/man/replace.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBREPLACE\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBREPLACE\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1
index e36090727c4..8275cd4341a 100644
--- a/man/resolve_stack_dump.1
+++ b/man/resolve_stack_dump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBRESOLVE_STACK_DUM" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBRESOLVE_STACK_DUM" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/resolveip.1 b/man/resolveip.1
index eedee2434ce..6d387d86522 100644
--- a/man/resolveip.1
+++ b/man/resolveip.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBRESOLVEIP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBRESOLVEIP\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1
index c2e071fd429..4bf5d339a69 100644
--- a/man/wsrep_sst_common.1
+++ b/man/wsrep_sst_common.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_COMMON\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBWSREP_SST_COMMON\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1
index 0c15ddb82fe..e6514a1cf9c 100644
--- a/man/wsrep_sst_mariabackup.1
+++ b/man/wsrep_sst_mariabackup.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_MARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBWSREP_SST_MARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1
index 2ea657cbc2f..4dbb1887918 100644
--- a/man/wsrep_sst_mysqldump.1
+++ b/man/wsrep_sst_mysqldump.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBWSREP_SST_MYSQLDUMP\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1
index 709885aa399..6f31e47fbd2 100644
--- a/man/wsrep_sst_rsync.1
+++ b/man/wsrep_sst_rsync.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_RSYNC\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBWSREP_SST_RSYNC\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1
index 98e93a77b65..03e2bdfb550 100644
--- a/man/wsrep_sst_rsync_wan.1
+++ b/man/wsrep_sst_rsync_wan.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBWSREP_SST_RSYNC_WAN\FR" "1" "15 May 2020" "MariaDB 10\&.8" "MariaDB Database System"
+.TH "\FBWSREP_SST_RSYNC_WAN\FR" "1" "15 May 2020" "MariaDB 10\&.9" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl
index 679529d9abe..db3ce429bac 100755
--- a/mysql-test/dgcov.pl
+++ b/mysql-test/dgcov.pl
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1335 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
# Run gcov and report test coverage on only those code lines touched by
# a given list of commits.
diff --git a/mysql-test/include/analyze-format.inc b/mysql-test/include/analyze-format.inc
index 330be82ef96..4b24f3cc6f4 100644
--- a/mysql-test/include/analyze-format.inc
+++ b/mysql-test/include/analyze-format.inc
@@ -1,3 +1,3 @@
# The time on ANALYSE FORMAT=JSON is rather variable
---replace_regex /("(r_[a-z_]*_time_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/
+--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size)": )[^, \n]*/\1"REPLACED"/
diff --git a/mysql-test/include/galera_variables_ok.inc b/mysql-test/include/galera_variables_ok.inc
index 82c5174bc14..c9a54724c17 100644
--- a/mysql-test/include/galera_variables_ok.inc
+++ b/mysql-test/include/galera_variables_ok.inc
@@ -1,6 +1,6 @@
--disable_query_log
---let $galera_variables_ok = `SELECT COUNT(*) = 49 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep%'`
+--let $galera_variables_ok = `SELECT COUNT(*) = 50 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep%'`
--if (!$galera_variables_ok) {
--skip Galera number of variables has changed!
diff --git a/mysql-test/include/galera_variables_ok_debug.inc b/mysql-test/include/galera_variables_ok_debug.inc
index c9a54724c17..e420b3af6c3 100644
--- a/mysql-test/include/galera_variables_ok_debug.inc
+++ b/mysql-test/include/galera_variables_ok_debug.inc
@@ -1,6 +1,6 @@
--disable_query_log
---let $galera_variables_ok = `SELECT COUNT(*) = 50 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep%'`
+--let $galera_variables_ok = `SELECT COUNT(*) = 51 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep%'`
--if (!$galera_variables_ok) {
--skip Galera number of variables has changed!
diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result
index cebfba188c7..0aca1ffa744 100644
--- a/mysql-test/main/cast.result
+++ b/mysql-test/main/cast.result
@@ -390,13 +390,13 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column
select cast(1 as decimal(5,6));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
select cast(1 as double(66,6));
-ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
+ERROR 42000: Too big precision specified for '1'. Maximum is 65
select cast(1 as decimal(66,6));
-ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
+ERROR 42000: Too big precision specified for '1'. Maximum is 65
select cast(1 as decimal(64,63));
-ERROR 42000: Too big scale 63 specified for '1'. Maximum is 38
+ERROR 42000: Too big scale specified for '1'. Maximum is 38
select cast(1 as double(64,63));
-ERROR 42000: Too big scale 63 specified for '1'. Maximum is 38
+ERROR 42000: Too big scale specified for '1'. Maximum is 38
set names binary;
select cast(_latin1'test' as char character set latin2);
cast(_latin1'test' as char character set latin2)
diff --git a/mysql-test/main/ctype_collate_column.result b/mysql-test/main/ctype_collate_column.result
new file mode 100644
index 00000000000..e109d4afb1a
--- /dev/null
+++ b/mysql-test/main/ctype_collate_column.result
@@ -0,0 +1,11816 @@
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-27853 Wrong data type on column `COLLATE DEFAULT` and table `COLLATE some_non_default_collation`
+#
+CREATE TABLE t1 (
+a CHAR(10) COLLATE DEFAULT
+) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
+DROP TABLE t1;
+#
+# MDEV-28067 Multiple conflicting column COLLATE clauses are not rejected
+#
+CREATE TABLE t1 (a CHAR(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin);
+ERROR HY000: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin);
+ERROR HY000: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+CREATE TABLE t1 (a CHAR(10) BINARY NOT NULL COLLATE latin1_swedish_ci);
+ERROR HY000: Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(10) BINARY NOT NULL COLLATE latin1_bin);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
+# MDEV-27743 Remove Lex::charset
+#
+CREATE TABLE cs (cs VARCHAR(64) NOT NULL);
+INSERT INTO cs (cs) VALUES
+(''),
+('CHARACTER SET latin1'),
+('CHARACTER SET utf8mb4');
+CREATE TABLE cl0 (cl0 VARCHAR(64) NOT NULL);
+INSERT INTO cl0 (cl0) VALUES
+(''),
+('BINARY'),
+('COLLATE DEFAULT'),
+('COLLATE latin1_bin'),
+('COLLATE latin1_swedish_ci'),
+('COLLATE utf8mb4_bin'),
+('COLLATE utf8mb4_general_ci');
+CREATE TABLE cl1 (cl1 VARCHAR(64) NOT NULL);
+INSERT INTO cl1 (cl1) VALUES
+(''),
+('COLLATE DEFAULT'),
+('COLLATE latin1_bin'),
+('COLLATE latin1_swedish_ci'),
+('COLLATE utf8mb4_bin'),
+('COLLATE utf8mb4_general_ci');
+CREATE TABLE tcs (tcs VARCHAR(64) NOT NULL);
+INSERT INTO tcs (tcs) VALUES
+(''),
+('CHARACTER SET latin1'),
+('CHARACTER SET latin1 COLLATE latin1_bin'),
+('CHARACTER SET utf8mb4'),
+('CHARACTER SET utf8mb4 COLLATE utf8mb4_bin');
+CREATE FUNCTION is_collate_clause_with_explicit_default_collation(cl VARCHAR(64))
+RETURNS BOOLEAN
+RETURN cl IN
+('COLLATE latin1_swedish_ci',
+'COLLATE utf8mb4_general_ci'
+ );
+CREATE FUNCTION is_collate_clause_with_explicit_collation(cl VARCHAR(64))
+RETURNS BOOLEAN
+RETURN cl IN
+('COLLATE latin1_swedish_ci',
+'COLLATE latin1_bin',
+'COLLATE utf8mb4_general_ci',
+'COLLATE utf8mb4_bin'
+ );
+CREATE FUNCTION is_conflicting_collate_explicit2(result TEXT,
+a VARCHAR(64),
+b VARCHAR(64))
+RETURNS BOOLEAN
+RETURN a<>b
+AND is_collate_clause_with_explicit_collation(a)
+AND is_collate_clause_with_explicit_collation(b)
+AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+CREATE FUNCTION is_conflicting_collate_default_collate_explicit(result TEXT,
+b VARCHAR(64))
+RETURNS BOOLEAN
+RETURN is_collate_clause_with_explicit_collation(b)
+AND NOT is_collate_clause_with_explicit_default_collation(b)
+AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+CREATE FUNCTION
+is_conflicting_charset_explicit_collate_explicit(result TEXT,
+cs_clause VARCHAR(64),
+cl_clause VARCHAR(64))
+RETURNS BOOLEAN
+RETURN cs_clause LIKE 'CHARACTER SET%'
+ AND is_collate_clause_with_explicit_collation(cl_clause)
+AND REGEXP_SUBSTR(cs_clause,'[0-9a-z_]*$') <>
+REGEXP_SUBSTR(cl_clause,'(?<=COLLATE )[0-9a-z_]*')
+AND result LIKE 'ERROR%42000%COLLATION%is not valid for CHARACTER SET%';
+CREATE FUNCTION collate_cs_default_collation(cs_name VARCHAR(64))
+RETURNS VARCHAR(64)
+RETURN
+(SELECT CONCAT('COLLATE ',COLLATION_NAME)
+FROM INFORMATION_SCHEMA.COLLATIONS
+WHERE IS_DEFAULT='Yes' AND CHARACTER_SET_NAME = cs_name);
+CREATE TABLE results
+(
+dt VARCHAR(64),
+cs VARCHAR(64),
+cl0 VARCHAR(64),
+cl1 VARCHAR(64),
+cl2 VARCHAR(64),
+tcs VARCHAR(64),
+query VARCHAR(1024),
+result VARCHAR(1024),
+cs_name VARCHAR(64) GENERATED ALWAYS AS
+(CASE WHEN cs LIKE 'CHARACTER SET%' THEN REGEXP_SUBSTR(cs,'[0-9a-z_]*$')
+ELSE NULL
+END
+),
+collate_cs_bin VARCHAR(64) GENERATED ALWAYS AS
+(
+CONCAT('COLLATE ', cs_name, '_bin')
+),
+tcs_character_set_name VARCHAR(64) GENERATED ALWAYS AS
+(CASE WHEN tcs LIKE 'CHARACTER SET%' THEN REGEXP_SUBSTR(tcs,'(?<=CHARACTER SET )[0-9a-z]*')
+ELSE NULL
+END
+)
+);
+CREATE PROCEDURE p1(dt TEXT, cs TEXT, cl0 TEXT, cl1 TEXT, cl2 TEXT, tcs TEXT)
+BEGIN
+DECLARE errstate TEXT DEFAULT NULL;
+DECLARE errno INT DEFAULT NULL;
+DECLARE errmsg TEXT DEFAULT NULL;
+DECLARE query TEXT;
+DECLARE result TEXT;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+BEGIN
+GET DIAGNOSTICS CONDITION 1 errstate = RETURNED_SQLSTATE,
+errno = MYSQL_ERRNO, errmsg = MESSAGE_TEXT;
+END;
+SET query= CONCAT('CREATE TABLE t1 (a ', dt, ' ', cs, ' ', cl0,
+' NOT NULL ',cl1,
+' DEFAULT '''' ', cl2,
+') ', tcs, ' ENGINE=Memory');
+EXECUTE IMMEDIATE query;
+IF errmsg IS NOT NULL
+THEN
+SET result=CONCAT('ERROR: ',
+COALESCE(errstate,'<NULL>'), ' ',
+COALESCE(errno,'<NULL>'), ' ',
+COALESCE(errmsg,'<NULL>'));
+INSERT INTO results (dt,cs,cl0,cl1,cl2,tcs,query,result)
+VALUES (dt,cs,cl0,cl1,cl2,tcs,query,result);
+ELSE
+FOR row IN (SELECT CONCAT(COLUMN_TYPE,
+' CHARACTER SET ', CHARACTER_SET_NAME,
+' COLLATE ', COLLATION_NAME) AS result
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1')
+DO
+INSERT INTO results (dt,cs,cl0,cl1,cl2,tcs,query,result)
+VALUES (dt,cs,cl0,cl1,cl2,tcs,query,row.result);
+END FOR;
+DROP TABLE t1;
+END IF;
+END;
+$$
+CREATE PROCEDURE p3(dt TEXT)
+BEGIN
+FOR row IN (
+SELECT cs, cl0, cl1.cl1 AS cl1, cl2.cl1 AS cl2, tcs
+FROM cs, cl0, cl1, cl1 AS cl2, tcs
+ORDER BY cs, cl0, cl1, cl2, tcs
+)
+DO
+CALL p1(dt, row.cs, row.cl0, row.cl1, row.cl2, row.tcs);
+END FOR;
+END;
+$$
+CALL p3('char(10)');
+SELECT query, result, '' AS `` FROM results
+ORDER BY dt, cs, cl0, cl1, cl2, tcs;
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'BINARY' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET latin1 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'latin1'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 BINARY NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE DEFAULT NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1253 COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin E...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bi...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE la...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE u...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_b...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Me...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE l...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=M...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE ...' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE latin1_swedish_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_bin DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE utf8mb4_general_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: 42000 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory' at line 1
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE latin1_swedish_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_bin) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result ERROR: HY000 1302 Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET latin1 COLLATE latin1_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE TABLE t1 (a char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COLLATE utf8mb4_general_ci DEFAULT '' COLLATE utf8mb4_general_ci) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE=Memory
+result char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p3;
+DROP TABLE cs, cl0, cl1, tcs;
+DELETE FROM results
+WHERE is_conflicting_charset_explicit_collate_explicit(result, cs, cl0);
+SELECT ROW_COUNT();
+ROW_COUNT()
+720
+DELETE FROM results
+WHERE cl0=''
+ AND cl2=''
+ AND is_conflicting_charset_explicit_collate_explicit(result, cs, cl1);
+SELECT ROW_COUNT();
+ROW_COUNT()
+20
+DELETE FROM results
+WHERE cl0=''
+ AND (cl1='' OR cl1=cl2)
+AND is_conflicting_charset_explicit_collate_explicit(result, cs, cl2);
+SELECT ROW_COUNT();
+ROW_COUNT()
+40
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%'
+ AND cl0='COLLATE DEFAULT'
+ AND cl2=''
+ AND is_conflicting_collate_explicit2(result, collate_cs_default_collation(cs_name), cl1);
+SELECT ROW_COUNT();
+ROW_COUNT()
+30
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%'
+ AND cl0='COLLATE DEFAULT'
+ AND (cl1=''||cl2=cl1)
+AND is_conflicting_collate_explicit2(result, collate_cs_default_collation(cs_name), cl2);
+SELECT ROW_COUNT();
+ROW_COUNT()
+60
+DELETE FROM results
+WHERE (cl1='COLLATE DEFAULT' OR cl2='COLLATE DEFAULT')
+AND result LIKE 'ERROR%42000%syntax%near%DEFAULT%';
+SELECT ROW_COUNT();
+ROW_COUNT()
+935
+DELETE FROM results WHERE is_conflicting_collate_explicit2(result, cl1, cl2);
+SELECT ROW_COUNT();
+ROW_COUNT()
+1020
+DELETE FROM results
+WHERE cl2='' AND is_conflicting_collate_explicit2(result, cl0, cl1);
+SELECT ROW_COUNT();
+ROW_COUNT()
+120
+DELETE FROM results
+WHERE (cl1='' OR cl1=cl2) AND is_conflicting_collate_explicit2(result, cl0, cl2);
+SELECT ROW_COUNT();
+ROW_COUNT()
+240
+DELETE FROM results
+WHERE cs='' AND cl0='COLLATE DEFAULT'
+ AND
+((cl1='' AND is_conflicting_collate_default_collate_explicit(result, cl2)) OR
+(cl2='' AND is_conflicting_collate_default_collate_explicit(result, cl1)) OR
+(cl2=cl1 AND is_conflicting_collate_default_collate_explicit(result, cl1)));
+SELECT ROW_COUNT();
+ROW_COUNT()
+30
+DELETE FROM results
+WHERE cl0 LIKE 'BINARY' AND
+((cl1='' AND cl2 NOT LIKE '%_bin' AND is_collate_clause_with_explicit_collation(cl2)) OR
+(cl2='' AND cl1 NOT LIKE '%_bin' AND is_collate_clause_with_explicit_collation(cl1)) OR
+(cl1=cl2 AND cl1 NOT LIKE '%_bin' AND is_collate_clause_with_explicit_collation(cl1)))
+AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+SELECT ROW_COUNT();
+ROW_COUNT()
+90
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0='BINARY'
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+AND cl2 NOT LIKE CONCAT(cs_name, '%')
+AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+SELECT ROW_COUNT();
+ROW_COUNT()
+10
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0='BINARY'
+ AND (cl2='' || cl2=cl1)
+AND is_collate_clause_with_explicit_collation(cl1)
+AND cl1 NOT LIKE CONCAT(cs_name, '%')
+AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+SELECT ROW_COUNT();
+ROW_COUNT()
+20
+DELETE FROM results
+WHERE cs='' AND cl0 IN ('','COLLATE DEFAULT')
+AND cl1='' AND cl2='' AND tcs=''
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE
+(SELECT CONCAT('CHARACTER SET ', DEFAULT_CHARACTER_SET_NAME, ' ',
+'COLLATE ', DEFAULT_COLLATION_NAME)
+FROM INFORMATION_SCHEMA.SCHEMATA
+WHERE SCHEMA_NAME=database()
+);
+SELECT ROW_COUNT();
+ROW_COUNT()
+2
+DELETE FROM results
+WHERE cs='' AND cl0='BINARY' AND cl1='' AND cl2='' AND tcs=''
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE
+(SELECT CONCAT('CHARACTER SET ', DEFAULT_CHARACTER_SET_NAME, ' ',
+'COLLATE ', DEFAULT_CHARACTER_SET_NAME, '_bin')
+FROM INFORMATION_SCHEMA.SCHEMATA
+WHERE SCHEMA_NAME=database()
+);
+SELECT ROW_COUNT();
+ROW_COUNT()
+1
+DELETE FROM results
+WHERE cs=''
+ AND cl0=''
+ AND cl1=''
+ AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%'
+ AND tcs NOT LIKE '%COLLATE%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE tcs
+AND result RLIKE collate_cs_default_collation(tcs_character_set_name);
+SELECT ROW_COUNT();
+ROW_COUNT()
+2
+DELETE FROM results
+WHERE cs='' AND cl0='' AND cl1='' AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%COLLATE%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE tcs;
+SELECT ROW_COUNT();
+ROW_COUNT()
+2
+DELETE FROM results
+WHERE cs=''
+ AND cl0='COLLATE DEFAULT'
+ AND cl1=''
+ AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE collate_cs_default_collation(tcs_character_set_name);
+SELECT ROW_COUNT();
+ROW_COUNT()
+4
+DELETE FROM results
+WHERE cs=''
+ AND cl0='BINARY'
+ AND cl1=''
+ AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE CONCAT('COLLATE ', tcs_character_set_name, '_bin');
+SELECT ROW_COUNT();
+ROW_COUNT()
+4
+DELETE FROM results
+WHERE cs='' AND is_collate_clause_with_explicit_collation(cl0)
+AND (cl1='' OR cl1=cl0)
+AND (cl2='' OR cl2=cl0)
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl0;
+SELECT ROW_COUNT();
+ROW_COUNT()
+80
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET %'
+ AND cl0 IN ('','COLLATE DEFAULT',collate_cs_default_collation(cs_name))
+AND cl1 IN ('',collate_cs_default_collation(cs_name))
+AND cl2 IN ('',collate_cs_default_collation(cs_name))
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE collate_cs_default_collation(cs_name);
+SELECT ROW_COUNT();
+ROW_COUNT()
+120
+DELETE FROM results
+WHERE cs=''
+ AND cl0='COLLATE DEFAULT'
+ AND is_collate_clause_with_explicit_default_collation(cl1)
+AND cl2=''
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+ROW_COUNT()
+10
+DELETE FROM results
+WHERE cs=''
+ AND cl0='COLLATE DEFAULT'
+ AND is_collate_clause_with_explicit_default_collation(cl2)
+AND (cl1='' OR cl2=cl1)
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+ROW_COUNT()
+20
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET %'
+ AND (cl0='BINARY' OR cl0=collate_cs_bin)
+AND (cl1='' OR cl1=collate_cs_bin)
+AND (cl2='' OR cl2=collate_cs_bin)
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE collate_cs_bin;
+SELECT ROW_COUNT();
+ROW_COUNT()
+80
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0=''
+ AND (cl2='' OR cl2=cl1)
+AND is_collate_clause_with_explicit_collation(cl1)
+AND cl1 RLIKE CONCAT('COLLATE ',cs_name,'_')
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+ROW_COUNT()
+20
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0=''
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+AND cl2 RLIKE CONCAT('COLLATE ',cs_name,'_')
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+ROW_COUNT()
+10
+DELETE FROM results
+WHERE cs='' AND cl0='BINARY'
+ AND (cl2='' OR cl2=cl1)
+AND is_collate_clause_with_explicit_collation(cl1)
+AND cl1 RLIKE '_bin$'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+ROW_COUNT()
+20
+DELETE FROM results
+WHERE cs='' AND cl0='BINARY'
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+AND cl2 RLIKE '_bin$'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+ROW_COUNT()
+10
+DELETE FROM results
+WHERE cs='' AND cl0=''
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+ROW_COUNT()
+20
+DELETE FROM results
+WHERE cs='' AND cl0=''
+ AND (cl2='' OR cl2=cl1)
+AND is_collate_clause_with_explicit_collation(cl1)
+AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+ROW_COUNT()
+40
+# Expect empty set
+SELECT *, '---' AS `---` FROM results WHERE result LIKE 'ERROR%';
+# Expect empty set
+SELECT *, '---' AS `---` FROM results WHERE result NOT LIKE 'ERROR%';
+DROP TABLE results;
+DROP FUNCTION is_collate_clause_with_explicit_default_collation;
+DROP FUNCTION is_collate_clause_with_explicit_collation;
+DROP FUNCTION is_conflicting_charset_explicit_collate_explicit;
+DROP FUNCTION is_conflicting_collate_explicit2;
+DROP FUNCTION is_conflicting_collate_default_collate_explicit;
+DROP FUNCTION collate_cs_default_collation;
+#
+# End of 10.9 tests
+#
diff --git a/mysql-test/main/ctype_collate_column.test b/mysql-test/main/ctype_collate_column.test
new file mode 100644
index 00000000000..3120505ef6a
--- /dev/null
+++ b/mysql-test/main/ctype_collate_column.test
@@ -0,0 +1,627 @@
+--source include/have_utf8mb4.inc
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-27853 Wrong data type on column `COLLATE DEFAULT` and table `COLLATE some_non_default_collation`
+--echo #
+
+CREATE TABLE t1 (
+ a CHAR(10) COLLATE DEFAULT
+) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-28067 Multiple conflicting column COLLATE clauses are not rejected
+--echo #
+
+--error ER_CONFLICTING_DECLARATIONS
+CREATE TABLE t1 (a CHAR(10) COLLATE latin1_swedish_ci NOT NULL COLLATE latin1_bin);
+
+--error ER_CONFLICTING_DECLARATIONS
+CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT NOT NULL COLLATE latin1_bin);
+
+--error ER_CONFLICTING_DECLARATIONS
+CREATE TABLE t1 (a CHAR(10) BINARY NOT NULL COLLATE latin1_swedish_ci);
+
+CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT NOT NULL COLLATE latin1_swedish_ci);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR(10) BINARY NOT NULL COLLATE latin1_bin);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-27743 Remove Lex::charset
+--echo #
+
+# Iterate through all possible combinations of this grammar:
+#
+# CREATE TABLE t1 (
+# a CHAR(10) [ CHARACTER SET cs ] [ COLLATE cl0 | BINARY ]
+# NOT NULL [COLLATE cl1]
+# DEFAULT '' [COLLATE cl2]
+# ) [CHARACTER SET tcs [COLLATE tcl]];
+#
+# and check that:
+# - either the column gets the expected character set and collation
+# - or the expected error is returned
+
+
+CREATE TABLE cs (cs VARCHAR(64) NOT NULL);
+INSERT INTO cs (cs) VALUES
+(''),
+('CHARACTER SET latin1'),
+('CHARACTER SET utf8mb4');
+
+CREATE TABLE cl0 (cl0 VARCHAR(64) NOT NULL);
+INSERT INTO cl0 (cl0) VALUES
+(''),
+('BINARY'),
+('COLLATE DEFAULT'),
+('COLLATE latin1_bin'),
+('COLLATE latin1_swedish_ci'),
+('COLLATE utf8mb4_bin'),
+('COLLATE utf8mb4_general_ci');
+
+CREATE TABLE cl1 (cl1 VARCHAR(64) NOT NULL);
+INSERT INTO cl1 (cl1) VALUES
+(''),
+('COLLATE DEFAULT'),
+('COLLATE latin1_bin'),
+('COLLATE latin1_swedish_ci'),
+('COLLATE utf8mb4_bin'),
+('COLLATE utf8mb4_general_ci');
+
+CREATE TABLE tcs (tcs VARCHAR(64) NOT NULL);
+INSERT INTO tcs (tcs) VALUES
+(''),
+('CHARACTER SET latin1'),
+('CHARACTER SET latin1 COLLATE latin1_bin'),
+('CHARACTER SET utf8mb4'),
+('CHARACTER SET utf8mb4 COLLATE utf8mb4_bin');
+
+
+CREATE FUNCTION is_collate_clause_with_explicit_default_collation(cl VARCHAR(64))
+ RETURNS BOOLEAN
+ RETURN cl IN
+ ('COLLATE latin1_swedish_ci',
+ 'COLLATE utf8mb4_general_ci'
+ );
+
+CREATE FUNCTION is_collate_clause_with_explicit_collation(cl VARCHAR(64))
+ RETURNS BOOLEAN
+ RETURN cl IN
+ ('COLLATE latin1_swedish_ci',
+ 'COLLATE latin1_bin',
+ 'COLLATE utf8mb4_general_ci',
+ 'COLLATE utf8mb4_bin'
+ );
+
+
+CREATE FUNCTION is_conflicting_collate_explicit2(result TEXT,
+ a VARCHAR(64),
+ b VARCHAR(64))
+ RETURNS BOOLEAN
+ RETURN a<>b
+ AND is_collate_clause_with_explicit_collation(a)
+ AND is_collate_clause_with_explicit_collation(b)
+ AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+
+CREATE FUNCTION is_conflicting_collate_default_collate_explicit(result TEXT,
+ b VARCHAR(64))
+ RETURNS BOOLEAN
+ RETURN is_collate_clause_with_explicit_collation(b)
+ AND NOT is_collate_clause_with_explicit_default_collation(b)
+ AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+
+
+CREATE FUNCTION
+ is_conflicting_charset_explicit_collate_explicit(result TEXT,
+ cs_clause VARCHAR(64),
+ cl_clause VARCHAR(64))
+ RETURNS BOOLEAN
+ RETURN cs_clause LIKE 'CHARACTER SET%'
+ AND is_collate_clause_with_explicit_collation(cl_clause)
+ AND REGEXP_SUBSTR(cs_clause,'[0-9a-z_]*$') <>
+ REGEXP_SUBSTR(cl_clause,'(?<=COLLATE )[0-9a-z_]*')
+ AND result LIKE 'ERROR%42000%COLLATION%is not valid for CHARACTER SET%';
+
+CREATE FUNCTION collate_cs_default_collation(cs_name VARCHAR(64))
+ RETURNS VARCHAR(64)
+ RETURN
+ (SELECT CONCAT('COLLATE ',COLLATION_NAME)
+ FROM INFORMATION_SCHEMA.COLLATIONS
+ WHERE IS_DEFAULT='Yes' AND CHARACTER_SET_NAME = cs_name);
+
+CREATE TABLE results
+(
+ dt VARCHAR(64),
+ cs VARCHAR(64),
+ cl0 VARCHAR(64),
+ cl1 VARCHAR(64),
+ cl2 VARCHAR(64),
+ tcs VARCHAR(64),
+ query VARCHAR(1024),
+ result VARCHAR(1024),
+
+ cs_name VARCHAR(64) GENERATED ALWAYS AS
+ (CASE WHEN cs LIKE 'CHARACTER SET%' THEN REGEXP_SUBSTR(cs,'[0-9a-z_]*$')
+ ELSE NULL
+ END
+ ),
+
+ collate_cs_bin VARCHAR(64) GENERATED ALWAYS AS
+ (
+ CONCAT('COLLATE ', cs_name, '_bin')
+ ),
+
+ tcs_character_set_name VARCHAR(64) GENERATED ALWAYS AS
+ (CASE WHEN tcs LIKE 'CHARACTER SET%' THEN REGEXP_SUBSTR(tcs,'(?<=CHARACTER SET )[0-9a-z]*')
+ ELSE NULL
+ END
+ )
+);
+
+
+DELIMITER $$;
+CREATE PROCEDURE p1(dt TEXT, cs TEXT, cl0 TEXT, cl1 TEXT, cl2 TEXT, tcs TEXT)
+BEGIN
+ DECLARE errstate TEXT DEFAULT NULL;
+ DECLARE errno INT DEFAULT NULL;
+ DECLARE errmsg TEXT DEFAULT NULL;
+ DECLARE query TEXT;
+ DECLARE result TEXT;
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 errstate = RETURNED_SQLSTATE,
+ errno = MYSQL_ERRNO, errmsg = MESSAGE_TEXT;
+ END;
+ SET query= CONCAT('CREATE TABLE t1 (a ', dt, ' ', cs, ' ', cl0,
+ ' NOT NULL ',cl1,
+ ' DEFAULT '''' ', cl2,
+ ') ', tcs, ' ENGINE=Memory');
+ EXECUTE IMMEDIATE query;
+ IF errmsg IS NOT NULL
+ THEN
+ SET result=CONCAT('ERROR: ',
+ COALESCE(errstate,'<NULL>'), ' ',
+ COALESCE(errno,'<NULL>'), ' ',
+ COALESCE(errmsg,'<NULL>'));
+ INSERT INTO results (dt,cs,cl0,cl1,cl2,tcs,query,result)
+ VALUES (dt,cs,cl0,cl1,cl2,tcs,query,result);
+ ELSE
+ FOR row IN (SELECT CONCAT(COLUMN_TYPE,
+ ' CHARACTER SET ', CHARACTER_SET_NAME,
+ ' COLLATE ', COLLATION_NAME) AS result
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1')
+ DO
+ INSERT INTO results (dt,cs,cl0,cl1,cl2,tcs,query,result)
+ VALUES (dt,cs,cl0,cl1,cl2,tcs,query,row.result);
+ END FOR;
+ DROP TABLE t1;
+ END IF;
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE p3(dt TEXT)
+BEGIN
+ FOR row IN (
+ SELECT cs, cl0, cl1.cl1 AS cl1, cl2.cl1 AS cl2, tcs
+ FROM cs, cl0, cl1, cl1 AS cl2, tcs
+ ORDER BY cs, cl0, cl1, cl2, tcs
+ )
+ DO
+ CALL p1(dt, row.cs, row.cl0, row.cl1, row.cl2, row.tcs);
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+
+--disable_column_names
+CALL p3('char(10)');
+--enable_column_names
+
+
+--vertical_results
+SELECT query, result, '' AS `` FROM results
+ORDER BY dt, cs, cl0, cl1, cl2, tcs;
+--horizontal_results
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p3;
+
+DROP TABLE cs, cl0, cl1, tcs;
+
+
+#
+# Statements with errors
+#
+
+#
+# CHARACTER SET cs2 COLLATE cs2_xxx
+# CHARACTER SET cs1 NOT NULL COLLATE cs2_xxx DEFAULT '' [COLLATE cs2_xxx]
+# CHARACTER SET cs1 NOT NULL DEFAULT '' COLLATE cs2_xxx
+#
+
+DELETE FROM results
+WHERE is_conflicting_charset_explicit_collate_explicit(result, cs, cl0);
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cl0=''
+ AND cl2=''
+ AND is_conflicting_charset_explicit_collate_explicit(result, cs, cl1);
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cl0=''
+ AND (cl1='' OR cl1=cl2)
+ AND is_conflicting_charset_explicit_collate_explicit(result, cs, cl2);
+SELECT ROW_COUNT();
+
+
+# CHARACTER SET cs COLLATE DEFAULT
+# NOT NULL [COLLATE cs_non_default]
+# DEFAULT '' [COLLATE cs_non_default]
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%'
+ AND cl0='COLLATE DEFAULT'
+ AND cl2=''
+ AND is_conflicting_collate_explicit2(result, collate_cs_default_collation(cs_name), cl1);
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%'
+ AND cl0='COLLATE DEFAULT'
+ AND (cl1=''||cl2=cl1)
+ AND is_conflicting_collate_explicit2(result, collate_cs_default_collation(cs_name), cl2);
+SELECT ROW_COUNT();
+
+
+#
+# `COLLATE DEFAULT` is not supported in cl1 and cl2
+#
+
+DELETE FROM results
+WHERE (cl1='COLLATE DEFAULT' OR cl2='COLLATE DEFAULT')
+ AND result LIKE 'ERROR%42000%syntax%near%DEFAULT%';
+SELECT ROW_COUNT();
+
+#
+# Conflicting COLLATE with explicit collation name
+#
+
+DELETE FROM results WHERE is_conflicting_collate_explicit2(result, cl1, cl2);
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cl2='' AND is_conflicting_collate_explicit2(result, cl0, cl1);
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE (cl1='' OR cl1=cl2) AND is_conflicting_collate_explicit2(result, cl0, cl2);
+SELECT ROW_COUNT();
+
+#
+# CHAR(10) COLLATE DEFAULT .. COLLATE cs_non_default
+#
+
+DELETE FROM results
+WHERE cs='' AND cl0='COLLATE DEFAULT'
+ AND
+ ((cl1='' AND is_conflicting_collate_default_collate_explicit(result, cl2)) OR
+ (cl2='' AND is_conflicting_collate_default_collate_explicit(result, cl1)) OR
+ (cl2=cl1 AND is_conflicting_collate_default_collate_explicit(result, cl1)));
+SELECT ROW_COUNT();
+
+
+#
+# CHAR(10) BINARY .. COLLATE xxx_ci
+#
+
+DELETE FROM results
+WHERE cl0 LIKE 'BINARY' AND
+ ((cl1='' AND cl2 NOT LIKE '%_bin' AND is_collate_clause_with_explicit_collation(cl2)) OR
+ (cl2='' AND cl1 NOT LIKE '%_bin' AND is_collate_clause_with_explicit_collation(cl1)) OR
+ (cl1=cl2 AND cl1 NOT LIKE '%_bin' AND is_collate_clause_with_explicit_collation(cl1)))
+ AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+SELECT ROW_COUNT();
+
+
+
+#
+# CHAR(10) CHARACTER SET cs1 BINARY .. COLLATE cs2_..
+#
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0='BINARY'
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+ AND cl2 NOT LIKE CONCAT(cs_name, '%')
+ AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0='BINARY'
+ AND (cl2='' || cl2=cl1)
+ AND is_collate_clause_with_explicit_collation(cl1)
+ AND cl1 NOT LIKE CONCAT(cs_name, '%')
+ AND result LIKE 'ERROR%HY000%Conflicting declarations%';
+SELECT ROW_COUNT();
+
+
+#
+# Statements without errors
+# where the character set and the collation are determined from
+# the database level.
+#
+
+# CREATE TABLE t1 (a CHAR(10) [COLLATE DEFAULT] NOT NULL DEFAULT '');
+
+DELETE FROM results
+WHERE cs='' AND cl0 IN ('','COLLATE DEFAULT')
+ AND cl1='' AND cl2='' AND tcs=''
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE
+ (SELECT CONCAT('CHARACTER SET ', DEFAULT_CHARACTER_SET_NAME, ' ',
+ 'COLLATE ', DEFAULT_COLLATION_NAME)
+ FROM INFORMATION_SCHEMA.SCHEMATA
+ WHERE SCHEMA_NAME=database()
+ );
+SELECT ROW_COUNT();
+
+
+# CREATE TABLE t1 (a CHAR(10) BINARY NOT NULL DEFAULT '');
+
+DELETE FROM results
+WHERE cs='' AND cl0='BINARY' AND cl1='' AND cl2='' AND tcs=''
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE
+ (SELECT CONCAT('CHARACTER SET ', DEFAULT_CHARACTER_SET_NAME, ' ',
+ 'COLLATE ', DEFAULT_CHARACTER_SET_NAME, '_bin')
+ FROM INFORMATION_SCHEMA.SCHEMATA
+ WHERE SCHEMA_NAME=database()
+ );
+SELECT ROW_COUNT();
+
+
+#
+# Statements without errors
+# where the character set and the collation are determined from
+# the table level.
+#
+
+# CREATE TABLE t1 (a char(10) NOT NULL DEFAULT '') CHARACTER SET cs
+
+DELETE FROM results
+WHERE cs=''
+ AND cl0=''
+ AND cl1=''
+ AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%'
+ AND tcs NOT LIKE '%COLLATE%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE tcs
+ AND result RLIKE collate_cs_default_collation(tcs_character_set_name);
+SELECT ROW_COUNT();
+
+
+#
+# CREATE TABLE t1 (a CHAR(10) NOT NULL DEFAULT '') CHARACTER SET cs COLLATE cs_xxx
+#
+
+DELETE FROM results
+WHERE cs='' AND cl0='' AND cl1='' AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%COLLATE%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE tcs;
+SELECT ROW_COUNT();
+
+
+#
+# CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT) CHARACTER SET cs ..
+#
+
+DELETE FROM results
+WHERE cs=''
+ AND cl0='COLLATE DEFAULT'
+ AND cl1=''
+ AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE collate_cs_default_collation(tcs_character_set_name);
+SELECT ROW_COUNT();
+
+# CREATE TABLE t1
+# (
+# a CHAR(10) BINARY NOT NULL DEFAULT ''
+# ) CHARACTER SET cs COLLATE cs_bin;
+
+DELETE FROM results
+WHERE cs=''
+ AND cl0='BINARY'
+ AND cl1=''
+ AND cl2=''
+ AND tcs LIKE 'CHARACTER SET%'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE CONCAT('COLLATE ', tcs_character_set_name, '_bin');
+SELECT ROW_COUNT();
+
+
+
+#
+# Statements without errors
+# where the character set and the collation are determined from
+# the column level.
+#
+
+#
+# CHAR(10) COLLATE cs_xxx .. [COLLATE cs_xxx] .. [COLLATE cs_xxx]
+#
+
+DELETE FROM results
+WHERE cs='' AND is_collate_clause_with_explicit_collation(cl0)
+ AND (cl1='' OR cl1=cl0)
+ AND (cl2='' OR cl2=cl0)
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl0;
+SELECT ROW_COUNT();
+
+#
+# CHARACTER SET cs [COLLATE DEFAULT|COLLATE cs_def]
+# NOT NULL [COLLATE cs_def]
+# DEFAULT '' [COLLATE cs_def]
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET %'
+ AND cl0 IN ('','COLLATE DEFAULT',collate_cs_default_collation(cs_name))
+ AND cl1 IN ('',collate_cs_default_collation(cs_name))
+ AND cl2 IN ('',collate_cs_default_collation(cs_name))
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE collate_cs_default_collation(cs_name);
+SELECT ROW_COUNT();
+
+#
+# CHAR(10) COLLATE DEFAULT .. COLLATE cs_def .. [COLLATE cs_def]
+#
+DELETE FROM results
+WHERE cs=''
+ AND cl0='COLLATE DEFAULT'
+ AND is_collate_clause_with_explicit_default_collation(cl1)
+ AND cl2=''
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+
+#
+# CHAR(10) COLLATE DEFAULT .. COLLATE cs_def .. [COLLATE cs_def]
+#
+
+DELETE FROM results
+WHERE cs=''
+ AND cl0='COLLATE DEFAULT'
+ AND is_collate_clause_with_explicit_default_collation(cl2)
+ AND (cl1='' OR cl2=cl1)
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+
+
+#
+# CHARACTER SET cs [BINARY|COLLATE cs_bin]
+# NOT NULL [COLLATE cs_bin]
+# DEFAULT '' [COLLATE cs_bin]
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET %'
+ AND (cl0='BINARY' OR cl0=collate_cs_bin)
+ AND (cl1='' OR cl1=collate_cs_bin)
+ AND (cl2='' OR cl2=collate_cs_bin)
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE collate_cs_bin;
+SELECT ROW_COUNT();
+
+#
+# CHARACTER SET cs NOT NULL DEFAULT '' COLLATE cs_def
+# CHARACTER SET cs NOT NULL COLLATE cs_def DEFAULT '' [COLLATE cs_def]
+#
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0=''
+ AND (cl2='' OR cl2=cl1)
+ AND is_collate_clause_with_explicit_collation(cl1)
+ AND cl1 RLIKE CONCAT('COLLATE ',cs_name,'_')
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cs LIKE 'CHARACTER SET%' AND cl0=''
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+ AND cl2 RLIKE CONCAT('COLLATE ',cs_name,'_')
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+
+
+#
+# CHAR(10) BINARY NOT NULL DEFAULT '' COLLATE cs_bin
+# CHAR(10) BINARY NOT NULL COLLATE cs_bin DEFAULT '' [COLLATE cs_bin]
+#
+
+DELETE FROM results
+WHERE cs='' AND cl0='BINARY'
+ AND (cl2='' OR cl2=cl1)
+ AND is_collate_clause_with_explicit_collation(cl1)
+ AND cl1 RLIKE '_bin$'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cs='' AND cl0='BINARY'
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+ AND cl2 RLIKE '_bin$'
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+
+#
+# CHAR(10) NOT NULL DEFAULT '' COLLATE cs_xxx
+# CHAR(10) NOT NULL COLLATE cs_xxx DEFAULT '' [COLLATE cs_xxx]
+#
+
+DELETE FROM results
+WHERE cs='' AND cl0=''
+ AND cl1=''
+ AND is_collate_clause_with_explicit_collation(cl2)
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl2;
+SELECT ROW_COUNT();
+
+DELETE FROM results
+WHERE cs='' AND cl0=''
+ AND (cl2='' OR cl2=cl1)
+ AND is_collate_clause_with_explicit_collation(cl1)
+ AND result NOT LIKE 'ERROR%'
+ AND result RLIKE cl1;
+SELECT ROW_COUNT();
+
+
+
+--vertical_results
+--echo # Expect empty set
+SELECT *, '---' AS `---` FROM results WHERE result LIKE 'ERROR%';
+--echo # Expect empty set
+SELECT *, '---' AS `---` FROM results WHERE result NOT LIKE 'ERROR%';
+--horizontal_results
+
+DROP TABLE results;
+
+
+DROP FUNCTION is_collate_clause_with_explicit_default_collation;
+DROP FUNCTION is_collate_clause_with_explicit_collation;
+DROP FUNCTION is_conflicting_charset_explicit_collate_explicit;
+DROP FUNCTION is_conflicting_collate_explicit2;
+DROP FUNCTION is_conflicting_collate_default_collate_explicit;
+DROP FUNCTION collate_cs_default_collation;
+
+
+--echo #
+--echo # End of 10.9 tests
+--echo #
diff --git a/mysql-test/main/ctype_collate_context.result b/mysql-test/main/ctype_collate_context.result
new file mode 100644
index 00000000000..53eeaa4e713
--- /dev/null
+++ b/mysql-test/main/ctype_collate_context.result
@@ -0,0 +1,1960 @@
+CREATE TABLE t0 (a VARCHAR(64));
+INSERT INTO t0 VALUES
+('CHARACTER SET DEFAULT'),
+('CHARACTER SET latin1'),
+('CHARACTER SET utf8mb4'),
+('COLLATE DEFAULT'),
+('COLLATE utf8mb4_bin'),
+('COLLATE latin1_swedish_ci'),
+('COLLATE latin1_bin');
+CREATE TABLE clauses
+(
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+cl1 VARCHAR(64) NOT NULL,
+cl2 VARCHAR(64) NOT NULL,
+cl3 VARCHAR(64) NOT NULL,
+clause_count INT GENERATED ALWAYS AS ((cl1<>'') + (cl2<>'') + (cl3<>'')),
+clauses TEXT GENERATED ALWAYS AS (CONCAT(cl1,
+IF(cl2='','',' '), cl2,
+IF(cl3='','',' '), cl3))
+);
+INSERT INTO clauses (cl1, cl2, cl3)
+SELECT '' AS cl1, '' AS cl2, '' AS cl3;
+INSERT INTO clauses (cl1, cl2, cl3)
+SELECT t0.a AS cl1, '' AS cl2, '' AS cl3
+FROM t0;
+INSERT INTO clauses (cl1, cl2, cl3)
+SELECT t0.a AS cl1, t2.a AS cl2, '' AS cl3
+FROM t0 t0, t0 t2;
+INSERT INTO clauses (cl1, cl2, cl3)
+SELECT t0.a AS cl1, t2.a AS cl2, t3.a AS cl3
+FROM t0 t0, t0 t2, t0 t3;
+DROP TABLE t0;
+CREATE TABLE results_template
+(
+id INT NOT NULL PRIMARY KEY,
+result TEXT NOT NULL
+);
+CREATE PROCEDURE diff_result_tables_stat(table1 VARCHAR(64),
+table2 VARCHAR(64),
+cond VARCHAR(128))
+BEGIN
+DECLARE query_counts TEXT DEFAULT
+'SELECT '
+ ' COUNT(*),'
+ ' SUM(t1.result=t2.result),'
+ ' SUM(t1.result<>t2.result) '
+ 'FROM table1 t1 JOIN table2 t2 USING (id)/*$(WHERE)*/';
+SET query_counts=REPLACE(query_counts, 'table1', table1);
+SET query_counts=REPLACE(query_counts, 'table2', table2);
+IF (cond<>'')
+THEN
+SET query_counts=REPLACE(query_counts, '/*$(WHERE)*/', CONCAT('WHERE ',cond));
+END IF;
+EXECUTE IMMEDIATE query_counts;
+END;
+$$
+CREATE PROCEDURE diff_result_tables_records(table1 VARCHAR(64),
+table2 VARCHAR(64),
+cond VARCHAR(128))
+BEGIN
+DECLARE query_records TEXT DEFAULT
+'SELECT '
+ ' '''' AS ``,'
+ ' clauses.clauses AS attrs,'
+ ' t1.result AS `aaa`,'
+ ' t2.result AS `bbb` '
+ ' FROM table1 t1'
+ ' JOIN table2 t2 USING (id)'
+ ' JOIN clauses USING (id) '
+ ' WHERE t1.result<>t2.result /*$(COND)*/ ORDER BY t1.id';
+SET query_records=REPLACE(query_records, 'table1', table1);
+SET query_records=REPLACE(query_records, 'table2', table2);
+IF (cond<>'')
+THEN
+SET query_records=REPLACE(query_records, '/*$(COND)*/', CONCAT('AND ',cond));
+END IF;
+EXECUTE IMMEDIATE query_records;
+END;
+$$
+CREATE PROCEDURE diff_result_tables(table1 VARCHAR(64),
+table2 VARCHAR(64),
+cond VARCHAR(128))
+BEGIN
+CALL diff_result_tables_stat(table1, table2, cond);
+CALL diff_result_tables_records(table1, table2, cond);
+END;
+$$
+CREATE PROCEDURE exec(query_bootstrap TEXT,
+query_pattern TEXT,
+query_cleanup TEXT,
+id INT,
+clauses TEXT)
+BEGIN
+DECLARE query TEXT DEFAULT REPLACE(query_pattern, '/*CSCL*/',clauses);
+DECLARE result TEXT DEFAULT NULL;
+DECLARE CONTINUE HANDLER FOR
+1064, /*ER_PARSE_ERROR*/
+1302, /*ER_CONFLICTING_DECLARATIONS*/
+1253 /*ER_COLLATION_CHARSET_MISMATCH*/
+BEGIN
+GET DIAGNOSTICS CONDITION 1 result=MESSAGE_TEXT;
+SET result=CONCAT('ERROR: ', result);
+END;
+IF query_bootstrap<>''
+ THEN
+EXECUTE IMMEDIATE query_bootstrap;
+END IF;
+EXECUTE IMMEDIATE query;
+IF result IS NULL
+THEN
+IF query_pattern LIKE '%DATABASE%'
+ THEN
+SET result=(SELECT CONCAT('CHARACTER SET ', DEFAULT_CHARACTER_SET_NAME,
+' COLLATE ', DEFAULT_COLLATION_NAME)
+FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1');
+ELSE
+SET result=(SELECT CONCAT('CHARACTER SET ', SUBSTRING_INDEX(TABLE_COLLATION,'_',1),
+' COLLATE ', TABLE_COLLATION)
+FROM INFORMATION_SCHEMA.TABLES
+WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test1');
+END IF;
+END IF;
+INSERT INTO results (id, result) VALUES (id, result);
+IF query_cleanup<>''
+ THEN
+EXECUTE IMMEDIATE query_cleanup;
+END IF;
+END;
+$$
+CREATE PROCEDURE show_results(query TEXT, clause_count_arg INT)
+BEGIN
+SELECT '' AS ``, CONCAT(clause_count_arg, ' clauses') AS `TEST:`;
+SELECT '' AS ``, COUNT(*) AS `TOTAL`
+ FROM results JOIN clauses USING (id)
+WHERE clauses.clause_count=clause_count_arg;
+-- Display erroneous results
+SELECT '' AS ``, COUNT(*) AS `ERROR`
+ FROM results JOIN clauses USING (id)
+WHERE clauses.clause_count=clause_count_arg
+AND result RLIKE '^ERROR';
+SELECT '' AS ``, query, clauses AS attrs, result
+FROM results JOIN clauses USING (id)
+WHERE clauses.clause_count=clause_count_arg
+AND result RLIKE '^ERROR' ORDER BY id;
+-- Display successfull results
+SELECT '' AS ``, COUNT(*) AS `OK`
+ FROM results JOIN clauses USING (id)
+WHERE clauses.clause_count=clause_count_arg
+AND result NOT RLIKE '^ERROR';
+SELECT '' AS ``, query, clauses AS attrs, result
+FROM results JOIN clauses USING (id)
+WHERE clauses.clause_count=clause_count_arg
+AND result NOT RLIKE '^ERROR' ORDER BY id;
+END;
+$$
+CREATE PROCEDURE run(query_bootstrap TEXT,
+query TEXT,
+query_cleanup TEXT,
+clause_count_arg INT)
+BEGIN
+FOR rec IN (SELECT * FROM clauses WHERE clause_count=clause_count_arg)
+DO
+CALL exec(query_bootstrap, query, query_cleanup, rec.id, rec.clauses);
+END FOR;
+END;
+$$
+CREATE PROCEDURE run_all(query_bootstrap TEXT, query TEXT, query_cleanup TEXT)
+BEGIN
+DECLARE msg TEXT;
+DECLARE count_results INT;
+DECLARE count_clauses INT;
+FOR i IN 0..3
+DO
+CALL run(query_bootstrap, query, query_cleanup, i);
+END FOR;
+SET count_clauses=(SELECT COUNT(*) FROM clauses);
+SET count_results=(SELECT COUNT(*) FROM results);
+IF (count_results<>count_clauses)
+THEN
+SET msg=CONCAT('Got ', count_results,' rows in `results`; ',
+'Expected ', count_clauses, ' rows');
+SIGNAL SQLSTATE '45000'
+ SET MYSQL_ERRNO=30001,
+MESSAGE_TEXT=msg;
+END IF;
+END;
+$$
+CREATE PROCEDURE show_results_all(query TEXT)
+BEGIN
+FOR i IN 0..3
+DO
+CALL show_results(query, i);
+END FOR;
+END;
+$$
+#
+# Running CREATE DATABASE tests
+# Displaying all results
+#
+SET @@collation_server=utf8mb4_unicode_ci;
+CREATE TABLE results LIKE results_template;
+CALL run_all('','CREATE DATABASE db1 /*CSCL*/', 'DROP DATABASE IF EXISTS db1');
+CALL show_results_all('CREATE DATABASE');
+
+TEST: 0 clauses
+
+TOTAL 1
+
+ERROR 0
+
+OK 1
+
+query CREATE DATABASE
+attrs
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
+
+TEST: 1 clauses
+
+TOTAL 7
+
+ERROR 0
+
+OK 7
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+TEST: 2 clauses
+
+TOTAL 49
+
+ERROR 24
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+OK 25
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+TEST: 3 clauses
+
+TOTAL 343
+
+ERROR 264
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin CHARACTER SET DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 CHARACTER SET latin1
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 CHARACTER SET latin1
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci CHARACTER SET latin1
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin CHARACTER SET latin1
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin CHARACTER SET latin1
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin CHARACTER SET utf8mb4
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT COLLATE DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 COLLATE DEFAULT
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 COLLATE DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 COLLATE DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci COLLATE DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci COLLATE DEFAULT
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin COLLATE DEFAULT
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin COLLATE utf8mb4_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin COLLATE latin1_swedish_ci
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET DEFAULT COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET latin1 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET latin1 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'CHARACTER SET utf8mb4' and 'CHARACTER SET latin1'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET latin1 COLLATE latin1_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET utf8mb4 COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_general_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE DEFAULT COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE DEFAULT'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'latin1'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE utf8mb4_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE utf8mb4_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_swedish_ci COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_bin' and 'COLLATE latin1_swedish_ci'
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE latin1_bin COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE latin1_bin COLLATE latin1_bin
+result ERROR: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE DEFAULT' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE latin1_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE utf8mb4_bin' and 'COLLATE latin1_bin'
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_bin COLLATE latin1_bin
+result ERROR: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+
+OK 79
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin CHARACTER SET DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin CHARACTER SET latin1
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin CHARACTER SET utf8mb4
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET utf8mb4 COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT COLLATE DEFAULT
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci COLLATE DEFAULT
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET DEFAULT COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET DEFAULT COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs COLLATE utf8mb4_bin COLLATE utf8mb4_bin COLLATE utf8mb4_bin
+result CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci CHARACTER SET latin1 COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE DEFAULT COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE DEFAULT COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE DEFAULT COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE DEFAULT COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci COLLATE latin1_swedish_ci
+result CHARACTER SET latin1 COLLATE latin1_swedish_ci
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 CHARACTER SET latin1 COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin CHARACTER SET latin1 COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs CHARACTER SET latin1 COLLATE latin1_bin COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+
+query CREATE DATABASE
+attrs COLLATE latin1_bin COLLATE latin1_bin COLLATE latin1_bin
+result CHARACTER SET latin1 COLLATE latin1_bin
+ALTER TABLE results RENAME TO results_create_db;
+#
+# Running ALTER DATABASE tests
+#
+CREATE TABLE results LIKE results_template;
+CALL run_all('CREATE DATABASE db1 CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci',
+'ALTER DATABASE db1 COMMENT '''' /*CSCL*/',
+'DROP DATABASE db1');
+ALTER TABLE results RENAME TO results_alter_db;
+# Displaying results that differ in CREATE DATABASE and ALTER DATABASE
+# Only queries with no clauses or with COLLATE DEFAULT alone
+# (without any other COLLATE or CHARACTER SET clauses)
+# should differ:
+# CREATE DATABASE db1 COMMENT '' [COLLATE DEFAULT]; -- means @@collation_server
+# ALTER DATABASE db1 COMMENT '' COLLATE DEFAULT; -- means "the default collation of the current character set of db1"
+# ALTER DATABASE db1 COMMENT ''; -- means "keep the current db1 collation"
+CALL diff_result_tables('results_create_db', 'results_alter_db', '');
+COUNT(*) 400
+SUM(t1.result=t2.result) 396
+SUM(t1.result<>t2.result) 4
+
+attrs
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci
+
+attrs COLLATE DEFAULT
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
+
+attrs COLLATE DEFAULT COLLATE DEFAULT
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
+
+attrs COLLATE DEFAULT COLLATE DEFAULT COLLATE DEFAULT
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
+#
+# Running CREATE TABLE tests
+#
+CREATE DATABASE test1 COLLATE utf8mb4_unicode_ci;
+CREATE TABLE results LIKE results_template;
+CALL run_all('',
+'CREATE TABLE test1.t1 (a int) /*CSCL*/',
+'DROP TABLE IF EXISTS test1.t1');
+ALTER TABLE results RENAME TO results_create_table;
+# Expect no difference to CREATE DATABASE
+CALL diff_result_tables('results_create_db', 'results_create_table', '');
+COUNT(*) 400
+SUM(t1.result=t2.result) 400
+SUM(t1.result<>t2.result) 0
+DROP DATABASE test1;
+#
+# Running ALTER TABLE tests
+#
+CREATE DATABASE test1 COLLATE utf8mb4_unicode_ci;
+CREATE TABLE results LIKE results_template;
+CALL run_all('CREATE TABLE test1.t1(a INT) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci',
+'ALTER TABLE test1.t1 COMMENT '''' /*CSCL*/',
+'DROP TABLE test1.t1');
+ALTER TABLE results RENAME TO results_alter_table;
+# Only queries with no clauses or with COLLATE DEFAULT alone
+# (without any other COLLATE or CHARACTER SET clauses)
+# should differ:
+# CREATE TABLE test1.t1 COMMENT '' [COLLATE DEFAULT]; -- means "the default collation of the database test1"
+# ALTER TABLE test1.t1 COMMENT '' COLLATE DEFAULT; -- means "the default collation of the current character set of test1.t1"
+# ALTER TABLE test1.t1 COMMENT ''; -- means "keep the current collation of test.t1"
+CALL diff_result_tables('results_create_table', 'results_alter_table', '');
+COUNT(*) 400
+SUM(t1.result=t2.result) 396
+SUM(t1.result<>t2.result) 4
+
+attrs
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci
+
+attrs COLLATE DEFAULT
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
+
+attrs COLLATE DEFAULT COLLATE DEFAULT
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
+
+attrs COLLATE DEFAULT COLLATE DEFAULT COLLATE DEFAULT
+aaa CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
+bbb CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
+DROP DATABASE test1;
+#
+# Running ALTER TABLE CONVERT TO tests
+#
+CREATE DATABASE test1 COLLATE utf8mb4_unicode_ci;
+CREATE TABLE results LIKE results_template;
+CALL run_all('CREATE TABLE test1.t1(a INT) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci',
+'ALTER TABLE test1.t1 CONVERT TO /*CSCL*/',
+'DROP TABLE test1.t1');
+ALTER TABLE results RENAME TO results_convert_table;
+# CONVERT TO COLLATE (without CHARACTER SET) is not supported yet
+CALL diff_result_tables_stat('results_alter_table', 'results_convert_table','');
+COUNT(*) 400
+SUM(t1.result=t2.result) 36
+SUM(t1.result<>t2.result) 364
+# Everything that did not fail on syntax error
+# should give equal results with ALTER TABLE DEFAULT CHARACTER SET
+# Expect 0 non-equal results:
+CALL diff_result_tables('results_alter_table', 'results_convert_table',
+'t2.result NOT RLIKE ''SQL syntax''');
+COUNT(*) 36
+SUM(t1.result=t2.result) 36
+SUM(t1.result<>t2.result) 0
+DROP DATABASE test1;
+DROP PROCEDURE show_results_all;
+DROP PROCEDURE run_all;
+DROP PROCEDURE show_results;
+DROP PROCEDURE exec;
+DROP PROCEDURE run;
+DROP PROCEDURE diff_result_tables;
+DROP PROCEDURE diff_result_tables_stat;
+DROP PROCEDURE diff_result_tables_records;
+DROP TABLE clauses;
+DROP TABLE results_template;
+DROP TABLE results_create_db;
+DROP TABLE results_alter_db;
+DROP TABLE results_create_table;
+DROP TABLE results_alter_table;
+DROP TABLE results_convert_table;
diff --git a/mysql-test/main/ctype_collate_context.test b/mysql-test/main/ctype_collate_context.test
new file mode 100644
index 00000000000..0867237a223
--- /dev/null
+++ b/mysql-test/main/ctype_collate_context.test
@@ -0,0 +1,366 @@
+--source include/have_utf8mb4.inc
+
+
+CREATE TABLE t0 (a VARCHAR(64));
+INSERT INTO t0 VALUES
+('CHARACTER SET DEFAULT'),
+('CHARACTER SET latin1'),
+('CHARACTER SET utf8mb4'),
+('COLLATE DEFAULT'),
+('COLLATE utf8mb4_bin'),
+('COLLATE latin1_swedish_ci'),
+('COLLATE latin1_bin');
+
+CREATE TABLE clauses
+(
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ cl1 VARCHAR(64) NOT NULL,
+ cl2 VARCHAR(64) NOT NULL,
+ cl3 VARCHAR(64) NOT NULL,
+ clause_count INT GENERATED ALWAYS AS ((cl1<>'') + (cl2<>'') + (cl3<>'')),
+ clauses TEXT GENERATED ALWAYS AS (CONCAT(cl1,
+ IF(cl2='','',' '), cl2,
+ IF(cl3='','',' '), cl3))
+);
+
+# No clauses
+INSERT INTO clauses (cl1, cl2, cl3)
+ SELECT '' AS cl1, '' AS cl2, '' AS cl3;
+
+# One clause
+INSERT INTO clauses (cl1, cl2, cl3)
+ SELECT t0.a AS cl1, '' AS cl2, '' AS cl3
+ FROM t0;
+
+# Two clauses
+INSERT INTO clauses (cl1, cl2, cl3)
+ SELECT t0.a AS cl1, t2.a AS cl2, '' AS cl3
+ FROM t0 t0, t0 t2;
+
+# Three clauses
+INSERT INTO clauses (cl1, cl2, cl3)
+ SELECT t0.a AS cl1, t2.a AS cl2, t3.a AS cl3
+ FROM t0 t0, t0 t2, t0 t3;
+
+DROP TABLE t0;
+
+
+CREATE TABLE results_template
+(
+ id INT NOT NULL PRIMARY KEY,
+ result TEXT NOT NULL
+);
+
+
+DELIMITER $$;
+CREATE PROCEDURE diff_result_tables_stat(table1 VARCHAR(64),
+ table2 VARCHAR(64),
+ cond VARCHAR(128))
+BEGIN
+ DECLARE query_counts TEXT DEFAULT
+ 'SELECT '
+ ' COUNT(*),'
+ ' SUM(t1.result=t2.result),'
+ ' SUM(t1.result<>t2.result) '
+ 'FROM table1 t1 JOIN table2 t2 USING (id)/*$(WHERE)*/';
+
+ SET query_counts=REPLACE(query_counts, 'table1', table1);
+ SET query_counts=REPLACE(query_counts, 'table2', table2);
+ IF (cond<>'')
+ THEN
+ SET query_counts=REPLACE(query_counts, '/*$(WHERE)*/', CONCAT('WHERE ',cond));
+ END IF;
+ EXECUTE IMMEDIATE query_counts;
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE diff_result_tables_records(table1 VARCHAR(64),
+ table2 VARCHAR(64),
+ cond VARCHAR(128))
+BEGIN
+ DECLARE query_records TEXT DEFAULT
+ 'SELECT '
+ ' '''' AS ``,'
+ ' clauses.clauses AS attrs,'
+ ' t1.result AS `aaa`,'
+ ' t2.result AS `bbb` '
+ ' FROM table1 t1'
+ ' JOIN table2 t2 USING (id)'
+ ' JOIN clauses USING (id) '
+ ' WHERE t1.result<>t2.result /*$(COND)*/ ORDER BY t1.id';
+
+ SET query_records=REPLACE(query_records, 'table1', table1);
+ SET query_records=REPLACE(query_records, 'table2', table2);
+ IF (cond<>'')
+ THEN
+ SET query_records=REPLACE(query_records, '/*$(COND)*/', CONCAT('AND ',cond));
+ END IF;
+ EXECUTE IMMEDIATE query_records;
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE diff_result_tables(table1 VARCHAR(64),
+ table2 VARCHAR(64),
+ cond VARCHAR(128))
+BEGIN
+ CALL diff_result_tables_stat(table1, table2, cond);
+ CALL diff_result_tables_records(table1, table2, cond);
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE exec(query_bootstrap TEXT,
+ query_pattern TEXT,
+ query_cleanup TEXT,
+ id INT,
+ clauses TEXT)
+BEGIN
+ DECLARE query TEXT DEFAULT REPLACE(query_pattern, '/*CSCL*/',clauses);
+ DECLARE result TEXT DEFAULT NULL;
+ DECLARE CONTINUE HANDLER FOR
+ 1064, /*ER_PARSE_ERROR*/
+ 1302, /*ER_CONFLICTING_DECLARATIONS*/
+ 1253 /*ER_COLLATION_CHARSET_MISMATCH*/
+ BEGIN
+ GET DIAGNOSTICS CONDITION 1 result=MESSAGE_TEXT;
+ SET result=CONCAT('ERROR: ', result);
+ END;
+ IF query_bootstrap<>''
+ THEN
+ EXECUTE IMMEDIATE query_bootstrap;
+ END IF;
+ EXECUTE IMMEDIATE query;
+ IF result IS NULL
+ THEN
+ IF query_pattern LIKE '%DATABASE%'
+ THEN
+ SET result=(SELECT CONCAT('CHARACTER SET ', DEFAULT_CHARACTER_SET_NAME,
+ ' COLLATE ', DEFAULT_COLLATION_NAME)
+ FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1');
+ ELSE
+ SET result=(SELECT CONCAT('CHARACTER SET ', SUBSTRING_INDEX(TABLE_COLLATION,'_',1),
+ ' COLLATE ', TABLE_COLLATION)
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test1');
+ END IF;
+ END IF;
+ INSERT INTO results (id, result) VALUES (id, result);
+ IF query_cleanup<>''
+ THEN
+ EXECUTE IMMEDIATE query_cleanup;
+ END IF;
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE show_results(query TEXT, clause_count_arg INT)
+BEGIN
+ SELECT '' AS ``, CONCAT(clause_count_arg, ' clauses') AS `TEST:`;
+ SELECT '' AS ``, COUNT(*) AS `TOTAL`
+ FROM results JOIN clauses USING (id)
+ WHERE clauses.clause_count=clause_count_arg;
+
+ -- Display erroneous results
+ SELECT '' AS ``, COUNT(*) AS `ERROR`
+ FROM results JOIN clauses USING (id)
+ WHERE clauses.clause_count=clause_count_arg
+ AND result RLIKE '^ERROR';
+
+ SELECT '' AS ``, query, clauses AS attrs, result
+ FROM results JOIN clauses USING (id)
+ WHERE clauses.clause_count=clause_count_arg
+ AND result RLIKE '^ERROR' ORDER BY id;
+
+ -- Display successfull results
+ SELECT '' AS ``, COUNT(*) AS `OK`
+ FROM results JOIN clauses USING (id)
+ WHERE clauses.clause_count=clause_count_arg
+ AND result NOT RLIKE '^ERROR';
+
+ SELECT '' AS ``, query, clauses AS attrs, result
+ FROM results JOIN clauses USING (id)
+ WHERE clauses.clause_count=clause_count_arg
+ AND result NOT RLIKE '^ERROR' ORDER BY id;
+END;
+$$
+DELIMITER ;$$
+
+
+DELIMITER $$;
+CREATE PROCEDURE run(query_bootstrap TEXT,
+ query TEXT,
+ query_cleanup TEXT,
+ clause_count_arg INT)
+BEGIN
+ FOR rec IN (SELECT * FROM clauses WHERE clause_count=clause_count_arg)
+ DO
+ CALL exec(query_bootstrap, query, query_cleanup, rec.id, rec.clauses);
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+CREATE PROCEDURE run_all(query_bootstrap TEXT, query TEXT, query_cleanup TEXT)
+BEGIN
+ DECLARE msg TEXT;
+ DECLARE count_results INT;
+ DECLARE count_clauses INT;
+ FOR i IN 0..3
+ DO
+ CALL run(query_bootstrap, query, query_cleanup, i);
+ END FOR;
+ SET count_clauses=(SELECT COUNT(*) FROM clauses);
+ SET count_results=(SELECT COUNT(*) FROM results);
+ IF (count_results<>count_clauses)
+ THEN
+ SET msg=CONCAT('Got ', count_results,' rows in `results`; ',
+ 'Expected ', count_clauses, ' rows');
+ SIGNAL SQLSTATE '45000'
+ SET MYSQL_ERRNO=30001,
+ MESSAGE_TEXT=msg;
+ END IF;
+END;
+$$
+DELIMITER ;$$
+
+DELIMITER $$;
+CREATE PROCEDURE show_results_all(query TEXT)
+BEGIN
+ FOR i IN 0..3
+ DO
+ CALL show_results(query, i);
+ END FOR;
+END;
+$$
+DELIMITER ;$$
+
+
+--vertical_results
+
+--echo #
+--echo # Running CREATE DATABASE tests
+--echo # Displaying all results
+--echo #
+
+SET @@collation_server=utf8mb4_unicode_ci;
+CREATE TABLE results LIKE results_template;
+CALL run_all('','CREATE DATABASE db1 /*CSCL*/', 'DROP DATABASE IF EXISTS db1');
+CALL show_results_all('CREATE DATABASE');
+ALTER TABLE results RENAME TO results_create_db;
+
+--echo #
+--echo # Running ALTER DATABASE tests
+--echo #
+
+CREATE TABLE results LIKE results_template;
+CALL run_all('CREATE DATABASE db1 CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci',
+ 'ALTER DATABASE db1 COMMENT '''' /*CSCL*/',
+ 'DROP DATABASE db1');
+ALTER TABLE results RENAME TO results_alter_db;
+
+--echo # Displaying results that differ in CREATE DATABASE and ALTER DATABASE
+--echo # Only queries with no clauses or with COLLATE DEFAULT alone
+--echo # (without any other COLLATE or CHARACTER SET clauses)
+--echo # should differ:
+--echo # CREATE DATABASE db1 COMMENT '' [COLLATE DEFAULT]; -- means @@collation_server
+--echo # ALTER DATABASE db1 COMMENT '' COLLATE DEFAULT; -- means "the default collation of the current character set of db1"
+--echo # ALTER DATABASE db1 COMMENT ''; -- means "keep the current db1 collation"
+
+CALL diff_result_tables('results_create_db', 'results_alter_db', '');
+
+
+--echo #
+--echo # Running CREATE TABLE tests
+--echo #
+
+CREATE DATABASE test1 COLLATE utf8mb4_unicode_ci;
+
+CREATE TABLE results LIKE results_template;
+CALL run_all('',
+ 'CREATE TABLE test1.t1 (a int) /*CSCL*/',
+ 'DROP TABLE IF EXISTS test1.t1');
+ALTER TABLE results RENAME TO results_create_table;
+--echo # Expect no difference to CREATE DATABASE
+CALL diff_result_tables('results_create_db', 'results_create_table', '');
+
+DROP DATABASE test1;
+
+
+--echo #
+--echo # Running ALTER TABLE tests
+--echo #
+
+CREATE DATABASE test1 COLLATE utf8mb4_unicode_ci;
+
+CREATE TABLE results LIKE results_template;
+CALL run_all('CREATE TABLE test1.t1(a INT) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci',
+ 'ALTER TABLE test1.t1 COMMENT '''' /*CSCL*/',
+ 'DROP TABLE test1.t1');
+ALTER TABLE results RENAME TO results_alter_table;
+--echo # Only queries with no clauses or with COLLATE DEFAULT alone
+--echo # (without any other COLLATE or CHARACTER SET clauses)
+--echo # should differ:
+--echo # CREATE TABLE test1.t1 COMMENT '' [COLLATE DEFAULT]; -- means "the default collation of the database test1"
+--echo # ALTER TABLE test1.t1 COMMENT '' COLLATE DEFAULT; -- means "the default collation of the current character set of test1.t1"
+--echo # ALTER TABLE test1.t1 COMMENT ''; -- means "keep the current collation of test.t1"
+CALL diff_result_tables('results_create_table', 'results_alter_table', '');
+#SELECT result FROM (
+#(SELECT * FROM results_create_table)
+#EXCEPT
+#(SELECT * FROM results_alter_table)) t1;
+
+DROP DATABASE test1;
+
+--echo #
+--echo # Running ALTER TABLE CONVERT TO tests
+--echo #
+
+CREATE DATABASE test1 COLLATE utf8mb4_unicode_ci;
+
+CREATE TABLE results LIKE results_template;
+CALL run_all('CREATE TABLE test1.t1(a INT) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci',
+ 'ALTER TABLE test1.t1 CONVERT TO /*CSCL*/',
+ 'DROP TABLE test1.t1');
+ALTER TABLE results RENAME TO results_convert_table;
+
+--echo # CONVERT TO COLLATE (without CHARACTER SET) is not supported yet
+
+CALL diff_result_tables_stat('results_alter_table', 'results_convert_table','');
+
+--echo # Everything that did not fail on syntax error
+--echo # should give equal results with ALTER TABLE DEFAULT CHARACTER SET
+--echo # Expect 0 non-equal results:
+CALL diff_result_tables('results_alter_table', 'results_convert_table',
+ 't2.result NOT RLIKE ''SQL syntax''');
+
+DROP DATABASE test1;
+
+--horizontal_results
+
+
+DROP PROCEDURE show_results_all;
+DROP PROCEDURE run_all;
+DROP PROCEDURE show_results;
+DROP PROCEDURE exec;
+DROP PROCEDURE run;
+DROP PROCEDURE diff_result_tables;
+DROP PROCEDURE diff_result_tables_stat;
+DROP PROCEDURE diff_result_tables_records;
+DROP TABLE clauses;
+DROP TABLE results_template;
+DROP TABLE results_create_db;
+DROP TABLE results_alter_db;
+DROP TABLE results_create_table;
+DROP TABLE results_alter_table;
+DROP TABLE results_convert_table;
diff --git a/mysql-test/main/ctype_collate_database.result b/mysql-test/main/ctype_collate_database.result
new file mode 100644
index 00000000000..6af984606d6
--- /dev/null
+++ b/mysql-test/main/ctype_collate_database.result
@@ -0,0 +1,130 @@
+#
+# MDEV-27896 Wrong result upon COLLATE latin1_bin CHARACTER SET latin1 on the table or the database level
+#
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET latin1;
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
+DROP DATABASE db1;
+CREATE VIEW cscl AS
+SELECT
+DEFAULT_CHARACTER_SET_NAME,
+DEFAULT_COLLATION_NAME
+FROM
+INFORMATION_SCHEMA.SCHEMATA
+WHERE
+SCHEMA_NAME='db1';
+SET collation_server=utf8mb4_unicode_ci;
+CREATE DATABASE db1 COMMENT 'test';
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_unicode_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 COLLATE DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 COLLATE latin1_bin;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+latin1 latin1_bin
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET latin1;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+latin1 latin1_swedish_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET latin1 COLLATE DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+latin1 latin1_swedish_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET latin1 COLLATE latin1_bin;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+latin1 latin1_bin
+DROP DATABASE db1;
+CREATE DATABASE db1 COLLATE DEFAULT CHARACTER SET latin1;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+latin1 latin1_swedish_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET latin1;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+latin1 latin1_bin
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET DEFAULT CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 COLLATE DEFAULT CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET DEFAULT CHARACTER SET utf8mb4;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET utf8mb4 CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_general_ci
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET DEFAULT CHARACTER SET latin1;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET DEFAULT (utf8mb4)' and 'CHARACTER SET latin1'
+CREATE DATABASE db1 CHARACTER SET latin1 CHARACTER SET DEFAULT;
+ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT (utf8mb4)'
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
+ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
+ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE utf8mb4_bin;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_bin
+DROP DATABASE db1;
+CREATE DATABASE db1 COLLATE utf8mb4_bin CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME
+utf8mb4 utf8mb4_bin
+DROP DATABASE db1;
+DROP VIEW cscl;
+#
+# MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
+#
+CREATE DATABASE db1 COLLATE latin1_swedish_ci COLLATE latin1_bin;
+ERROR HY000: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+#
+# MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
+#
+SET collation_server=utf8mb4_unicode_ci;
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
+ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
+ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+SET collation_server=DEFAULT;
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
+DROP DATABASE db1;
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */
+DROP DATABASE db1;
diff --git a/mysql-test/main/ctype_collate_database.test b/mysql-test/main/ctype_collate_database.test
new file mode 100644
index 00000000000..0f07deca416
--- /dev/null
+++ b/mysql-test/main/ctype_collate_database.test
@@ -0,0 +1,124 @@
+--source include/have_utf8mb4.inc
+
+--echo #
+--echo # MDEV-27896 Wrong result upon COLLATE latin1_bin CHARACTER SET latin1 on the table or the database level
+--echo #
+
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET latin1;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+
+
+CREATE VIEW cscl AS
+SELECT
+ DEFAULT_CHARACTER_SET_NAME,
+ DEFAULT_COLLATION_NAME
+FROM
+ INFORMATION_SCHEMA.SCHEMATA
+WHERE
+ SCHEMA_NAME='db1';
+
+SET collation_server=utf8mb4_unicode_ci;
+CREATE DATABASE db1 COMMENT 'test';
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 COLLATE DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 COLLATE latin1_bin;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET latin1;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET latin1 COLLATE DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET latin1 COLLATE latin1_bin;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 COLLATE DEFAULT CHARACTER SET latin1;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET latin1;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET DEFAULT CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 COLLATE DEFAULT CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET DEFAULT CHARACTER SET utf8mb4;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET utf8mb4 CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+--error ER_CONFLICTING_DECLARATIONS
+CREATE DATABASE db1 CHARACTER SET DEFAULT CHARACTER SET latin1;
+--error ER_CONFLICTING_DECLARATIONS
+CREATE DATABASE db1 CHARACTER SET latin1 CHARACTER SET DEFAULT;
+
+--error ER_COLLATION_CHARSET_MISMATCH
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
+--error ER_COLLATION_CHARSET_MISMATCH
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
+
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE utf8mb4_bin;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 COLLATE utf8mb4_bin CHARACTER SET DEFAULT;
+SELECT * FROM cscl;
+DROP DATABASE db1;
+
+DROP VIEW cscl;
+
+
+--echo #
+--echo # MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
+--echo #
+
+--error ER_CONFLICTING_DECLARATIONS
+CREATE DATABASE db1 COLLATE latin1_swedish_ci COLLATE latin1_bin;
+
+
+--echo #
+--echo # MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
+--echo #
+
+SET collation_server=utf8mb4_unicode_ci;
+--error ER_COLLATION_CHARSET_MISMATCH
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
+--error ER_COLLATION_CHARSET_MISMATCH
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
+SET collation_server=DEFAULT;
+
+CREATE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
+
+CREATE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
+SHOW CREATE DATABASE db1;
+DROP DATABASE db1;
diff --git a/mysql-test/main/ctype_collate_table.result b/mysql-test/main/ctype_collate_table.result
new file mode 100644
index 00000000000..131c7e76cf1
--- /dev/null
+++ b/mysql-test/main/ctype_collate_table.result
@@ -0,0 +1,57 @@
+#
+# MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
+#
+CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
+DROP TABLE t1;
+#
+# MDEV-27782 Wrong columns when using table level `CHARACTER SET utf8mb4 COLLATE DEFAULT`
+#
+CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1 COLLATE DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf8mb4 COLLATE DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
+DROP TABLE t1;
+#
+# MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
+#
+CREATE TABLE t1 (a CHAR(10)) COLLATE latin1_swedish_ci COLLATE latin1_bin;
+ERROR HY000: Conflicting declarations: 'COLLATE latin1_swedish_ci' and 'COLLATE latin1_bin'
+#
+# MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
+#
+CREATE DATABASE db1 CHARACTER SET utf8mb4;
+USE db1;
+CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
+ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
+ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
+DROP DATABASE db1;
+USE test;
+CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
+DROP TABLE t1;
diff --git a/mysql-test/main/ctype_collate_table.test b/mysql-test/main/ctype_collate_table.test
new file mode 100644
index 00000000000..36dbf298faa
--- /dev/null
+++ b/mysql-test/main/ctype_collate_table.test
@@ -0,0 +1,51 @@
+--source include/have_utf8mb4.inc
+
+--echo #
+--echo # MDEV-27896 Wrong result upon `COLLATE latin1_bin CHARACTER SET latin1` on the table or the database level
+--echo #
+
+CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-27782 Wrong columns when using table level `CHARACTER SET utf8mb4 COLLATE DEFAULT`
+--echo #
+
+CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1 COLLATE DEFAULT;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf8mb4 COLLATE DEFAULT;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-28117 Multiple conflicting table COLLATE clauses are not rejected
+--echo #
+
+--error ER_CONFLICTING_DECLARATIONS
+CREATE TABLE t1 (a CHAR(10)) COLLATE latin1_swedish_ci COLLATE latin1_bin;
+
+
+--echo #
+--echo # MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors
+--echo #
+
+CREATE DATABASE db1 CHARACTER SET utf8mb4;
+USE db1;
+--error ER_COLLATION_CHARSET_MISMATCH
+CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
+--error ER_COLLATION_CHARSET_MISMATCH
+CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
+DROP DATABASE db1;
+USE test;
+
+CREATE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/main/ctype_create.result b/mysql-test/main/ctype_create.result
index e6f5e84cf61..8f818450024 100644
--- a/mysql-test/main/ctype_create.result
+++ b/mysql-test/main/ctype_create.result
@@ -78,37 +78,113 @@ ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
ERROR 42000: Incorrect database name ''
USE test;
#
-# Start of 10.0 tests
+# End of 10.0 tests
+#
+#
+# Start of 10.9 tests
#
#
# MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
+# MDEV-28644 Unexpected error on ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb3, DEFAULT CHARACTER SET utf8mb4
#
CREATE DATABASE tmp DEFAULT CHARACTER SET latin5;
USE tmp;
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET DEFAULT' and 'CHARACTER SET utf8mb3'
+ERROR HY000: Conflicting declarations: 'CHARACTER SET DEFAULT (latin5)' and 'CHARACTER SET utf8mb3'
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET DEFAULT;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8mb3' and 'CHARACTER SET DEFAULT'
+ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8mb3' and 'CHARACTER SET DEFAULT (latin5)'
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET utf8;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET DEFAULT;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET latin1;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8mb3' and 'CHARACTER SET latin1'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET DEFAULT;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET utf8mb3' and 'CHARACTER SET DEFAULT'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci
ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET utf8;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8mb3'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET DEFAULT;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET utf8mb3'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
-ERROR HY000: Conflicting declarations: 'CHARACTER SET latin5' and 'CHARACTER SET latin1'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ALTER TABLE t1 CHARACTER SET latin1, CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ALTER TABLE t1 CHARACTER SET DEFAULT, CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci
+ALTER TABLE t1 CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE t1 CHARACTER SET DEFAULT, CONVERT TO CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin5 COLLATE=latin5_turkish_ci
+ALTER TABLE t1 CHARACTER SET utf8, CONVERT TO CHARACTER SET DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+ALTER TABLE t1 CHARACTER SET latin1, CONVERT TO CHARACTER SET DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL,
+ `b` varchar(10) CHARACTER SET latin5 COLLATE latin5_turkish_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
DROP DATABASE tmp;
USE test;
#
-# End of 10.0 tests
+# End of 10.9 tests
#
diff --git a/mysql-test/main/ctype_create.test b/mysql-test/main/ctype_create.test
index 6ccc83521bd..ec36d6b4dde 100644
--- a/mysql-test/main/ctype_create.test
+++ b/mysql-test/main/ctype_create.test
@@ -108,11 +108,16 @@ ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
USE test;
--echo #
---echo # Start of 10.0 tests
+--echo # End of 10.0 tests
+--echo #
+
+--echo #
+--echo # Start of 10.9 tests
--echo #
--echo #
--echo # MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
+--echo # MDEV-28644 Unexpected error on ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb3, DEFAULT CHARACTER SET utf8mb4
--echo #
CREATE DATABASE tmp DEFAULT CHARACTER SET latin5;
USE tmp;
@@ -125,23 +130,48 @@ DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET DEFAULT;
DROP TABLE t1;
+
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
---error ER_CONFLICTING_DECLARATIONS
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET latin1;
---error ER_CONFLICTING_DECLARATIONS
+SHOW CREATE TABLE t1;
+
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET DEFAULT;
---error ER_CONFLICTING_DECLARATIONS
+SHOW CREATE TABLE t1;
+
ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET utf8;
---error ER_CONFLICTING_DECLARATIONS
+SHOW CREATE TABLE t1;
+
ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET DEFAULT;
---error ER_CONFLICTING_DECLARATIONS
+SHOW CREATE TABLE t1;
+
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
---error ER_CONFLICTING_DECLARATIONS
+SHOW CREATE TABLE t1;
+
ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 CHARACTER SET latin1, CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 CHARACTER SET DEFAULT, CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 CHARACTER SET DEFAULT, CONVERT TO CHARACTER SET latin1;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 CHARACTER SET utf8, CONVERT TO CHARACTER SET DEFAULT;
+SHOW CREATE TABLE t1;
+
+ALTER TABLE t1 CHARACTER SET latin1, CONVERT TO CHARACTER SET DEFAULT;
+SHOW CREATE TABLE t1;
+
DROP TABLE t1;
DROP DATABASE tmp;
USE test;
--echo #
---echo # End of 10.0 tests
+--echo # End of 10.9 tests
--echo #
diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result
index 739fa979f28..a223bf084e9 100644
--- a/mysql-test/main/ctype_filename.result
+++ b/mysql-test/main/ctype_filename.result
@@ -133,3 +133,22 @@ a c
DROP TABLE t1;
SET NAMES utf8;
# End of 10.5 tests
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-28481 SIGSEGV in Lex_charset_collation_st::find_bin_collation
+#
+SET SESSION collation_server=filename;
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t (c CHAR BINARY);
+ERROR HY000: Unknown collation: 'filename_bin'
+DROP DATABASE db1;
+USE test;
+SET NAMES latin1;
+CREATE TABLE t1 (c CHAR BINARY) CHARACTER SET filename;
+ERROR HY000: Unknown collation: 'filename_bin'
+#
+# End of 10.9 tests
+#
diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test
index bfafe4d437f..f74ece22931 100644
--- a/mysql-test/main/ctype_filename.test
+++ b/mysql-test/main/ctype_filename.test
@@ -142,3 +142,27 @@ SET NAMES utf8;
--enable_ps_protocol
--echo # End of 10.5 tests
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-28481 SIGSEGV in Lex_charset_collation_st::find_bin_collation
+--echo #
+
+SET SESSION collation_server=filename;
+CREATE DATABASE db1;
+USE db1;
+--error ER_UNKNOWN_COLLATION
+CREATE TABLE t (c CHAR BINARY);
+DROP DATABASE db1;
+USE test;
+SET NAMES latin1;
+
+--error ER_UNKNOWN_COLLATION
+CREATE TABLE t1 (c CHAR BINARY) CHARACTER SET filename;
+
+--echo #
+--echo # End of 10.9 tests
+--echo #
diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result
index cf51e679679..5be12e91b68 100644
--- a/mysql-test/main/ctype_latin1.result
+++ b/mysql-test/main/ctype_latin1.result
@@ -8889,6 +8889,38 @@ a b
111 111
DROP TABLE t1;
#
+# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+#
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
+CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT)
+a
+CREATE TABLE t1 AS
+SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
+c1
+string
+CREATE TABLE t1 AS
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` longtext DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
# End of 10.2 tests
#
#
@@ -8950,3 +8982,31 @@ Warning 1292 Truncated incorrect INTEGER value: 'aÿb'
#
# End of 10.5 tests
#
+#
+# Start of 10.6 tests
+#
+#
+# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+#
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) CHARACTER SET latin1 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+name
+Jeans
+CREATE TABLE t1 AS
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) CHARACTER SET latin1 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `name` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
+# End of 10.6 tests
+#
diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test
index d5b62beb140..935b42fa2f3 100644
--- a/mysql-test/main/ctype_latin1.test
+++ b/mysql-test/main/ctype_latin1.test
@@ -438,6 +438,28 @@ let $coll_pad='latin1_bin';
SET NAMES latin1;
--source include/ctype_like_range_mdev14350.inc
+
+--echo #
+--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+--echo #
+
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT);
+CREATE TABLE t1 AS
+SELECT CAST('a' AS CHAR(10) CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
+CREATE TABLE t1 AS
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET latin1 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
--echo #
--echo # End of 10.2 tests
--echo #
@@ -475,3 +497,29 @@ SELECT CAST(_latin1 0x61FF62 AS INT);
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # Start of 10.6 tests
+--echo #
+
+--echo #
+--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+--echo #
+
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) CHARACTER SET latin1 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+CREATE TABLE t1 AS
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) CHARACTER SET latin1 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result
index a10dbfea179..92e8d0b9027 100644
--- a/mysql-test/main/ctype_utf8.result
+++ b/mysql-test/main/ctype_utf8.result
@@ -11651,3 +11651,46 @@ Warning 1292 Truncated incorrect INTEGER value: 'ÑÑÑ'
#
# End of 10.5 tests
#
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-28118 Wrong collation of `CAST(.. AS CHAR COLLATE DEFAULT)`
+#
+SET NAMES utf8mb3 COLLATE utf8mb3_bin;
+SELECT COLLATION(CAST('a' AS CHAR COLLATE DEFAULT));
+COLLATION(CAST('a' AS CHAR COLLATE DEFAULT))
+utf8mb3_general_ci
+CREATE TABLE t1 AS SELECT CAST('a' AS CHAR COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
+# MDEV-28119 Wrong column collation on MODIFY + CONVERT
+#
+CREATE TABLE t1 (a CHAR);
+ALTER TABLE t1
+MODIFY a CHAR COLLATE DEFAULT,
+CONVERT TO CHARACTER SET utf8mb3 COLLATE utf8mb3_bin;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin
+DROP TABLE t1;
+CREATE TABLE t1 (a CHAR);
+ALTER TABLE t1
+MODIFY a CHAR BINARY,
+CONVERT TO CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
+DROP TABLE t1;
+#
+# End of 10.9 tests
+#
diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test
index 99b952cdfb8..363871529da 100644
--- a/mysql-test/main/ctype_utf8.test
+++ b/mysql-test/main/ctype_utf8.test
@@ -2519,3 +2519,41 @@ SELECT CAST(_utf8 'ÑÑÑ' AS INT);
--echo #
--echo # End of 10.5 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-28118 Wrong collation of `CAST(.. AS CHAR COLLATE DEFAULT)`
+--echo #
+
+SET NAMES utf8mb3 COLLATE utf8mb3_bin;
+SELECT COLLATION(CAST('a' AS CHAR COLLATE DEFAULT));
+CREATE TABLE t1 AS SELECT CAST('a' AS CHAR COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-28119 Wrong column collation on MODIFY + CONVERT
+--echo #
+
+CREATE TABLE t1 (a CHAR);
+ALTER TABLE t1
+ MODIFY a CHAR COLLATE DEFAULT,
+ CONVERT TO CHARACTER SET utf8mb3 COLLATE utf8mb3_bin;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a CHAR);
+ALTER TABLE t1
+ MODIFY a CHAR BINARY,
+ CONVERT TO CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.9 tests
+--echo #
diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result
index 834e1c8e859..26e8784e4f1 100644
--- a/mysql-test/main/ctype_utf8mb4.result
+++ b/mysql-test/main/ctype_utf8mb4.result
@@ -4147,6 +4147,38 @@ EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
c
😎
#
+# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+#
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+SELECT CAST('a' AS CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT);
+CAST('a' AS CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT)
+a
+CREATE TABLE t1 AS
+SELECT CAST('a' AS CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET utf8mb4 COLLATE DEFAULT) AS c1;
+c1
+string
+CREATE TABLE t1 AS
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET utf8mb4 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
# End of 10.2 tests
#
#
@@ -4167,3 +4199,31 @@ ERROR 42000: COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8m
#
# End of 10.5 tests
#
+#
+# Start of 10.6 tests
+#
+#
+# MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+#
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+name
+Jeans
+CREATE TABLE t1 AS
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+#
+# End of 10.6 tests
+#
diff --git a/mysql-test/main/ctype_utf8mb4.test b/mysql-test/main/ctype_utf8mb4.test
index c0c5568b3bd..200a205bd96 100644
--- a/mysql-test/main/ctype_utf8mb4.test
+++ b/mysql-test/main/ctype_utf8mb4.test
@@ -2044,6 +2044,27 @@ EXECUTE stmt;
EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
--echo #
+--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+--echo #
+
+CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+SELECT CAST('a' AS CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT);
+CREATE TABLE t1 AS
+SELECT CAST('a' AS CHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET utf8mb4 COLLATE DEFAULT) AS c1;
+CREATE TABLE t1 AS
+SELECT COLUMN_GET(COLUMN_CREATE(0, 'string'),0 AS CHAR CHARACTER SET utf8mb4 COLLATE DEFAULT) AS c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.2 tests
--echo #
@@ -2065,3 +2086,30 @@ SELECT 1 COLLATE latin1_swedish_ci;
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # Start of 10.6 tests
+--echo #
+
+--echo #
+--echo # MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
+--echo #
+
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+CREATE TABLE t1 AS
+SELECT * FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) CHARACTER SET utf8mb4 COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.6 tests
+--echo #
+
diff --git a/mysql-test/main/dyncol.result b/mysql-test/main/dyncol.result
index 08f22ffb3b4..041e3040867 100644
--- a/mysql-test/main/dyncol.result
+++ b/mysql-test/main/dyncol.result
@@ -1459,7 +1459,7 @@ Note 1105 Cast to signed converted positive out-of-range integer to it's negativ
# mysqld
#
SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
-ERROR 42000: Too big scale 50 specified for ''y''. Maximum is 38
+ERROR 42000: Too big scale specified for ''y''. Maximum is 38
#
# test of symbolic names
#
diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result
index 73cc64d95aa..8cbc5305405 100644
--- a/mysql-test/main/func_json.result
+++ b/mysql-test/main/func_json.result
@@ -1686,3 +1686,897 @@ DROP TABLE t1;
#
# End of 10.8 tests
#
+#
+# MDEV-27677: Implement JSON_OVERLAPS()
+#
+# Testing scalar json datatypes
+# Comparing scalar json datatypes with itself
+SELECT JSON_OVERLAPS('true', 'true');
+JSON_OVERLAPS('true', 'true')
+1
+SELECT JSON_OVERLAPS('false', 'false');
+JSON_OVERLAPS('false', 'false')
+1
+SELECT JSON_OVERLAPS('1', '1');
+JSON_OVERLAPS('1', '1')
+1
+SELECT JSON_OVERLAPS('"string1"', '"string1"');
+JSON_OVERLAPS('"string1"', '"string1"')
+1
+SELECT JSON_OVERLAPS('null', 'null');
+JSON_OVERLAPS('null', 'null')
+1
+# Comparing scalar json datatypes with other scalar datatype
+SELECT JSON_OVERLAPS('true', 'false');
+JSON_OVERLAPS('true', 'false')
+0
+SELECT JSON_OVERLAPS('1', '"1"');
+JSON_OVERLAPS('1', '"1"')
+0
+SELECT JSON_OVERLAPS('1', '0');
+JSON_OVERLAPS('1', '0')
+0
+SELECT JSON_OVERLAPS('null', '0');
+JSON_OVERLAPS('null', '0')
+0
+SELECT JSON_OVERLAPS('"string1"', '"string2"');
+JSON_OVERLAPS('"string1"', '"string2"')
+0
+SELECT JSON_OVERLAPS('true','["abc", 1, 2, true, false]');
+JSON_OVERLAPS('true','["abc", 1, 2, true, false]')
+1
+SELECT JSON_OVERLAPS('true','["abc", 1, 2, [true]]');
+JSON_OVERLAPS('true','["abc", 1, 2, [true]]')
+0
+SELECT JSON_OVERLAPS('true','{"A":true}');
+JSON_OVERLAPS('true','{"A":true}')
+0
+# Testing non-scalar json data types
+# Comparing object with object (non-nested)
+SELECT JSON_OVERLAPS('{"A":[1, 2, 3]}','{}');
+JSON_OVERLAPS('{"A":[1, 2, 3]}','{}')
+0
+SELECT JSON_OVERLAPS('{"A": 1}',
+'{"A": 1}');
+JSON_OVERLAPS('{"A": 1}',
+'{"A": 1}')
+1
+SELECT JSON_OVERLAPS('{"A": 1}',
+'{"B": 1}');
+JSON_OVERLAPS('{"A": 1}',
+'{"B": 1}')
+0
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": "string1"
+ }',
+'{
+ "A": 2,
+ "B": "string1"
+ }');
+JSON_OVERLAPS('{
+ "A": 1,
+ "B": "string1"
+ }',
+'{
+ "A": 2,
+ "B": "string1"
+ }')
+1
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": "string1"
+ }',
+'{
+ "A": 2,
+ "B": "string2"
+ }');
+JSON_OVERLAPS('{
+ "A": 1,
+ "B": "string1"
+ }',
+'{
+ "A": 2,
+ "B": "string2"
+ }')
+0
+# Comparing nested object with other nested object
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": {"C":2}
+ }',
+'{
+ "A": 2,
+ "B": {"C":1}
+ }');
+JSON_OVERLAPS('{
+ "A": 1,
+ "B": {"C":2}
+ }',
+'{
+ "A": 2,
+ "B": {"C":1}
+ }')
+0
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": {"C":2}
+ }',
+'{
+ "A": 2,
+ "B": {"C":2}
+ }');
+JSON_OVERLAPS('{
+ "A": 1,
+ "B": {"C":2}
+ }',
+'{
+ "A": 2,
+ "B": {"C":2}
+ }')
+1
+SELECT JSON_OVERLAPS('{
+ "A": {
+ "B": true
+ }
+ }',
+'{
+ "A": {
+ "B": true,
+ "C": false
+ }
+ }');
+JSON_OVERLAPS('{
+ "A": {
+ "B": true
+ }
+ }',
+'{
+ "A": {
+ "B": true,
+ "C": false
+
+0
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":5}}',
+'{"C":3, "B":{"E":5, "D":4}}');
+JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":5}}',
+'{"C":3, "B":{"E":5, "D":4}}')
+1
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "B":{"E":5, "D":4}}');
+JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "B":{"E":5, "D":4}}')
+0
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "B":{"E":[5, 6, 7], "D":4}}');
+JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "B":{"E":[5, 6, 7], "D":4}}')
+1
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "B":{"E":[7, 6 ,5], "D":4}}');
+JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "B":{"E":[7, 6 ,5], "D":4}}')
+0
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "F":{"E":[5, 6, 7], "D":4}}');
+JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+'{"C":3, "F":{"E":[5, 6, 7], "D":4}}')
+0
+# Comparing array with array (non-nested)
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+'[3, 4, 1]');
+JSON_OVERLAPS('[1, 2, true, false, null]',
+'[3, 4, 1]')
+1
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+'[3, 4, 5]');
+JSON_OVERLAPS('[1, 2, true, false, null]',
+'[3, 4, 5]')
+0
+SELECT JSON_OVERLAPS('[1,2,3]','[]');
+JSON_OVERLAPS('[1,2,3]','[]')
+0
+# Comparing nested arrays
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+'[3, 4, [1]]');
+JSON_OVERLAPS('[1, 2, true, false, null]',
+'[3, 4, [1]]')
+0
+SELECT JSON_OVERLAPS('[1, 2, [true, false], null]',
+'[[1], [true, false]]');
+JSON_OVERLAPS('[1, 2, [true, false], null]',
+'[[1], [true, false]]')
+1
+SELECT JSON_OVERLAPS('[1, 2, 3, [4, 5, 6]]','[7, 8, 9, [6, 5, 4]]');
+JSON_OVERLAPS('[1, 2, 3, [4, 5, 6]]','[7, 8, 9, [6, 5, 4]]')
+0
+# Comparing one non-scalar json datatypes with another non-scalar
+# json datatype
+# Comparing array with object
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+'{"A": 1}');
+JSON_OVERLAPS('[1, 2, true, false, null]',
+'{"A": 1}')
+0
+SELECT JSON_OVERLAPS('[1, 2, true, false, null, {"A":2}]',
+'{"A": 1}');
+JSON_OVERLAPS('[1, 2, true, false, null, {"A":2}]',
+'{"A": 1}')
+0
+SELECT JSON_OVERLAPS('[1, {"A": 2}, {"A": 1}]',
+'{"A": 1}');
+JSON_OVERLAPS('[1, {"A": 2}, {"A": 1}]',
+'{"A": 1}')
+1
+SELECT JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": 2}]',
+'{"A": 1, "B": 2}');
+JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": 2}]',
+'{"A": 1, "B": 2}')
+1
+SELECT JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": 2}]',
+'{"A": 1, "B": 3}');
+JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": 2}]',
+'{"A": 1, "B": 3}')
+0
+# Comparing nested array with object
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+'{"A": 1, "B": 2}');
+JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+'{"A": 1, "B": 2}')
+0
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+'{"A": 1, "B": 3}');
+JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+'{"A": 1, "B": 3}')
+0
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+'{"A": 1}');
+JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+'{"A": 1}')
+0
+# Comparing array with nested object
+SELECT JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": {"C": 12}}]',
+'{"A": 1, "B": {"C": 12}}');
+JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": {"C": 12}}]',
+'{"A": 1, "B": {"C": 12}}')
+1
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": {"C": 12}}]]',
+'{"A": 1, "B": {"C": 12}}');
+JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": {"C": 12}}]]',
+'{"A": 1, "B": {"C": 12}}')
+0
+# Comparing nested array with nested objects
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": {"C": 12}}]]',
+'{"A": 1, "B":{"C": 12}}');
+JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": {"C": 12}}]]',
+'{"A": 1, "B":{"C": 12}}')
+0
+SELECT JSON_OVERLAPS('[[1, 2, true, false, {"A": 1, "B": {"C": 12}}]]',
+'{"A": 1, "B": {"C": 12}}');
+JSON_OVERLAPS('[[1, 2, true, false, {"A": 1, "B": {"C": 12}}]]',
+'{"A": 1, "B": {"C": 12}}')
+0
+# Comparing object with array
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}',
+'[1, 2, true, false, {"A": 1, "B": 2}]');
+JSON_OVERLAPS('{"A": 1, "B": 3}',
+'[1, 2, true, false, {"A": 1, "B": 2}]')
+0
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}',
+'[1, 2, true, false, {"A": 1, "B": 3}]');
+JSON_OVERLAPS('{"A": 1, "B": 3}',
+'[1, 2, true, false, {"A": 1, "B": 3}]')
+1
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}',
+'[1, 2, true, false, {"A": 1, "B": 2}, {"A": 1, "B": 3}]');
+JSON_OVERLAPS('{"A": 1, "B": 3}',
+'[1, 2, true, false, {"A": 1, "B": 2}, {"A": 1, "B": 3}]')
+1
+SELECT JSON_OVERLAPS('{"A": 1, "B": [1, 2, 3]}',
+'[1, 2, true, false, {"A": 1, "B": 2}, {"A": 1, "B": [1, 2, 3]}]');
+JSON_OVERLAPS('{"A": 1, "B": [1, 2, 3]}',
+'[1, 2, true, false, {"A": 1, "B": 2}, {"A": 1, "B": [1, 2, 3]}]')
+1
+SELECT JSON_OVERLAPS('{"A": 1, "B": [1, 2, {"C": 3, "D": 5}]}',
+'[1, 2, true, false, {"A": 1, "B": 2}, {"A":1, "B":[1, 2, {"C": 3, "D": 5}]}]');
+JSON_OVERLAPS('{"A": 1, "B": [1, 2, {"C": 3, "D": 5}]}',
+'[1, 2, true, false, {"A": 1, "B": 2}, {"A":1, "B":[1, 2, {"C": 3, "D": 5}]}]')
+1
+SELECT JSON_OVERLAPS('{"A": 1, "B": [1, 2, {"C": 3, "D": 5}]}',
+'[1, 2, true, false, {"A": 1, "B": 2},{"A": 1, "B": [1, 2, {"C": 3, "D": 4}]}]');
+JSON_OVERLAPS('{"A": 1, "B": [1, 2, {"C": 3, "D": 5}]}',
+'[1, 2, true, false, {"A": 1, "B": 2},{"A": 1, "B": [1, 2, {"C": 3, "D": 4}]}]')
+0
+# Comparing object with nested array
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}','[1, 2, true, false, [{"A": 1, "B": 2}, {"A": 1, "B": 3}]]');
+JSON_OVERLAPS('{"A": 1, "B": 3}','[1, 2, true, false, [{"A": 1, "B": 2}, {"A": 1, "B": 3}]]')
+0
+# Checking errors and warnings
+SELECT JSON_OVERLAPS('[1,2,{"A":B}]', '{"A":B}', '{"C":"string1"}');
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_OVERLAPS'
+SELECT JSON_OVERLAPS('[1,2,{"A":B}]');
+ERROR 42000: Incorrect parameter count in the call to native function 'JSON_OVERLAPS'
+#
+# MDEV-27990: Incorrect behavior of JSON_OVERLAPS() on warning
+#
+SELECT JSON_OVERLAPS('','');
+JSON_OVERLAPS('','')
+0
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 1 to function 'json_overlaps'
+SELECT JSON_OVERLAPS('true','tr');
+JSON_OVERLAPS('true','tr')
+0
+Warnings:
+Warning 4037 Unexpected end of JSON text in argument 2 to function 'json_overlaps'
+#
+# MDEV-22224: Support JSON Path negative index
+#
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_APPEND(@json, '$.A[-2][-1]', 5);
+JSON_ARRAY_APPEND(@json, '$.A[-2][-1]', 5)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, 13, {"key1": "value1"}, [15, 5]], true], "B": {"C": 1}, "D": 2}
+SELECT JSON_ARRAY_APPEND(@json, '$.A[last-1][last]', 5);
+JSON_ARRAY_APPEND(@json, '$.A[last-1][last]', 5)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, 13, {"key1": "value1"}, [15, 5]], true], "B": {"C": 1}, "D": 2}
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_INSERT(@json, '$.A[-2][-2]', 5);
+JSON_ARRAY_INSERT(@json, '$.A[-2][-2]', 5)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, 13, {"key1": "value1"}, 5, [15]], true], "B": {"C": 1}, "D": 2}
+SELECT JSON_ARRAY_INSERT(@json, '$.A[last-1][last-1]', 5);
+JSON_ARRAY_INSERT(@json, '$.A[last-1][last-1]', 5)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, 13, {"key1": "value1"}, 5, [15]], true], "B": {"C": 1}, "D": 2}
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_CONTAINS(@json, '15', '$.A[-2][-1]');
+JSON_CONTAINS(@json, '15', '$.A[-2][-1]')
+1
+SELECT JSON_CONTAINS(@json, '15', '$.A[last-1][last]');
+JSON_CONTAINS(@json, '15', '$.A[last-1][last]')
+1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_CONTAINS_PATH(@json, 'one', '$.A[-2]');
+JSON_CONTAINS_PATH(@json, 'one', '$.A[-2]')
+1
+SELECT JSON_CONTAINS_PATH(@json, 'one', '$.A[last-1]');
+JSON_CONTAINS_PATH(@json, 'one', '$.A[last-1]')
+1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_EXISTS(@json, '$.A[-2][-1]');
+JSON_EXISTS(@json, '$.A[-2][-1]')
+1
+SELECT JSON_EXISTS(@json, '$.A[last-1][last]');
+JSON_EXISTS(@json, '$.A[last-1][last]')
+1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_EXTRACT(@json, '$.A[-8][1]');
+JSON_EXTRACT(@json, '$.A[-8][1]')
+5
+SELECT JSON_EXTRACT(@json, '$.A[last-7][1]');
+JSON_EXTRACT(@json, '$.A[last-7][1]')
+5
+SET @json= '[{"A": 1, "B": 2, "C": {"D": 3}},{"A": 1, "B": 2, "C": {"D": 3}}]';
+SELECT JSON_KEYS(@json, '$[-1].C');
+JSON_KEYS(@json, '$[-1].C')
+["D"]
+SELECT JSON_KEYS(@json, '$[last].C');
+JSON_KEYS(@json, '$[last].C')
+["D"]
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_LENGTH(@json, '$.A[-2][-3]');
+JSON_LENGTH(@json, '$.A[-2][-3]')
+2
+SELECT JSON_LENGTH(@json, '$.A[last-1][last-2]');
+JSON_LENGTH(@json, '$.A[last-1][last-2]')
+2
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_QUERY(@json, '$.A[-8]');
+JSON_QUERY(@json, '$.A[-8]')
+[4, 5, 6]
+SELECT JSON_QUERY(@json, '$.A[last-7]');
+JSON_QUERY(@json, '$.A[last-7]')
+[4, 5, 6]
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_REMOVE(@json, '$.A[-10]');
+JSON_REMOVE(@json, '$.A[-10]')
+{"A": [[1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, [13, 14], {"key1": "value1"}, [15]], true], "B": {"C": 1}, "D": 2}
+SELECT JSON_REMOVE(@json, '$.A[last-9]');
+JSON_REMOVE(@json, '$.A[last-9]')
+{"A": [[1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, [13, 14], {"key1": "value1"}, [15]], true], "B": {"C": 1}, "D": 2}
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_REPLACE(@json, '$.A[-1]', 4);
+JSON_REPLACE(@json, '$.A[-1]', 4)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, [13, 14], {"key1": "value1"}, [15]], 4], "B": {"C": 1}, "D": 2}
+SELECT JSON_REPLACE(@json, '$.A[last]', 4);
+JSON_REPLACE(@json, '$.A[last]', 4)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, false, "eleven", [12, [13, 14], {"key1": "value1"}, [15]], 4], "B": {"C": 1}, "D": 2}
+SET @json = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
+SELECT JSON_SEARCH(@json, 'all', 'abc', NULL, '$[-2]');
+JSON_SEARCH(@json, 'all', 'abc', NULL, '$[-2]')
+"$[2].x"
+SELECT JSON_SEARCH(@json, 'all', 'abc', NULL, '$[last-1]');
+JSON_SEARCH(@json, 'all', 'abc', NULL, '$[last-1]')
+"$[2].x"
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_SET(@json, '$.A[-4]', 100);
+JSON_SET(@json, '$.A[-4]', 100)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, 100, "eleven", [12, [13, 14], {"key1": "value1"}, [15]], true], "B": {"C": 1}, "D": 2}
+SELECT JSON_SET(@json, '$.A[last-3]', 100);
+JSON_SET(@json, '$.A[last-3]', 100)
+{"A": [0, [1, 2, 3], [4, 5, 6], "seven", 0.8, true, 100, "eleven", [12, [13, 14], {"key1": "value1"}, [15]], true], "B": {"C": 1}, "D": 2}
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":123},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_VALUE(@json, '$.A[-2][-2].key1');
+JSON_VALUE(@json, '$.A[-2][-2].key1')
+123
+SELECT JSON_VALUE(@json, '$.A[last-1][last-1].key1');
+JSON_VALUE(@json, '$.A[last-1][last-1].key1')
+123
+#
+# MDEV-27972: Unexpected behavior with negative zero (-0) in JSON Path
+#
+SET @json='{ "x": [0,1]}';
+SELECT JSON_VALUE(@json,'$.x[last]');
+JSON_VALUE(@json,'$.x[last]')
+1
+SELECT JSON_VALUE(@json,'$.x[last-0]');
+JSON_VALUE(@json,'$.x[last-0]')
+1
+SELECT JSON_VALUE(@json,'$.x[-0]');
+JSON_VALUE(@json,'$.x[-0]')
+0
+SELECT JSON_VALUE(@json,'$.x[0]');
+JSON_VALUE(@json,'$.x[0]')
+0
+#
+# MDEV-27911: Implement range notation for json path
+#
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXISTS(@json, '$[3][3][-2 to last]');
+JSON_EXISTS(@json, '$[3][3][-2 to last]')
+1
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_SEARCH(@json, 'one', '12', NULL, '$[3][0 to 3]');
+JSON_SEARCH(@json, 'one', '12', NULL, '$[3][0 to 3]')
+NULL
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_VALUE(@json, '$[0][1 to 2].key1');
+JSON_VALUE(@json, '$[0][1 to 2].key1')
+value1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_QUERY(@json, '$.A[-2][-3 to -1]');
+JSON_QUERY(@json, '$.A[-2][-3 to -1]')
+[13, 14]
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXTRACT(@json, '$[0 to 3][2]');
+JSON_EXTRACT(@json, '$[0 to 3][2]')
+[3, 6, [9, {"key2": 2}, 11], [14]]
+SELECT JSON_EXTRACT(@json, '$[3][3][last-1 to last]');
+JSON_EXTRACT(@json, '$[3][3][last-1 to last]')
+["string1", [16, {"key1": [1, 2, 3, [4, 5, 6]]}, 18]]
+SELECT JSON_EXTRACT(@json, '$[3][3][-2 to -1]');
+JSON_EXTRACT(@json, '$[3][3][-2 to -1]')
+["string1", [16, {"key1": [1, 2, 3, [4, 5, 6]]}, 18]]
+# Checking errors
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS_PATH(@json,'one', '$[3][0 to 3]');
+JSON_CONTAINS_PATH(@json,'one', '$[3][0 to 3]')
+1
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS(@json, '$[3][0 to 3]');
+JSON_CONTAINS(@json, '$[3][0 to 3]')
+NULL
+Warnings:
+Warning 4038 Syntax error in JSON text in argument 2 to function 'json_contains' at position 1
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_INSERT(@json, '$.A[0 to last-1]', 5);
+JSON_ARRAY_INSERT(@json, '$.A[0 to last-1]', 5)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_insert'
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_APPEND(@json, '$.A[*]', 7);
+JSON_ARRAY_APPEND(@json, '$.A[*]', 7)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_SET(@json, '$[0][1 to 2].key1', 1);
+JSON_SET(@json, '$[0][1 to 2].key1', 1)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_set'
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REPLACE(@json, '$[1][last-2 to last]', 4);
+JSON_REPLACE(@json, '$[1][last-2 to last]', 4)
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_replace'
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REMOVE(@json, '$[1][-6 to last-2]');
+JSON_REMOVE(@json, '$[1][-6 to last-2]')
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_KEYS(@json, '$.A[8][1 to 3]');
+JSON_KEYS(@json, '$.A[8][1 to 3]')
+NULL
+Warnings:
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_keys'
+#
+# MDEV-28075: JSON_VALUE returns first value from array not from range
+#
+SET @json1= '[
+ [{"key1": "value1"}, {"key2": "value2"}],
+ [{"key3": "value3"}, {"key1": "value4"}],
+ [{"key1": "value5"}, {"key4": "value6"}, {"key1": "value7"}]
+ ]';
+SELECT JSON_VALUE(@json1, '$[2][1 to 2].key1');
+JSON_VALUE(@json1, '$[2][1 to 2].key1')
+value7
+SET @json= '[
+ [1.1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [11, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_VALUE(@json, '$[*][0]');
+JSON_VALUE(@json, '$[*][0]')
+1.1
+SELECT JSON_VALUE(@json, '$[2 to 3][0]');
+JSON_VALUE(@json, '$[2 to 3][0]')
+7
+#
+# MDEV-28072: JSON_EXTRACT has inconsistent behavior with '0' value in
+# json path (when range is used)
+#
+SET @json= '[ 11, 22 , 33]';
+SELECT JSON_EXTRACT(@json, '$[0 to 0]');
+JSON_EXTRACT(@json, '$[0 to 0]')
+[11]
+SELECT JSON_EXTRACT(@json, '$[0 to -0]');
+JSON_EXTRACT(@json, '$[0 to -0]')
+[11]
+SELECT JSON_EXTRACT(@json, '$[-0 to 0]');
+JSON_EXTRACT(@json, '$[-0 to 0]')
+[11]
+SELECT JSON_EXTRACT(@json, '$[-0 to -0]');
+JSON_EXTRACT(@json, '$[-0 to -0]')
+[11]
+#
+# MDEV-28071: JSON_EXISTS returns always 1 if it is used range notation
+# for json path
+#
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXISTS(@json, '$[2][2][1 to 2]');
+JSON_EXISTS(@json, '$[2][2][1 to 2]')
+1
+SELECT JSON_EXISTS(@json, '$[2][2][4 to 6]');
+JSON_EXISTS(@json, '$[2][2][4 to 6]')
+0
+SELECT JSON_EXISTS(@json, '$[2][2][1 to 4]');
+JSON_EXISTS(@json, '$[2][2][1 to 4]')
+1
+#
+# MDEV-28326: Server crashes in json_path_parts_compare
+#
+SELECT * FROM JSON_TABLE('{"foo":["bar","qux"]}','$**.*[0]' COLUMNS(col1 CHAR(8) PATH '$[0]')) AS jt;
+col1
+bar
+#
+# MDEV-29212: json_overlaps() does not check nested key-value pair correctly
+#
+SET @json1 = '{"kk":{"k1":"v1","k2":"v2"}}';
+SET @json2 = '{"kk":{"k1":"v1","k2":"v2","k3":"v3"}}';
+SELECT JSON_OVERLAPS(@json2, @json1);
+JSON_OVERLAPS(@json2, @json1)
+0
+SELECT JSON_OVERLAPS(@json1, @json2);
+JSON_OVERLAPS(@json1, @json2)
+0
+#
+# MDEV-30304: Json Range only affects first row of the result set
+#
+CREATE TABLE t1 ( j JSON );
+INSERT INTO t1 (j) VALUES ('[{"key1": 1, "key2": 1}, {"key3": 1, "key4": 1}]');
+INSERT INTO t1 (j) VALUES ('[{"key1": 2, "key2": 2}, {"key3": 2, "key4": 2}, {"key5": 2, "key6": 2}]');
+INSERT INTO t1 (j) VALUES ('[{"key1": 3, "key2": 3}, {"key3": 3, "key4": 3}, {"key5": 3}]');
+SELECT JSON_EXTRACT(j, '$[0 to 1]') FROM t1 ;
+JSON_EXTRACT(j, '$[0 to 1]')
+[{"key1": 1, "key2": 1}, {"key3": 1, "key4": 1}]
+[{"key1": 2, "key2": 2}, {"key3": 2, "key4": 2}]
+[{"key1": 3, "key2": 3}, {"key3": 3, "key4": 3}]
+SELECT JSON_EXTRACT(j, '$[*]') FROM t1 ;
+JSON_EXTRACT(j, '$[*]')
+[{"key1": 1, "key2": 1}, {"key3": 1, "key4": 1}]
+[{"key1": 2, "key2": 2}, {"key3": 2, "key4": 2}, {"key5": 2, "key6": 2}]
+[{"key1": 3, "key2": 3}, {"key3": 3, "key4": 3}, {"key5": 3}]
+DROP TABLE t1;
+#
+# MDEV-29381: JSON paths containing dashes are reported as syntax errors in procedures
+#
+SELECT JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
+JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"')
+1
+SELECT JSON_EXTRACT('{ "my-key": 1 }', '$.my-key');
+JSON_EXTRACT('{ "my-key": 1 }', '$.my-key')
+1
+#
+# End of 10.9 Test
+#
diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test
index 1f61f9abd13..9bf0c9bae05 100644
--- a/mysql-test/main/func_json.test
+++ b/mysql-test/main/func_json.test
@@ -1125,3 +1125,653 @@ DROP TABLE t1;
--echo #
--echo # End of 10.8 tests
--echo #
+
+--echo #
+--echo # MDEV-27677: Implement JSON_OVERLAPS()
+--echo #
+
+
+--echo # Testing scalar json datatypes
+
+--echo # Comparing scalar json datatypes with itself
+SELECT JSON_OVERLAPS('true', 'true');
+SELECT JSON_OVERLAPS('false', 'false');
+SELECT JSON_OVERLAPS('1', '1');
+SELECT JSON_OVERLAPS('"string1"', '"string1"');
+SELECT JSON_OVERLAPS('null', 'null');
+
+--echo # Comparing scalar json datatypes with other scalar datatype
+SELECT JSON_OVERLAPS('true', 'false');
+SELECT JSON_OVERLAPS('1', '"1"');
+SELECT JSON_OVERLAPS('1', '0');
+SELECT JSON_OVERLAPS('null', '0');
+SELECT JSON_OVERLAPS('"string1"', '"string2"');
+
+SELECT JSON_OVERLAPS('true','["abc", 1, 2, true, false]');
+SELECT JSON_OVERLAPS('true','["abc", 1, 2, [true]]');
+SELECT JSON_OVERLAPS('true','{"A":true}');
+
+
+--echo # Testing non-scalar json data types
+
+--echo # Comparing object with object (non-nested)
+SELECT JSON_OVERLAPS('{"A":[1, 2, 3]}','{}');
+SELECT JSON_OVERLAPS('{"A": 1}',
+ '{"A": 1}');
+SELECT JSON_OVERLAPS('{"A": 1}',
+ '{"B": 1}');
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": "string1"
+ }',
+ '{
+ "A": 2,
+ "B": "string1"
+ }');
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": "string1"
+ }',
+ '{
+ "A": 2,
+ "B": "string2"
+ }');
+
+--echo # Comparing nested object with other nested object
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": {"C":2}
+ }',
+ '{
+ "A": 2,
+ "B": {"C":1}
+ }');
+SELECT JSON_OVERLAPS('{
+ "A": 1,
+ "B": {"C":2}
+ }',
+ '{
+ "A": 2,
+ "B": {"C":2}
+ }');
+SELECT JSON_OVERLAPS('{
+ "A": {
+ "B": true
+ }
+ }',
+ '{
+ "A": {
+ "B": true,
+ "C": false
+ }
+ }');
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":5}}',
+ '{"C":3, "B":{"E":5, "D":4}}');
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+ '{"C":3, "B":{"E":5, "D":4}}');
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+ '{"C":3, "B":{"E":[5, 6, 7], "D":4}}');
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+ '{"C":3, "B":{"E":[7, 6 ,5], "D":4}}');
+SELECT JSON_OVERLAPS('{"A":1, "B":{"D":4, "E":[5, 6, 7]}}',
+ '{"C":3, "F":{"E":[5, 6, 7], "D":4}}');
+
+
+--echo # Comparing array with array (non-nested)
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+ '[3, 4, 1]');
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+ '[3, 4, 5]');
+SELECT JSON_OVERLAPS('[1,2,3]','[]');
+
+--echo # Comparing nested arrays
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+ '[3, 4, [1]]');
+SELECT JSON_OVERLAPS('[1, 2, [true, false], null]',
+ '[[1], [true, false]]');
+SELECT JSON_OVERLAPS('[1, 2, 3, [4, 5, 6]]','[7, 8, 9, [6, 5, 4]]');
+
+
+--echo # Comparing one non-scalar json datatypes with another non-scalar
+--echo # json datatype
+
+--echo # Comparing array with object
+SELECT JSON_OVERLAPS('[1, 2, true, false, null]',
+ '{"A": 1}');
+SELECT JSON_OVERLAPS('[1, 2, true, false, null, {"A":2}]',
+ '{"A": 1}');
+SELECT JSON_OVERLAPS('[1, {"A": 2}, {"A": 1}]',
+ '{"A": 1}');
+SELECT JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": 2}]',
+ '{"A": 1, "B": 2}');
+SELECT JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": 2}]',
+ '{"A": 1, "B": 3}');
+
+-- echo # Comparing nested array with object
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+ '{"A": 1, "B": 2}');
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+ '{"A": 1, "B": 3}');
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": 2}]]',
+ '{"A": 1}');
+
+--echo # Comparing array with nested object
+SELECT JSON_OVERLAPS('[1, 2, true, false, {"A": 1, "B": {"C": 12}}]',
+ '{"A": 1, "B": {"C": 12}}');
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": {"C": 12}}]]',
+ '{"A": 1, "B": {"C": 12}}');
+
+--echo # Comparing nested array with nested objects
+SELECT JSON_OVERLAPS('[1, 2, true, false, [{"A": 1, "B": {"C": 12}}]]',
+ '{"A": 1, "B":{"C": 12}}');
+SELECT JSON_OVERLAPS('[[1, 2, true, false, {"A": 1, "B": {"C": 12}}]]',
+ '{"A": 1, "B": {"C": 12}}');
+
+--echo # Comparing object with array
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}',
+ '[1, 2, true, false, {"A": 1, "B": 2}]');
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}',
+ '[1, 2, true, false, {"A": 1, "B": 3}]');
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}',
+ '[1, 2, true, false, {"A": 1, "B": 2}, {"A": 1, "B": 3}]');
+SELECT JSON_OVERLAPS('{"A": 1, "B": [1, 2, 3]}',
+ '[1, 2, true, false, {"A": 1, "B": 2}, {"A": 1, "B": [1, 2, 3]}]');
+SELECT JSON_OVERLAPS('{"A": 1, "B": [1, 2, {"C": 3, "D": 5}]}',
+ '[1, 2, true, false, {"A": 1, "B": 2}, {"A":1, "B":[1, 2, {"C": 3, "D": 5}]}]');
+SELECT JSON_OVERLAPS('{"A": 1, "B": [1, 2, {"C": 3, "D": 5}]}',
+ '[1, 2, true, false, {"A": 1, "B": 2},{"A": 1, "B": [1, 2, {"C": 3, "D": 4}]}]');
+
+--echo # Comparing object with nested array
+SELECT JSON_OVERLAPS('{"A": 1, "B": 3}','[1, 2, true, false, [{"A": 1, "B": 2}, {"A": 1, "B": 3}]]');
+
+--echo # Checking errors and warnings
+
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_OVERLAPS('[1,2,{"A":B}]', '{"A":B}', '{"C":"string1"}');
+--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
+SELECT JSON_OVERLAPS('[1,2,{"A":B}]');
+
+--echo #
+--echo # MDEV-27990: Incorrect behavior of JSON_OVERLAPS() on warning
+--echo #
+SELECT JSON_OVERLAPS('','');
+SELECT JSON_OVERLAPS('true','tr');
+
+--echo #
+--echo # MDEV-22224: Support JSON Path negative index
+--echo #
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_APPEND(@json, '$.A[-2][-1]', 5);
+SELECT JSON_ARRAY_APPEND(@json, '$.A[last-1][last]', 5);
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_INSERT(@json, '$.A[-2][-2]', 5);
+SELECT JSON_ARRAY_INSERT(@json, '$.A[last-1][last-1]', 5);
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_CONTAINS(@json, '15', '$.A[-2][-1]');
+SELECT JSON_CONTAINS(@json, '15', '$.A[last-1][last]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_CONTAINS_PATH(@json, 'one', '$.A[-2]');
+SELECT JSON_CONTAINS_PATH(@json, 'one', '$.A[last-1]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_EXISTS(@json, '$.A[-2][-1]');
+SELECT JSON_EXISTS(@json, '$.A[last-1][last]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_EXTRACT(@json, '$.A[-8][1]');
+SELECT JSON_EXTRACT(@json, '$.A[last-7][1]');
+
+SET @json= '[{"A": 1, "B": 2, "C": {"D": 3}},{"A": 1, "B": 2, "C": {"D": 3}}]';
+SELECT JSON_KEYS(@json, '$[-1].C');
+SELECT JSON_KEYS(@json, '$[last].C');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_LENGTH(@json, '$.A[-2][-3]');
+SELECT JSON_LENGTH(@json, '$.A[last-1][last-2]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_QUERY(@json, '$.A[-8]');
+SELECT JSON_QUERY(@json, '$.A[last-7]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_REMOVE(@json, '$.A[-10]');
+SELECT JSON_REMOVE(@json, '$.A[last-9]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_REPLACE(@json, '$.A[-1]', 4);
+SELECT JSON_REPLACE(@json, '$.A[last]', 4);
+
+SET @json = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
+SELECT JSON_SEARCH(@json, 'all', 'abc', NULL, '$[-2]');
+SELECT JSON_SEARCH(@json, 'all', 'abc', NULL, '$[last-1]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_SET(@json, '$.A[-4]', 100);
+SELECT JSON_SET(@json, '$.A[last-3]', 100);
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":123},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_VALUE(@json, '$.A[-2][-2].key1');
+SELECT JSON_VALUE(@json, '$.A[last-1][last-1].key1');
+
+--echo #
+--echo # MDEV-27972: Unexpected behavior with negative zero (-0) in JSON Path
+--echo #
+
+SET @json='{ "x": [0,1]}';
+SELECT JSON_VALUE(@json,'$.x[last]');
+SELECT JSON_VALUE(@json,'$.x[last-0]');
+SELECT JSON_VALUE(@json,'$.x[-0]');
+SELECT JSON_VALUE(@json,'$.x[0]');
+
+
+--echo #
+--echo # MDEV-27911: Implement range notation for json path
+--echo #
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXISTS(@json, '$[3][3][-2 to last]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_SEARCH(@json, 'one', '12', NULL, '$[3][0 to 3]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_VALUE(@json, '$[0][1 to 2].key1');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_QUERY(@json, '$.A[-2][-3 to -1]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXTRACT(@json, '$[0 to 3][2]');
+SELECT JSON_EXTRACT(@json, '$[3][3][last-1 to last]');
+SELECT JSON_EXTRACT(@json, '$[3][3][-2 to -1]');
+
+--echo # Checking errors
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS_PATH(@json,'one', '$[3][0 to 3]');
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_CONTAINS(@json, '$[3][0 to 3]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_INSERT(@json, '$.A[0 to last-1]', 5);
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, 13, {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_ARRAY_APPEND(@json, '$.A[*]', 7);
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [12, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_SET(@json, '$[0][1 to 2].key1', 1);
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REPLACE(@json, '$[1][last-2 to last]', 4);
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_REMOVE(@json, '$[1][-6 to last-2]');
+
+SET @json='{
+ "A": [0,
+ [1, 2, 3],
+ [4, 5, 6],
+ "seven",
+ 0.8,
+ true,
+ false,
+ "eleven",
+ [12, [13, 14], {"key1":"value1"},[15]],
+ true],
+ "B": {"C": 1},
+ "D": 2
+ }';
+SELECT JSON_KEYS(@json, '$.A[8][1 to 3]');
+
+--echo #
+--echo # MDEV-28075: JSON_VALUE returns first value from array not from range
+--echo #
+
+SET @json1= '[
+ [{"key1": "value1"}, {"key2": "value2"}],
+ [{"key3": "value3"}, {"key1": "value4"}],
+ [{"key1": "value5"}, {"key4": "value6"}, {"key1": "value7"}]
+ ]';
+SELECT JSON_VALUE(@json1, '$[2][1 to 2].key1');
+
+
+SET @json= '[
+ [1.1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [11, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20]
+ ]';
+SELECT JSON_VALUE(@json, '$[*][0]');
+SELECT JSON_VALUE(@json, '$[2 to 3][0]');
+
+--echo #
+--echo # MDEV-28072: JSON_EXTRACT has inconsistent behavior with '0' value in
+--echo # json path (when range is used)
+--echo #
+
+SET @json= '[ 11, 22 , 33]';
+SELECT JSON_EXTRACT(@json, '$[0 to 0]');
+SELECT JSON_EXTRACT(@json, '$[0 to -0]');
+SELECT JSON_EXTRACT(@json, '$[-0 to 0]');
+SELECT JSON_EXTRACT(@json, '$[-0 to -0]');
+
+--echo #
+--echo # MDEV-28071: JSON_EXISTS returns always 1 if it is used range notation
+--echo # for json path
+--echo #
+
+SET @json= '[
+ [1, {"key1": "value1"}, 3],
+ [false, 5, 6],
+ [7, 8, [9, {"key2": 2}, 11]],
+ [15, 1.34, [14], ["string1", [16, {"key1":[1,2,3,[4,5,6]]}, 18]]],
+ [19, 20],
+ 21, 22
+ ]';
+SELECT JSON_EXISTS(@json, '$[2][2][1 to 2]');
+SELECT JSON_EXISTS(@json, '$[2][2][4 to 6]');
+SELECT JSON_EXISTS(@json, '$[2][2][1 to 4]');
+
+
+--echo #
+--echo # MDEV-28326: Server crashes in json_path_parts_compare
+--echo #
+
+SELECT * FROM JSON_TABLE('{"foo":["bar","qux"]}','$**.*[0]' COLUMNS(col1 CHAR(8) PATH '$[0]')) AS jt;
+
+--echo #
+--echo # MDEV-29212: json_overlaps() does not check nested key-value pair correctly
+--echo #
+
+SET @json1 = '{"kk":{"k1":"v1","k2":"v2"}}';
+SET @json2 = '{"kk":{"k1":"v1","k2":"v2","k3":"v3"}}';
+SELECT JSON_OVERLAPS(@json2, @json1);
+SELECT JSON_OVERLAPS(@json1, @json2);
+
+--echo #
+--echo # MDEV-30304: Json Range only affects first row of the result set
+--echo #
+
+CREATE TABLE t1 ( j JSON );
+
+INSERT INTO t1 (j) VALUES ('[{"key1": 1, "key2": 1}, {"key3": 1, "key4": 1}]');
+INSERT INTO t1 (j) VALUES ('[{"key1": 2, "key2": 2}, {"key3": 2, "key4": 2}, {"key5": 2, "key6": 2}]');
+INSERT INTO t1 (j) VALUES ('[{"key1": 3, "key2": 3}, {"key3": 3, "key4": 3}, {"key5": 3}]');
+
+SELECT JSON_EXTRACT(j, '$[0 to 1]') FROM t1 ;
+SELECT JSON_EXTRACT(j, '$[*]') FROM t1 ;
+
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-29381: JSON paths containing dashes are reported as syntax errors in procedures
+--echo #
+
+SELECT JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
+SELECT JSON_EXTRACT('{ "my-key": 1 }', '$.my-key');
+
+--echo #
+--echo # End of 10.9 Test
+--echo #
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result
index 27d5810d5f6..7188c5de205 100644
--- a/mysql-test/main/func_time.result
+++ b/mysql-test/main/func_time.result
@@ -1989,7 +1989,7 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010')
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
select now(258);
-ERROR 42000: Too big precision 258 specified for 'current_timestamp'. Maximum is 6
+ERROR 42000: Too big precision specified for 'current_timestamp'. Maximum is 6
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
diff --git a/mysql-test/main/func_time_hires.result b/mysql-test/main/func_time_hires.result
index c6fcec73696..24221eeed16 100644
--- a/mysql-test/main/func_time_hires.result
+++ b/mysql-test/main/func_time_hires.result
@@ -24,9 +24,9 @@ select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
time_to_sec(sec_to_time(11111)) 11111
time_to_sec(sec_to_time(11111.22222)) 11111.22222
select current_timestamp(7);
-ERROR 42000: Too big precision 7 specified for 'current_timestamp'. Maximum is 6
+ERROR 42000: Too big precision specified for 'current_timestamp'. Maximum is 6
select curtime(7);
-ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6
+ERROR 42000: Too big precision specified for 'curtime'. Maximum is 6
drop table if exists t1;
create table t1 select sec_to_time(12345), sec_to_time(12345.6789),
sec_to_time(1234567e-2), now(), curtime(0),
@@ -161,7 +161,7 @@ select cast(cast(@a as time(2)) as time(6));
cast(cast(@a as time(2)) as time(6))
12:13:14.120000
select CAST(@a AS DATETIME(7));
-ERROR 42000: Too big precision 7 specified for '@`a`'. Maximum is 6
+ERROR 42000: Too big precision specified for '@`a`'. Maximum is 6
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00')
2011-01-02 15:00:00
diff --git a/mysql-test/main/json_debug_nonembedded.result b/mysql-test/main/json_debug_nonembedded.result
index 6af88191d97..e759cafa38b 100644
--- a/mysql-test/main/json_debug_nonembedded.result
+++ b/mysql-test/main/json_debug_nonembedded.result
@@ -1,13 +1,13 @@
#
-# Beginning of 10.6 test
-#
# MDEV-28762: recursive call of some json functions without stack control
#
-SET @saved_debug= @@debug_dbug;
-SET @@debug_dbug='+d,json_check_min_stack_requirement';
-SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
+SET @saved_dbug = @@debug_dbug;
+SET debug_dbug='+d,json_check_min_stack_requirement';
+SET @json1= '{"key1":"val1"}';
+SET @json2= '{"key1":"val1"}';
+SELECT JSON_OVERLAPS(@json1, @json2);
ERROR HY000: Thread stack overrun: 'used bytes' used of a 'available' byte stack, and 'X' bytes needed. Consider increasing the thread_stack system variable.
-SET @@debug_dbug= @saved_debug;
+SET @@debug_dbug= @saved_dbug;
#
-# End of 10.6 tests
+# End of 10.9 test
#
diff --git a/mysql-test/main/json_debug_nonembedded.test b/mysql-test/main/json_debug_nonembedded.test
index cecb9f1f6ed..5813b46e556 100644
--- a/mysql-test/main/json_debug_nonembedded.test
+++ b/mysql-test/main/json_debug_nonembedded.test
@@ -2,21 +2,21 @@
--source include/have_debug.inc
--echo #
---echo # Beginning of 10.6 test
---echo #
--echo # MDEV-28762: recursive call of some json functions without stack control
--echo #
-SET @saved_debug= @@debug_dbug;
+SET @saved_dbug = @@debug_dbug;
+SET debug_dbug='+d,json_check_min_stack_requirement';
-SET @@debug_dbug='+d,json_check_min_stack_requirement';
+SET @json1= '{"key1":"val1"}';
+SET @json2= '{"key1":"val1"}';
--replace_regex /overrun: [0-9]* bytes used of a [0-9]* byte stack, and [0-9]* bytes needed/overrun: 'used bytes' used of a 'available' byte stack, and 'X' bytes needed/
--error ER_STACK_OVERRUN_NEED_MORE
-SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
+SELECT JSON_OVERLAPS(@json1, @json2);
-SET @@debug_dbug= @saved_debug;
+SET @@debug_dbug= @saved_dbug;
--echo #
---echo # End of 10.6 tests
+--echo # End of 10.9 test
--echo #
diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result
index 25b97460238..2d7a175e420 100644
--- a/mysql-test/main/lock_sync.result
+++ b/mysql-test/main/lock_sync.result
@@ -878,3 +878,28 @@ SET DEBUG_SYNC="RESET";
disconnect con1;
disconnect con2;
DROP TABLES t1, t2;
+#
+# MDEV-28567 Assertion `0' in open_tables upon function-related operation
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW UPDATE t2 SET b = 0;
+CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW UPDATE t1 SET a = 6;
+CREATE VIEW v1 AS SELECT * FROM t1;
+SET AUTOCOMMIT=OFF;
+SELECT * FROM t1;
+a
+DROP TRIGGER tr1;
+INSERT INTO t2 SELECT * FROM t2;
+SELECT f() FROM t2;
+ERROR 42000: FUNCTION test.f does not exist
+set debug_sync= 'after_open_table_mdl_shared signal s1';
+ALTER VIEW v1 AS SELECT f() FROM t1;
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+set debug_sync= 'now wait_for s1';
+SELECT * FROM ( SELECT * FROM v1 ) sq;
+COMMIT;
+DROP VIEW v1;
+DROP FUNCTION f;
+DROP TABLE t1, t2;
+set debug_sync= 'reset';
diff --git a/mysql-test/main/lock_sync.test b/mysql-test/main/lock_sync.test
index b2cb0bc058c..0d15f8459b6 100644
--- a/mysql-test/main/lock_sync.test
+++ b/mysql-test/main/lock_sync.test
@@ -1103,3 +1103,122 @@ DROP TABLES t1, t2;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
+
+--echo #
+--echo # MDEV-28567 Assertion `0' in open_tables upon function-related operation
+--echo #
+# To get MDL trace run this case like this:
+# mtr --mysqld=--debug=d,mdl,query:i:o,/tmp/mdl.log ...
+# Cleanup trace like this:
+# sed -i -re '/(mysql|performance_schema|sys|mtr)\// d; /MDL_BACKUP_|MDL_INTENTION_/ d; /\/(t2|tr1|tr2)/ d' /tmp/mdl.log
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT);
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW UPDATE t2 SET b = 0;
+CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW UPDATE t1 SET a = 6;
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SET AUTOCOMMIT=OFF;
+SELECT * FROM t1;
+# T@6
+# Seized: test/t1 (MDL_SHARED_READ)
+
+--connect (con1,localhost,root,,test)
+--send
+ DROP TRIGGER tr1;
+# T@7
+# Seized: test/t1 (MDL_SHARED_NO_WRITE)
+# Waiting: test/t1 (MDL_EXCLUSIVE)
+# Waiting: test/t1 (MDL_SHARED_WRITE)
+# Deadlock: test/t1 (MDL_SHARED_WRITE)
+
+--connection default
+--error 0, ER_LOCK_DEADLOCK
+INSERT INTO t2 SELECT * FROM t2;
+# T@6
+# Released: test/t1 (MDL_SHARED_READ)
+# T@7
+# Acquired: test/t1 (MDL_EXCLUSIVE) (good)
+--error ER_SP_DOES_NOT_EXIST
+SELECT f() FROM t2;
+# T@6
+# Seized: test/f (MDL_SHARED)
+# T@7
+# Released: test/t1 (MDL_EXCLUSIVE)
+# Good1: continue T@6 below
+# Bad1: continue T@8 below
+
+# Now we hold test/f, the below code creates concurrent
+# waiting of 3 threads for test/f which leads to deadlock (Bad)
+
+# To achive Good comment out 'now wait_for s1' below and run multiple times.
+
+--connect (con2,localhost,root,,test)
+set debug_sync= 'after_open_table_mdl_shared signal s1';
+--send
+ ALTER VIEW v1 AS SELECT f() FROM t1;
+# T@8
+# Good2: Waiting: test/v1 (MDL_EXCLUSIVE)
+# Good2-3: continue T@7 below
+# Good5: Acquired: test/v1 (MDL_EXCLUSIVE)
+# Good5: Seized: test/v1 (MDL_EXCLUSIVE)
+# Good5-6: continue T@7 below
+# Good7: Seized: test/t1 (MDL_SHARED_READ)
+# Good7: Waiting: test/f (MDL_SHARED)
+# Good7-8: continue T@7 below
+# Good9: Acquired: test/f (MDL_SHARED)
+# Good9: Released: test/f (MDL_SHARED)
+# Good9: Released: test/t1 (MDL_SHARED_READ)
+# Good9: Released: test/v1 (MDL_EXCLUSIVE)
+# Good9: command finished without error
+# Bad1: Seized: test/v1 (MDL_EXCLUSIVE)
+# Bad1: Seized: test/v1 (MDL_EXCLUSIVE)
+# Bad1: Seized: test/t1 (MDL_SHARED_READ)
+# Bad1-2: continue T@6 below
+# Bad4: Waiting: test/f (MDL_SHARED)
+# Bad4: Deadlock: test/f (MDL_SHARED)
+# Bad4: command finished with error
+
+--connection con1
+--reap
+--send
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+# T@7
+# Good3: Waiting: test/f (MDL_EXCLUSIVE)
+# Good3-4: continue T@6 below
+# Good6: Acquired: test/f (MDL_EXCLUSIVE)
+# Good6-7: continue T@8 above
+# Good8: Released: test/f (MDL_EXCLUSIVE)
+# Good8-9: continue T@8 above
+# Bad3: Waiting: test/f (MDL_EXCLUSIVE)
+# Bad3-4: continue T@8 above
+
+--connection default
+set debug_sync= 'now wait_for s1';
+--disable_result_log
+SELECT * FROM ( SELECT * FROM v1 ) sq;
+--enable_result_log
+# T@6
+# Good1: Seized: test/v1 (MDL_SHARED_READ)
+# Good1-2: continue T@8 above
+# Good4: Seized: test/t1 (MDL_SHARED_READ)
+# Bad2: Waiting: test/v1 (MDL_SHARED_READ)
+# Bad2-3: continue T@7 above
+
+# Cleanup
+COMMIT;
+# Good4: Released: test/t1 (MDL_SHARED_READ)
+# Good4: Released: test/v1 (MDL_SHARED_READ)
+# Good4: Released: test/f (MDL_SHARED)
+# Good4-5: continue T@8 above
+
+--connection con2
+--error 0, ER_SP_DOES_NOT_EXIST
+--reap
+--disconnect con1
+--disconnect con2
+--connection default
+DROP VIEW v1;
+DROP FUNCTION f;
+DROP TABLE t1, t2;
+set debug_sync= 'reset';
diff --git a/mysql-test/main/mysql_binary_mode.result b/mysql-test/main/mysql_binary_mode.result
index cb230037108..59d25199129 100644
--- a/mysql-test/main/mysql_binary_mode.result
+++ b/mysql-test/main/mysql_binary_mode.result
@@ -29,8 +29,6 @@ RESET MASTER;
# It creates the table with a wrong table name and generates an error.
# (error output was suppressed to make the test case platform agnostic)
-# It is not in binary_mode, so table name '0x410D0A42' can be translated to
-# '0x410A42' by mysql depending on the OS - Windows or Unix-like.
DROP TABLE `TABLE_NAME_MASKED`;
# In binary_mode, table name '0x410D0A42' and string '0x410042' can be
@@ -46,5 +44,5 @@ DROP TABLE `A
B`;
RESET MASTER;
include/assert.inc [Table and contents created through mysqltest match 0x610D0A62.]
-include/assert.inc [Table and contents created while replaying binary log without --binary-mode set match 0x61(0D)0A62.]
+include/assert.inc [Table and contents created while replaying binary log without --binary-mode set match 0x610A62.]
include/assert.inc [Table and contents created while replaying binary log with --binary-mode set match 0x610D0A62.]
diff --git a/mysql-test/main/mysql_binary_mode.test b/mysql-test/main/mysql_binary_mode.test
index d454bfb7624..76af372ac30 100644
--- a/mysql-test/main/mysql_binary_mode.test
+++ b/mysql-test/main/mysql_binary_mode.test
@@ -48,27 +48,15 @@ RESET MASTER;
--echo # It creates the table with a wrong table name and generates an error.
--echo # (error output was suppressed to make the test case platform agnostic)
-## disabling result log because the error message has the
-## table name in the output which is one byte different ('\r')
-## on unixes and windows.
+
--disable_result_log
--error 1
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/my.sql 2>&1
--enable_result_log
--echo
---echo # It is not in binary_mode, so table name '0x410D0A42' can be translated to
---echo # '0x410A42' by mysql depending on the OS - Windows or Unix-like.
--replace_result $table_name_wrong TABLE_NAME_MASKED $table_name_right TABLE_NAME_MASKED
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
-{
- eval DROP TABLE `$table_name_right`;
-}
-
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
-{
- eval DROP TABLE `$table_name_wrong`;
-}
+eval DROP TABLE `$table_name_wrong`;
--echo
--echo # In binary_mode, table name '0x410D0A42' and string '0x410042' can be
@@ -150,15 +138,9 @@ RESET MASTER;
--let $assert_cond= "$tbl0" = "610D0A62" AND "$val0" = "610D0A62"
--source include/assert.inc
---let $assert_text= Table and contents created while replaying binary log without --binary-mode set match 0x61(0D)0A62.
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
-{
- --let $assert_cond= "$tbl1" = "610D0A62" AND "$val1" = "610D0A62"
-}
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
-{
- --let $assert_cond= "$tbl1" = "610A62" AND "$val1" = "610A62"
-}
+--let $assert_text= Table and contents created while replaying binary log without --binary-mode set match 0x610A62.
+--let $assert_cond= "$tbl1" = "610A62" AND "$val1" = "610A62"
+
--source include/assert.inc
--let $assert_text= Table and contents created while replaying binary log with --binary-mode set match 0x610D0A62.
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index 42946fecda9..600d7da4157 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -687,7 +687,8 @@ The following specify which files/extra groups are read (specified before remain
--old-mode=name Used to emulate old behavior from earlier MariaDB or
MySQL versions. Any combination of:
NO_DUP_KEY_WARNINGS_WITH_IGNORE, NO_PROGRESS_INFO,
- ZERO_DATE_TIME_CAST, UTF8_IS_UTF8MB3
+ ZERO_DATE_TIME_CAST, UTF8_IS_UTF8MB3,
+ IGNORE_INDEX_ONLY_FOR_JOIN, COMPAT_5_1_CHECKSUM
--old-passwords Use old password encryption method (needed for 4.0 and
older clients)
--old-style-user-limits
@@ -1720,7 +1721,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 221
+performance-schema-max-statement-classes 222
performance-schema-max-statement-stack 10
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
diff --git a/mysql-test/main/mysqldump-order-by-size.result b/mysql-test/main/mysqldump-order-by-size.result
new file mode 100644
index 00000000000..361852905c0
--- /dev/null
+++ b/mysql-test/main/mysqldump-order-by-size.result
@@ -0,0 +1,48 @@
+# --order-by-size:
+CREATE TABLE t1 (a MEDIUMBLOB) ENGINE=InnoDB;
+CREATE TABLE t2 (a MEDIUMBLOB) ENGINE=InnoDB;
+CREATE TABLE t3 (a MEDIUMBLOB) ENGINE=InnoDB;
+CREATE TABLE t4 (a MEDIUMBLOB) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (REPEAT('E',65536*4));
+INSERT INTO t2 VALUES (REPEAT('E',65536*3));
+INSERT INTO t3 VALUES (REPEAT('E',65536*2));
+INSERT INTO t4 VALUES (REPEAT('E',65536*1));
+ANALYZE TABLE t1, t2, t3, t4;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze Warning Engine-independent statistics are not collected for column 'a'
+test.t2 analyze status OK
+test.t3 analyze status Engine-independent statistics collected
+test.t3 analyze Warning Engine-independent statistics are not collected for column 'a'
+test.t3 analyze status OK
+test.t4 analyze status Engine-independent statistics collected
+test.t4 analyze Warning Engine-independent statistics are not collected for column 'a'
+test.t4 analyze status OK
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t4` (
+ `a` mediumblob DEFAULT NULL
+);
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t3` (
+ `a` mediumblob DEFAULT NULL
+);
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t2` (
+ `a` mediumblob DEFAULT NULL
+);
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `a` mediumblob DEFAULT NULL
+);
+/*!40101 SET character_set_client = @saved_cs_client */;
+DROP TABLE t4, t3, t2, t1;
diff --git a/mysql-test/main/mysqldump-order-by-size.test b/mysql-test/main/mysqldump-order-by-size.test
new file mode 100644
index 00000000000..d4df1e3e6e6
--- /dev/null
+++ b/mysql-test/main/mysqldump-order-by-size.test
@@ -0,0 +1,15 @@
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+--echo # --order-by-size:
+CREATE TABLE t1 (a MEDIUMBLOB) ENGINE=InnoDB;
+CREATE TABLE t2 (a MEDIUMBLOB) ENGINE=InnoDB;
+CREATE TABLE t3 (a MEDIUMBLOB) ENGINE=InnoDB;
+CREATE TABLE t4 (a MEDIUMBLOB) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (REPEAT('E',65536*4));
+INSERT INTO t2 VALUES (REPEAT('E',65536*3));
+INSERT INTO t3 VALUES (REPEAT('E',65536*2));
+INSERT INTO t4 VALUES (REPEAT('E',65536*1));
+ANALYZE TABLE t1, t2, t3, t4;
+--exec $MYSQL_DUMP --compact --skip-opt --skip-comments --no-data --order-by-size test
+DROP TABLE t4, t3, t2, t1;
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index 36295c7dee2..1c138e81b02 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -966,12 +966,14 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"ref_optimizer_key_uses": [
{
"table": "t1",
+ "index": "a",
"field": "a",
"equals": "t2.b + 2",
"null_rejecting": true
},
{
"table": "t2",
+ "index": "a",
"field": "a",
"equals": "t1.b",
"null_rejecting": true
@@ -1974,18 +1976,21 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"ref_optimizer_key_uses": [
{
"table": "t1",
+ "index": "a_c",
"field": "a",
"equals": "1",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "a_b",
"field": "a",
"equals": "1",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "a_b",
"field": "b",
"equals": "2",
"null_rejecting": true
@@ -2345,6 +2350,7 @@ select t1.a from t1 left join t2 on t1.a=t2.a {
"ref_optimizer_key_uses": [
{
"table": "t2",
+ "index": "PRIMARY",
"field": "a",
"equals": "t1.a",
"null_rejecting": true
@@ -2482,6 +2488,7 @@ explain select * from t1 left join t2 on t2.a=t1.a {
"ref_optimizer_key_uses": [
{
"table": "t2",
+ "index": "PRIMARY",
"field": "a",
"equals": "t1.a",
"null_rejecting": true
@@ -2668,24 +2675,28 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and
"ref_optimizer_key_uses": [
{
"table": "t2",
+ "index": "PRIMARY",
"field": "a",
"equals": "t1.a",
"null_rejecting": true
},
{
"table": "t2",
+ "index": "PRIMARY",
"field": "a",
"equals": "t3.a",
"null_rejecting": true
},
{
"table": "t3",
+ "index": "PRIMARY",
"field": "a",
"equals": "t2.a",
"null_rejecting": true
},
{
"table": "t3",
+ "index": "PRIMARY",
"field": "a",
"equals": "t1.a",
"null_rejecting": true
@@ -3182,36 +3193,42 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"ref_optimizer_key_uses": [
{
"table": "t1",
+ "index": "pk",
"field": "pk",
"equals": "2",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "pk_a",
"field": "pk",
"equals": "2",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "pk_a",
"field": "a",
"equals": "5",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "pk_a_b",
"field": "pk",
"equals": "2",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "pk_a_b",
"field": "a",
"equals": "5",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "pk_a_b",
"field": "b",
"equals": "1",
"null_rejecting": true
@@ -3860,12 +3877,14 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"ref_optimizer_key_uses": [
{
"table": "t0",
+ "index": "a",
"field": "a",
"equals": "t1.a",
"null_rejecting": true
},
{
"table": "t1",
+ "index": "a",
"field": "a",
"equals": "t0.a",
"null_rejecting": true
diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result
index b9c59c7a100..590b659f40d 100644
--- a/mysql-test/main/opt_trace_index_merge_innodb.result
+++ b/mysql-test/main/opt_trace_index_merge_innodb.result
@@ -75,6 +75,7 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"ref_optimizer_key_uses": [
{
"table": "t1",
+ "index": "key1",
"field": "key1",
"equals": "1",
"null_rejecting": false
diff --git a/mysql-test/main/partition_charset.result b/mysql-test/main/partition_charset.result
index f8f75e8bee7..a0019dd8fc3 100644
--- a/mysql-test/main/partition_charset.result
+++ b/mysql-test/main/partition_charset.result
@@ -20,3 +20,24 @@ create table t1 (a varchar(1), primary key (a))
partition by list (ascii(a))
(partition p1 values in (65));
ERROR HY000: This partition function is not allowed
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-30805 SIGSEGV in my_convert and UBSAN: member access within null pointer of type 'const struct MY_CHARSET_HANDLER' in my_convert
+#
+CREATE TABLE t1 (a CHAR CHARACTER SET ucs2)
+PARTITION BY RANGE COLUMNS (a)
+(PARTITION p0 VALUES LESS THAN ('a'));
+ALTER TABLE t1 CHANGE COLUMN a a CHAR BINARY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE COLUMNS(`a`)
+(PARTITION `p0` VALUES LESS THAN ('a') ENGINE = MyISAM)
+DROP TABLE t1;
+#
+# End of 10.9 tests
+#
diff --git a/mysql-test/main/partition_charset.test b/mysql-test/main/partition_charset.test
index 6842e5268fa..b8a17ce4fca 100644
--- a/mysql-test/main/partition_charset.test
+++ b/mysql-test/main/partition_charset.test
@@ -27,3 +27,23 @@ partition by list (ascii(a))
#insert into t1 values ('A');
#replace into t1 values ('A');
#drop table t1;
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-30805 SIGSEGV in my_convert and UBSAN: member access within null pointer of type 'const struct MY_CHARSET_HANDLER' in my_convert
+--echo #
+
+CREATE TABLE t1 (a CHAR CHARACTER SET ucs2)
+ PARTITION BY RANGE COLUMNS (a)
+ (PARTITION p0 VALUES LESS THAN ('a'));
+ALTER TABLE t1 CHANGE COLUMN a a CHAR BINARY;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.9 tests
+--echo #
+
diff --git a/mysql-test/main/partition_utf8-debug.result b/mysql-test/main/partition_utf8-debug.result
index db1396198ab..2b4982a3dcc 100644
--- a/mysql-test/main/partition_utf8-debug.result
+++ b/mysql-test/main/partition_utf8-debug.result
@@ -77,7 +77,7 @@ CREATE OR REPLACE TABLE t1 (a DATE) CHARACTER SET utf8
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (FROM_DAYS(100)));
Warnings:
Note 1003 PARTITION BY LIST COLUMNS(`a`)
-(PARTITION `p0` VALUES IN (_utf8mb3 0x303030302d30302d3030) ENGINE = MyISAM)
+(PARTITION `p0` VALUES IN (_latin1 0x303030302d30302d3030) ENGINE = MyISAM)
SELECT PARTITION_DESCRIPTION FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
PARTITION_DESCRIPTION
'0000-00-00'
diff --git a/mysql-test/main/show_analyze.result b/mysql-test/main/show_analyze.result
new file mode 100644
index 00000000000..56dac487117
--- /dev/null
+++ b/mysql-test/main/show_analyze.result
@@ -0,0 +1,435 @@
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+SET @old_debug= @@session.debug;
+set debug_sync='RESET';
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+alter table t1 add b int, add c int, add filler char(32);
+insert into t1 select A.a, 10*B.a, 100*C.a, 'foo filler' from t0 A, t0 B, t0 C;
+alter table t1 add key(a), add key(b);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status Table is already up to date
+show analyze for 1001;
+ERROR HY000: Unknown thread id: 1001
+show analyze for (select a from t0 limit 1);
+ERROR HY000: You may only use constant expressions in this statement
+connect con1, localhost, root,,;
+connection con1;
+SET @old_debug= @@session.debug;
+connection default;
+show analyze for $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+show analyze for $thr1;
+ERROR HY000: Target is not executing an operation with a query plan
+connection con1;
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select count(*) from t1 where c < 500;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 50.00 50.00 Using where
+Warnings:
+Note 1003 select count(*) from t1 where c < 500
+connection con1;
+count(*)
+500
+select max(c) from t1 where c < 10;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 1000.00 10.00 10.00 Using where
+Warnings:
+Note 1003 select max(c) from t1 where c < 10
+connection con1;
+max(c)
+0
+# We can catch ANALYZE too.
+analyze select max(c) from t1 where a < 10;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where
+Warnings:
+Note 1003 analyze select max(c) from t1 where a < 10
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where
+SET debug_dbug=@old_debug;
+# UNION, select, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION B ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+Warnings:
+Note 1003 select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9
+connection con1;
+max(a)
+5
+10
+# UNION, select, second branch
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+Warnings:
+Note 1003 select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9
+connection con1;
+max(a)
+5
+10
+# UNION, analyze, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION B ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+Warnings:
+Note 1003 analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL
+# UNION, analyze, second branch
+set @show_explain_probe_select_id=2;
+analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+Warnings:
+Note 1003 analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION B ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL
+SET debug_dbug=@old_debug;
+# Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select a, (select max(a) from t0 B where a>6) from t0 A where a<2;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 B where a>6) from t0 A where a<2
+connection con1;
+a (select max(a) from t0 B where a>6)
+0 9
+1 9
+SET debug_dbug=@old_debug;
+# Uncorrelated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+Warnings:
+Note 1003 analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+SET debug_dbug=@old_debug;
+# correlated subquery, select, before execution start
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+1 8
+SET debug_dbug=@old_debug;
+# correlated subquery, select, after execution
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+1 8
+SET debug_dbug=@old_debug;
+# correlated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where
+Warnings:
+Note 1003 analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where
+SET debug_dbug=@old_debug;
+# Try to do SHOW ANALYZE for a query that runs a SET command:
+#
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+show analyze for $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+kill query $thr2;
+connection con1;
+ERROR 70100: Query execution was interrupted
+SET debug_dbug=@old_debug;
+#
+# Attempt SHOW ANALYZE for an UPDATE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 1.00 100.00 0.00 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 2.00 100.00 0.00 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Attempt SHOW ANALYZE for a DELETE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 1.00 100.00 0.00 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 2.00 100.00 0.00 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Multiple SHOW ANALYZE calls for one select
+#
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 1.00 100.00 100.00
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 NULL 100.00 NULL Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 2.00 100.00 100.00
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 3.00 100.00 100.00
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 10.00 100.00 25.00 Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+connection con1;
+a SUBQ
+0 0
+1 0
+2 0
+SET debug_dbug=@old_debug;
+drop table t2;
+#
+# SHOW ANALYZE for SELECT ... ORDER BY with "Using filesort"
+#
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+select * from t0 order by a;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using filesort
+Warnings:
+Note 1003 select * from t0 order by a
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# SHOW ANALYZE for SELECT ... with "Using temporary"
+#
+connection con1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary
+Warnings:
+Note 1003 select distinct a from t0
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# SHOW ANALYZE for SELECT ... with "Using temporary; Using filesort"
+#
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+connection default;
+show analyze for $thr2;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 10.00 100.00 100.00 Using temporary
+Warnings:
+Note 1003 select distinct a from t0
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+drop table t0,t1;
+#
+# MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+# upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+#
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+SHOW ANALYZE FOR $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+connection con1;
+count(*) - count(*)
+0
+# End
+connection default;
+disconnect con1;
+set debug_sync='RESET';
+#
+# MDEV-28201: Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+#
+CREATE TABLE t1 ( a varchar(1));
+INSERT INTO t1 VALUES ('a'),('b');
+ANALYZE format=json
+SELECT 1 FROM t1 GROUP BY convert_tz('1969-12-31 22:00:00',a,'+10:00');
+ANALYZE
+{
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "filesort": {
+ "sort_key": "convert_tz('1969-12-31 22:00:00',t1.a,'+10:00')",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "r_used_priority_queue": false,
+ "r_output_rows": 1,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,rowid",
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 2,
+ "r_rows": 2,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ }
+}
+DROP TABLE t1;
diff --git a/mysql-test/main/show_analyze.test b/mysql-test/main/show_analyze.test
new file mode 100644
index 00000000000..9d59d5b2188
--- /dev/null
+++ b/mysql-test/main/show_analyze.test
@@ -0,0 +1,366 @@
+#
+# Tests for SHOW ANALYZE FOR functionality
+#
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+# Using valgrind can cause 'reap' to fail. See comment below
+--source include/not_valgrind.inc
+
+--disable_warnings
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+--enable_warnings
+SET @old_debug= @@session.debug;
+
+#
+# Testcases in this file do not work with embedded server. The reason for this
+# is that we use the following commands for synchronization:
+#
+# set @show_explain_probe_select_id=1;
+# SET debug_dbug='d,show_explain_probe_join_exec_start';
+# send select count(*) from t1 where a < 100000;
+#
+# When ran with mysqltest_embedded, this translates into:
+#
+# Thread1> DBUG_PUSH("d,show_explain_probe_join_exec_start");
+# Thread1> create another thread for doing "send ... reap"
+# Thread2> mysql_parse("select count(*) from t1 where a < 100000");
+#
+# That is, "select count(*) ..." is ran in a thread for which DBUG_PUSH(...)
+# has not been called. As a result, show_explain_probe_join_exec_start does not fire, and
+# "select count(*) ..." does not wait till its SHOW ANALYZE command, and the
+# test fails.
+#
+-- source include/not_embedded.inc
+
+set debug_sync='RESET';
+
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+alter table t1 add b int, add c int, add filler char(32);
+insert into t1 select A.a, 10*B.a, 100*C.a, 'foo filler' from t0 A, t0 B, t0 C;
+alter table t1 add key(a), add key(b);
+analyze table t1;
+
+#
+# Try SHOW ANALYZE for a non-existent thread
+#
+--error ER_NO_SUCH_THREAD
+show analyze for 1001;
+
+--error ER_SET_CONSTANTS_ONLY
+show analyze for (select a from t0 limit 1);
+
+#
+# Setup two threads and their ids
+#
+let $thr1=`select connection_id()`;
+connect (con1, localhost, root,,);
+connection con1;
+let $thr2=`select connection_id()`;
+SET @old_debug= @@session.debug;
+connection default;
+
+# SHOW ANALYZE FOR <idle thread>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show analyze for $thr2;
+
+# SHOW ANALYZE FOR <ourselves>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show analyze for $thr1;
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+
+#
+# Test SHOW ANALYZE for simple queries
+#
+connection con1;
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select count(*) from t1 where c < 500;
+
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+
+
+send select max(c) from t1 where c < 10;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+
+
+--echo # We can catch ANALYZE too.
+send analyze select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # UNION, select, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, select, second branch
+set @show_explain_probe_select_id=2; # <--- Second branch
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select max(a) from t0 A where a<=5 union select max(a+1) from t0 B where a>=9;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, analyze, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, analyze, second branch
+set @show_explain_probe_select_id=2;
+send analyze select a from t0 A where a<=5 union select a+1 from t0 B where a>=9;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select a, (select max(a) from t0 B where a>6) from t0 A where a<2;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Uncorrelated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send analyze select a, (select max(a) from t0 B where a>6) from t0 A where a<2;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # correlated subquery, select, before execution start
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # correlated subquery, select, after execution
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # correlated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Try to do SHOW ANALYZE for a query that runs a SET command:
+--echo #
+set @show_explain_probe_select_id=2; # <---
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show analyze for $thr2;
+evalp kill query $thr2;
+connection con1;
+--error ER_QUERY_INTERRUPTED
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Attempt SHOW ANALYZE for an UPDATE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Attempt SHOW ANALYZE for a DELETE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Multiple SHOW ANALYZE calls for one select
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+drop table t2;
+
+
+--echo #
+--echo # SHOW ANALYZE for SELECT ... ORDER BY with "Using filesort"
+--echo #
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+send select * from t0 order by a;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # SHOW ANALYZE for SELECT ... with "Using temporary"
+--echo #
+connection con1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # SHOW ANALYZE for SELECT ... with "Using temporary; Using filesort"
+--echo #
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+evalp show analyze for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+drop table t0,t1;
+
+--echo #
+--echo # MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+--echo # upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+--echo #
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+
+# Statement guarantees to produce 0 on every run
+send SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp SHOW ANALYZE FOR $thr2;
+
+connection con1;
+reap;
+
+--echo # End
+connection default;
+disconnect con1;
+set debug_sync='RESET';
+
+
+--echo #
+--echo # MDEV-28201: Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+--echo #
+CREATE TABLE t1 ( a varchar(1));
+INSERT INTO t1 VALUES ('a'),('b');
+--source include/analyze-format.inc
+ANALYZE format=json
+SELECT 1 FROM t1 GROUP BY convert_tz('1969-12-31 22:00:00',a,'+10:00');
+DROP TABLE t1;
+
diff --git a/mysql-test/main/show_analyze_json.result b/mysql-test/main/show_analyze_json.result
new file mode 100644
index 00000000000..dc8ae2aa66b
--- /dev/null
+++ b/mysql-test/main/show_analyze_json.result
@@ -0,0 +1,1242 @@
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+SET @old_debug= @@session.debug;
+set debug_sync='RESET';
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+alter table t1 add b int, add c int, add filler char(32);
+insert into t1 select A.a, 10*B.a, 100*C.a, 'foo filler' from t0 A, t0 B, t0 C;
+alter table t1 add key(a), add key(b);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status Table is already up to date
+show analyze format=JSON for;
+ERROR 42000: You 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
+show analyze format=json for 1001;
+ERROR HY000: Unknown thread id: 1001
+show analyze format=JSON for (select a from t0 limit 1);
+ERROR HY000: You may only use constant expressions in this statement
+connect con1, localhost, root,,;
+connection con1;
+SET @old_debug= @@session.debug;
+connection default;
+show analyze format = JSON for $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+show analyze format = json for $thr1;
+ERROR HY000: Target is not executing an operation with a query plan
+show analyze FORMAT=HTML for $thr1;
+ERROR HY000: Unknown EXPLAIN/ANALYZE format name: 'HTML'
+analyze FORMAT=XML for connection $thr1;
+ERROR HY000: Unknown EXPLAIN/ANALYZE format name: 'XML'
+connection con1;
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select count(*) from t1 where c < 500;
+connection default;
+show analyze format=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "filtered": 50,
+ "r_filtered": 50,
+ "attached_condition": "t1.c < 500"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select count(*) from t1 where c < 500
+connection con1;
+count(*)
+500
+select max(c) from t1 where c < 10;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "filtered": 10,
+ "r_filtered": 10,
+ "attached_condition": "t1.c < 10"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select max(c) from t1 where c < 10
+connection con1;
+max(c)
+0
+# We can catch ANALYZE too.
+analyze select max(c) from t1 where a < 10;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "ALL",
+ "possible_keys": ["a"],
+ "r_loops": 1,
+ "rows": 1000,
+ "r_rows": 1000,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 99.90000153,
+ "r_filtered": 100,
+ "attached_condition": "t1.a < 10"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 analyze select max(c) from t1 where a < 10
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 1000 1000.00 99.90 100.00 Using where
+SET debug_dbug=@old_debug;
+# UNION, select, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9;
+connection default;
+show analyze FORMAT= json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 60,
+ "attached_condition": "a.a <= 5"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "b.a >= 9"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9
+connection con1;
+max(a)
+5
+10
+# UNION, select, second branch
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9;
+connection default;
+show analyze format=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 60,
+ "attached_condition": "a.a <= 5"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 10,
+ "attached_condition": "b.a >= 9"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9
+connection con1;
+max(a)
+5
+10
+# UNION, analyze, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 60,
+ "attached_condition": "a.a <= 5"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "b.a >= 9"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION b ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL
+# UNION, analyze, second branch
+set @show_explain_probe_select_id=2;
+analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9;
+connection default;
+show analyze FORMAT=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "r_rows": null,
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 60,
+ "attached_condition": "a.a <= 5"
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 10,
+ "attached_condition": "b.a >= 9"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 60.00 Using where
+2 UNION b ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL 7.00 NULL NULL
+SET debug_dbug=@old_debug;
+# Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select a, (select max(a) from t0 b where a>6) from t0 a where a<2;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "a.a < 2"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "b.a > 6"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where a>6) from t0 a where a<2
+connection con1;
+a (select max(a) from t0 b where a>6)
+0 9
+1 9
+SET debug_dbug=@old_debug;
+# Uncorrelated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "a.a < 2"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "b.a > 6"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 30.00 Using where
+SET debug_dbug=@old_debug;
+# correlated subquery, select, before execution start
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "a.a < 2"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "state": "uninitialized",
+ "r_loops": 0,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "b.a + a.a < 10"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+1 8
+SET debug_dbug=@old_debug;
+# correlated subquery, select, after execution
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "a.a < 2"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 2,
+ "r_hit_ratio": 0,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 2,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 95,
+ "attached_condition": "b.a + a.a < 10"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+1 8
+SET debug_dbug=@old_debug;
+# correlated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 20,
+ "attached_condition": "a.a < 2"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 2,
+ "r_hit_ratio": 0,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 2,
+ "r_total_time_ms": "REPLACED",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "r_loops": 2,
+ "rows": 10,
+ "r_rows": 10,
+ "r_table_time_ms": "REPLACED",
+ "r_other_time_ms": "REPLACED",
+ "filtered": 100,
+ "r_filtered": 95,
+ "attached_condition": "b.a + a.a < 10"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2
+connection con1;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 10.00 100.00 20.00 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 10.00 100.00 95.00 Using where
+SET debug_dbug=@old_debug;
+# Try to do SHOW ANALYZE for a query that runs a SET command:
+#
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+show analyze format=json for $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+kill query $thr2;
+connection con1;
+ERROR 70100: Query execution was interrupted
+SET debug_dbug=@old_debug;
+#
+# Attempt SHOW ANALYZE for an UPDATE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+show analyze FORMAT=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "update": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "r_rows": 1,
+ "r_filtered": 0,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+show analyze FORMAT=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "update": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "r_rows": 2,
+ "r_filtered": 0,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Attempt SHOW ANALYZE for a DELETE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+show analyze FORMAT=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "delete": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "r_rows": 1,
+ "r_filtered": 0,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+show analyze FORMAT=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "delete": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "r_rows": 2,
+ "r_filtered": 0,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Multiple SHOW ANALYZE calls for one select
+#
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 1,
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 1,
+ "r_hit_ratio": 0,
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 0,
+ "rows": 10,
+ "r_rows": null,
+ "filtered": 100,
+ "r_filtered": null,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 2,
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 2,
+ "r_hit_ratio": 0,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 30,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 3,
+ "r_rows": 3,
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "r_loops": 3,
+ "r_hit_ratio": 0,
+ "query_block": {
+ "select_id": 2,
+ "r_loops": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 2,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 25,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+connection con1;
+a SUBQ
+0 0
+1 0
+2 0
+SET debug_dbug=@old_debug;
+drop table t2;
+#
+# SHOW ANALYZE for SELECT ... ORDER BY with "Using filesort"
+#
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+select * from t0 order by a;
+connection default;
+show analyze format=JSON for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "r_rows": 10,
+ "filesort": {
+ "sort_key": "t0.a",
+ "r_loops": 1,
+ "r_used_priority_queue": false,
+ "r_output_rows": 10,
+ "r_buffer_size": "REPLACED",
+ "r_sort_mode": "sort_key,addon_fields",
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select * from t0 order by a
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# SHOW ANALYZE for SELECT ... with "Using temporary"
+#
+connection con1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 select distinct a from t0
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# SHOW ANALYZE for SELECT ... with "Using temporary; Using filesort"
+#
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+connection default;
+show analyze format=json for $thr2;
+SHOW ANALYZE
+{
+ "r_query_time_in_progress_ms": "REPLACED",
+ "query_block": {
+ "select_id": 1,
+ "r_loops": 1,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "r_loops": 1,
+ "rows": 10,
+ "r_rows": 10,
+ "filtered": 100,
+ "r_filtered": 100
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 select distinct a from t0
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+drop table t0,t1;
+#
+# MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+# upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+#
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+SHOW ANALYZE FORMAT=JSON FOR $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+connection con1;
+count(*) - count(*)
+0
+# End
+connection default;
+disconnect con1;
+set debug_sync='RESET';
diff --git a/mysql-test/main/show_analyze_json.test b/mysql-test/main/show_analyze_json.test
new file mode 100644
index 00000000000..cd221854446
--- /dev/null
+++ b/mysql-test/main/show_analyze_json.test
@@ -0,0 +1,389 @@
+#
+# Tests for SHOW ANALYZE FORMAT=JSON FOR functionality
+#
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+# Using valgrind can cause 'reap' to fail. See comment below
+--source include/not_valgrind.inc
+
+--disable_warnings
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+--enable_warnings
+SET @old_debug= @@session.debug;
+
+#
+# Testcases in this file do not work with embedded server. The reason for this
+# is that we use the following commands for synchronization:
+#
+# set @show_explain_probe_select_id=1;
+# SET debug_dbug='d,show_explain_probe_join_exec_start';
+# send select count(*) from t1 where a < 100000;
+#
+# When ran with mysqltest_embedded, this translates into:
+#
+# Thread1> DBUG_PUSH("d,show_explain_probe_join_exec_start");
+# Thread1> create another thread for doing "send ... reap"
+# Thread2> mysql_parse("select count(*) from t1 where a < 100000");
+#
+# That is, "select count(*) ..." is ran in a thread for which DBUG_PUSH(...)
+# has not been called. As a result, show_explain_probe_join_exec_start does not fire, and
+# "select count(*) ..." does not wait till its SHOW ANALYZE command, and the
+# test fails.
+#
+-- source include/not_embedded.inc
+
+set debug_sync='RESET';
+
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+alter table t1 add b int, add c int, add filler char(32);
+insert into t1 select A.a, 10*B.a, 100*C.a, 'foo filler' from t0 A, t0 B, t0 C;
+alter table t1 add key(a), add key(b);
+analyze table t1;
+
+#
+# Try to call SHOW ANALYZE with a missing thread ID
+#
+--error ER_PARSE_ERROR
+show analyze format=JSON for;
+
+#
+# Try SHOW ANALYZE for a non-existent thread
+#
+--error ER_NO_SUCH_THREAD
+show analyze format=json for 1001;
+
+--error ER_SET_CONSTANTS_ONLY
+show analyze format=JSON for (select a from t0 limit 1);
+
+#
+# Setup two threads and their ids
+#
+let $thr1=`select connection_id()`;
+connect (con1, localhost, root,,);
+connection con1;
+let $thr2=`select connection_id()`;
+SET @old_debug= @@session.debug;
+connection default;
+
+# SHOW ANALYZE FOR <idle thread>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show analyze format = JSON for $thr2;
+
+# SHOW ANALYZE FOR <ourselves>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show analyze format = json for $thr1;
+
+# Not supported format of output
+--error ER_UNKNOWN_EXPLAIN_FORMAT
+evalp show analyze FORMAT=HTML for $thr1;
+
+--error ER_UNKNOWN_EXPLAIN_FORMAT
+evalp analyze FORMAT=XML for connection $thr1;
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+
+#
+# Test SHOW ANALYZE for simple queries
+#
+connection con1;
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select count(*) from t1 where c < 500;
+
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=JSON for $thr2;
+connection con1;
+reap;
+
+
+send select max(c) from t1 where c < 10;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+
+
+--echo # We can catch ANALYZE too.
+send analyze select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # UNION, select, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze FORMAT= json for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, select, second branch
+set @show_explain_probe_select_id=2; # <--- Second branch
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select max(a) from t0 a where a<=5 union select max(a+1) from t0 b where a>=9;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=JSON for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, analyze, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+
+
+--echo # UNION, analyze, second branch
+set @show_explain_probe_select_id=2;
+send analyze select a from t0 a where a<=5 union select a+1 from t0 b where a>=9;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze FORMAT=JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select a, (select max(a) from t0 b where a>6) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Uncorrelated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send analyze select a, (select max(a) from t0 b where a>6) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # correlated subquery, select, before execution start
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # correlated subquery, select, after execution
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # correlated subquery, analyze
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send analyze select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<2;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Try to do SHOW ANALYZE for a query that runs a SET command:
+--echo #
+set @show_explain_probe_select_id=2; # <---
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show analyze format=json for $thr2;
+evalp kill query $thr2;
+connection con1;
+--error ER_QUERY_INTERRUPTED
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Attempt SHOW ANALYZE for an UPDATE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze FORMAT=JSON for $thr2;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze FORMAT=JSON for $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Attempt SHOW ANALYZE for a DELETE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze FORMAT=JSON for $thr2;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze FORMAT=JSON for $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Multiple SHOW ANALYZE calls for one select
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+drop table t2;
+
+
+--echo #
+--echo # SHOW ANALYZE for SELECT ... ORDER BY with "Using filesort"
+--echo #
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+send select * from t0 order by a;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # SHOW ANALYZE for SELECT ... with "Using temporary"
+--echo #
+connection con1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # SHOW ANALYZE for SELECT ... with "Using temporary; Using filesort"
+--echo #
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+--source include/analyze-format.inc
+evalp show analyze format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+drop table t0,t1;
+
+--echo #
+--echo # MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+--echo # upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+--echo #
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+
+# Statement guarantees to produce 0 on every run
+send SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp SHOW ANALYZE FORMAT=JSON FOR $thr2;
+
+connection con1;
+reap;
+
+--echo # End
+connection default;
+disconnect con1;
+set debug_sync='RESET';
diff --git a/mysql-test/main/show_explain.result b/mysql-test/main/show_explain.result
index 6ad93930448..6bdc773aa4c 100644
--- a/mysql-test/main/show_explain.result
+++ b/mysql-test/main/show_explain.result
@@ -9,18 +9,30 @@ insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
alter table t1 add b int, add c int, add filler char(32);
update t1 set b=a, c=a, filler='fooo';
alter table t1 add key(a), add key(b);
+show explain for;
+ERROR 42000: You 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
+explain for connection;
+ERROR 42000: You 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
show explain for 2000000000;
ERROR HY000: Unknown thread id: 2000000000
+explain for connection 2000000000;
+ERROR HY000: Unknown thread id: 2000000000
show explain for (select max(a) from t0);
ERROR HY000: You may only use constant expressions in this statement
+explain for connection (select max(a) from t0);
+ERROR HY000: You may only use constant expressions in this statement
connect con1, localhost, root,,;
connection con1;
SET @old_debug= @@session.debug;
connection default;
show explain for $thr2;
-ERROR HY000: Target is not running an EXPLAINable command
+ERROR HY000: Target is not executing an operation with a query plan
+explain for connection $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
show explain for $thr1;
-ERROR HY000: Target is not running an EXPLAINable command
+ERROR HY000: Target is not executing an operation with a query plan
+explain for connection $thr1;
+ERROR HY000: Target is not executing an operation with a query plan
connection con1;
set @show_explain_probe_select_id=1;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
@@ -44,6 +56,16 @@ Note 1003 select max(c) from t1 where a < 10
connection con1;
max(c)
9
+select max(c) from t1 where a < 10;
+connection default;
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition
+Warnings:
+Note 1003 select max(c) from t1 where a < 10
+connection con1;
+max(c)
+9
# We can catch EXPLAIN, too.
set @show_expl_tmp= @@optimizer_switch;
set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
@@ -57,6 +79,17 @@ Note 1003 explain select max(c) from t1 where a < 10
connection con1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
+# Same for EXPLAIN FOR CONNECTION
+explain select max(c) from t1 where a < 10;
+connection default;
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
+Warnings:
+Note 1003 explain select max(c) from t1 where a < 10
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
set optimizer_switch= @show_expl_tmp;
SET debug_dbug=@old_debug;
# UNION, first branch
@@ -78,7 +111,7 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
SET debug_dbug=@old_debug;
# UNION, second branch
-set @show_explain_probe_select_id=1;
+set @show_explain_probe_select_id=2;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
connection default;
@@ -144,17 +177,18 @@ SET debug_dbug=@old_debug;
# correlated subquery, explain
set @show_explain_probe_select_id=1;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
-select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
Warnings:
-Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+Note 1003 explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
connection con1;
-a (select max(a) from t0 b where b.a+a.a<10)
-0 9
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
SET debug_dbug=@old_debug;
# correlated subquery, select, while inside the subquery
set @show_explain_probe_select_id=2;
@@ -209,7 +243,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
connection default;
show explain for $thr2;
-ERROR HY000: Target is not running an EXPLAINable command
+ERROR HY000: Target is not executing an operation with a query plan
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
@@ -235,6 +269,26 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
connection con1;
+#
+# EXPLAIN FOR CONNECTION for an UPDATE
+#
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
drop table t2;
SET debug_dbug=@old_debug;
#
@@ -261,6 +315,29 @@ connection con1;
drop table t2;
SET debug_dbug=@old_debug;
#
+# Attempt EXPLAIN FOR CONNECTION for a DELETE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
# Multiple SHOW EXPLAIN calls for one select
#
create table t2 as select a as a, a as dummy from t0 limit 3;
@@ -294,6 +371,39 @@ a SUBQ
drop table t2;
SET debug_dbug=@old_debug;
#
+# Multiple EXPLAIN FOR CONNECTION calls for one select
+#
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+explain for connection $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t0 ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+connection con1;
+a SUBQ
+0 0
+1 0
+2 0
+drop table t2;
+SET debug_dbug=@old_debug;
+#
# SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
#
explain select * from t0 order by a;
@@ -457,7 +567,7 @@ SET debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM v1, t2;
connection default;
show explain for $thr2;
-ERROR HY000: Target is not running an EXPLAINable command
+ERROR HY000: Target is not executing an operation with a query plan
kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
@@ -1311,6 +1421,20 @@ kill query $thr2;
connection con1;
ERROR 70100: Query execution was interrupted
drop table t0,t1,t2;
+#
+# MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+# upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+#
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+SHOW EXPLAIN FOR $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+connection con1;
+count(*) - count(*)
+0
# End
connection default;
disconnect con1;
diff --git a/mysql-test/main/show_explain.test b/mysql-test/main/show_explain.test
index 9ccf344a782..e6cf3971738 100644
--- a/mysql-test/main/show_explain.test
+++ b/mysql-test/main/show_explain.test
@@ -8,6 +8,7 @@
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_innodb.inc
+--source include/have_perfschema.inc
# Using valgrind can cause 'reap' to fail. See comment below
--source include/not_valgrind.inc
@@ -48,15 +49,34 @@ alter table t1 add b int, add c int, add filler char(32);
update t1 set b=a, c=a, filler='fooo';
alter table t1 add key(a), add key(b);
+
+#
+# Try to call SHOW EXPLAIN with a missing thread ID
+#
+--error ER_PARSE_ERROR
+show explain for;
+
+#
+# Also test MySQL-compatible syntax EXPLAIN FOR CONNECTION which was introduced for MDEV-10000
#
-# Try killing a non-existent thread
+--error ER_PARSE_ERROR
+explain for connection;
+
+#
+# Try to call SHOW EXPLAIN/EXPLAIN FOR CONNECTION for a non-existent thread
#
--error ER_NO_SUCH_THREAD
show explain for 2000000000;
+--error ER_NO_SUCH_THREAD
+explain for connection 2000000000;
+
--error ER_SET_CONSTANTS_ONLY
show explain for (select max(a) from t0);
+--error ER_SET_CONSTANTS_ONLY
+explain for connection (select max(a) from t0);
+
#
# Setup two threads and their ids
#
@@ -71,14 +91,20 @@ connection default;
--error ER_TARGET_NOT_EXPLAINABLE
evalp show explain for $thr2;
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp explain for connection $thr2;
+
# SHOW EXPLAIN FOR <ourselves>
--error ER_TARGET_NOT_EXPLAINABLE
evalp show explain for $thr1;
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp explain for connection $thr1;
+
let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
#
-# Test SHOW EXPLAIN for simple queries
+# Test SHOW EXPLAIN/EXPLAIN FOR CONNECTION for simple queries
#
connection con1;
set @show_explain_probe_select_id=1;
@@ -100,6 +126,14 @@ connection con1;
reap;
+send select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+connection con1;
+reap;
+
+
--echo # We can catch EXPLAIN, too.
set @show_expl_tmp= @@optimizer_switch;
set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
@@ -109,6 +143,14 @@ connection default;
evalp show explain for $thr2;
connection con1;
reap;
+
+--echo # Same for EXPLAIN FOR CONNECTION
+send explain select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+connection con1;
+reap;
set optimizer_switch= @show_expl_tmp;
SET debug_dbug=@old_debug;
@@ -125,7 +167,7 @@ SET debug_dbug=@old_debug;
--echo # UNION, second branch
-set @show_explain_probe_select_id=1;
+set @show_explain_probe_select_id=2;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
send explain select a from t0 A union select a+1 from t0 B;
connection default;
@@ -173,7 +215,7 @@ SET debug_dbug=@old_debug;
--echo # correlated subquery, explain
set @show_explain_probe_select_id=1;
SET debug_dbug='+d,show_explain_probe_join_exec_start';
-send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+send explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
connection default;
--source include/wait_condition.inc
evalp show explain for $thr2;
@@ -253,9 +295,25 @@ evalp show explain for $thr2;
evalp show explain for $thr2;
connection con1;
reap;
+
+
+--echo #
+--echo # EXPLAIN FOR CONNECTION for an UPDATE
+--echo #
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+connection con1;
+reap;
drop table t2;
SET debug_dbug=@old_debug;
+
--echo #
--echo # Attempt SHOW EXPLAIN for a DELETE (UPD: now works)
--echo #
@@ -276,6 +334,23 @@ drop table t2;
SET debug_dbug=@old_debug;
--echo #
+--echo # Attempt EXPLAIN FOR CONNECTION for a DELETE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+--echo #
--echo # Multiple SHOW EXPLAIN calls for one select
--echo #
create table t2 as select a as a, a as dummy from t0 limit 3;
@@ -294,6 +369,26 @@ reap;
drop table t2;
SET debug_dbug=@old_debug;
+
+--echo #
+--echo # Multiple EXPLAIN FOR CONNECTION calls for one select
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+--source include/wait_condition.inc
+evalp explain for connection $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
--echo #
--echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
--echo #
@@ -1214,6 +1309,26 @@ reap;
drop table t0,t1,t2;
+--echo #
+--echo # MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+--echo # upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+--echo #
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+
+# Statement guarantees to produce 0 on every run
+send SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp SHOW EXPLAIN FOR $thr2;
+
+connection con1;
+reap;
+
--echo # End
connection default;
disconnect con1;
diff --git a/mysql-test/main/show_explain_json.result b/mysql-test/main/show_explain_json.result
new file mode 100644
index 00000000000..a5c441af5b8
--- /dev/null
+++ b/mysql-test/main/show_explain_json.result
@@ -0,0 +1,1308 @@
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+SET @old_debug= @@session.debug;
+set debug_sync='RESET';
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
+alter table t1 add b int, add c int, add filler char(32);
+update t1 set b=a, c=a, filler='fooo';
+alter table t1 add key(a), add key(b);
+show explain format=JSON for;
+ERROR 42000: You 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
+explain format=JSON for connection;
+ERROR 42000: You 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
+show explain FORMAT=json for 123456789;
+ERROR HY000: Unknown thread id: 123456789
+explain FORMAT=json for connection 123456789;
+ERROR HY000: Unknown thread id: 123456789
+show explain FORMAT=json for (select max(a) from t0);
+ERROR HY000: You may only use constant expressions in this statement
+explain FORMAT=json for connection (select max(a) from t0);
+ERROR HY000: You may only use constant expressions in this statement
+connect con1, localhost, root,,;
+connection con1;
+SET @old_debug= @@session.debug;
+connection default;
+show explain format=JSON for $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+explain format=json for connection $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+show explain format=json for $thr1;
+ERROR HY000: Target is not executing an operation with a query plan
+explain FORMAT=JSON for connection $thr1;
+ERROR HY000: Target is not executing an operation with a query plan
+show explain FORMAT=HTML for $thr1;
+ERROR HY000: Unknown EXPLAIN/ANALYZE format name: 'HTML'
+explain FORMAT=XML for connection $thr1;
+ERROR HY000: Unknown EXPLAIN/ANALYZE format name: 'XML'
+connection con1;
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select count(*) from t1 where a < 100000;
+connection default;
+show explain FORMAT=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 999,
+ "filtered": 100,
+ "attached_condition": "t1.a < 100000",
+ "using_index": true
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select count(*) from t1 where a < 100000
+connection con1;
+count(*)
+1000
+select max(c) from t1 where a < 10;
+connection default;
+explain FORMAT=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 10,
+ "filtered": 100,
+ "index_condition": "t1.a < 10"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select max(c) from t1 where a < 10
+connection con1;
+max(c)
+9
+select max(c) from t1 where a < 10;
+connection default;
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 10,
+ "filtered": 100,
+ "index_condition": "t1.a < 10"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select max(c) from t1 where a < 10
+connection con1;
+max(c)
+9
+# We can catch EXPLAIN, too.
+set @show_expl_tmp= @@optimizer_switch;
+set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
+explain select max(c) from t1 where a < 10;
+connection default;
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 10,
+ "filtered": 100,
+ "index_condition": "t1.a < 10",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 explain select max(c) from t1 where a < 10
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
+# Same for EXPLAIN FOR CONNECTION
+explain select max(c) from t1 where a < 10;
+connection default;
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["a"],
+ "key": "a",
+ "key_length": "5",
+ "used_key_parts": ["a"],
+ "rows": 10,
+ "filtered": 100,
+ "index_condition": "t1.a < 10",
+ "mrr_type": "Rowid-ordered scan"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 explain select max(c) from t1 where a < 10
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
+set optimizer_switch= @show_expl_tmp;
+SET debug_dbug=@old_debug;
+# UNION, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+explain select a from t0 A union select a+1 from t0 B;
+connection default;
+show explain format = JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "A",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "B",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 explain select a from t0 A union select a+1 from t0 B
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 UNION B ALL NULL NULL NULL NULL 10
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+SET debug_dbug=@old_debug;
+# UNION, second branch
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+explain select a from t0 A union select a+1 from t0 B;
+connection default;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "union_result": {
+ "table_name": "<union1,2>",
+ "access_type": "ALL",
+ "query_specifications": [
+ {
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "A",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ },
+ {
+ "query_block": {
+ "select_id": 2,
+ "operation": "UNION",
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "B",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 explain select a from t0 A union select a+1 from t0 B
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10
+2 UNION B ALL NULL NULL NULL NULL 10
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
+SET debug_dbug=@old_debug;
+# Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10
+Warnings:
+Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1
+connection con1;
+a (select max(a) from t0 B)
+0 9
+SET debug_dbug=@old_debug;
+# Uncorrelated subquery, explain
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+explain select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10
+Warnings:
+Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
+2 SUBQUERY B ALL NULL NULL NULL NULL 10
+SET debug_dbug=@old_debug;
+# correlated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+SET debug_dbug=@old_debug;
+# correlated subquery, explain
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+show explain for $thr2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+Warnings:
+Note 1003 explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY a ALL NULL NULL NULL NULL 10 Using where
+2 DEPENDENT SUBQUERY b ALL NULL NULL NULL NULL 10 Using where
+SET debug_dbug=@old_debug;
+# correlated subquery, select, while inside the subquery
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "a.a < 1"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "b.a + a.a < 10"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+SET debug_dbug=@old_debug;
+# correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "a.a < 1"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "b.a + a.a < 10"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+SET debug_dbug=@old_debug;
+# correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "a",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "a.a < 1"
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "b",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "b.a + a.a < 10"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
+connection con1;
+a (select max(a) from t0 b where b.a+a.a<10)
+0 9
+SET debug_dbug=@old_debug;
+# Try to do SHOW EXPLAIN for a query that runs a SET command:
+# I've found experimentally that select_id==2 here...
+#
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+show explain format=JSON for $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+kill query $thr2;
+connection con1;
+ERROR 70100: Query execution was interrupted
+SET debug_dbug=@old_debug;
+#
+# Attempt SHOW EXPLAIN for an UPDATE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "update": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "update": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+#
+# EXPLAIN FOR CONNECTION for an UPDATE
+#
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "update": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "update": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Attempt SHOW EXPLAIN for a DELETE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "delete": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "delete": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Attempt EXPLAIN FOR CONNECTION for a DELETE
+#
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "delete": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "delete": 1,
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 2,
+ "attached_condition": "(subquery#2) > 3"
+ },
+ "subqueries": [
+ {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3
+connection con1;
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Multiple SHOW EXPLAIN calls for one select
+#
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+connection con1;
+a SUBQ
+0 0
+1 0
+2 0
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# Multiple EXPLAIN FOR CONNECTION calls for one select
+#
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+explain format=JSON for connection $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t2",
+ "access_type": "ALL",
+ "rows": 3,
+ "filtered": 100
+ }
+ }
+ ],
+ "subqueries": [
+ {
+ "expression_cache": {
+ "query_block": {
+ "select_id": 2,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t2.a + t0.a < 3"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2
+connection con1;
+a SUBQ
+0 0
+1 0
+2 0
+drop table t2;
+SET debug_dbug=@old_debug;
+#
+# SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
+#
+explain select * from t0 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+select * from t0 order by a;
+connection default;
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "read_sorted_file": {
+ "filesort": {
+ "sort_key": "t0.a",
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select * from t0 order by a
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# SHOW EXPLAIN for SELECT ... with "Using temporary"
+#
+connection default;
+explain select distinct a from t0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+connection con1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+connection default;
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 select distinct a from t0
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
+#
+connection default;
+explain select distinct a from t0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
+connection con1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+select distinct a from t0;
+connection default;
+show explain format=json for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "temporary_table": {
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100
+ }
+ }
+ ]
+ }
+ }
+}
+Warnings:
+Note 1003 select distinct a from t0
+connection con1;
+a
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SET debug_dbug=@old_debug;
+#
+# Check if queries in non-default charsets work.
+#
+set names cp1251;
+select charset('ãû');
+charset('ãû')
+cp1251
+select hex('ãû');
+hex('ãû')
+E3FB
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+select * from t0 where length('ãû') = a;
+connection default;
+set names utf8;
+show explain format=JSON for $thr2;
+SHOW EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t0",
+ "access_type": "ALL",
+ "rows": 10,
+ "filtered": 100,
+ "attached_condition": "t0.a = <cache>(octet_length('гы'))"
+ }
+ }
+ ]
+ }
+}
+Warnings:
+Note 1003 select * from t0 where length('гы') = a
+set names default;
+connection con1;
+a
+2
+SET debug_dbug=@old_debug;
+set names default;
+drop table if exists t0,t1,t2;
+Warnings:
+Note 1051 Unknown table 'test.t2'
+#
+# MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+# upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+#
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+SHOW EXPLAIN FORMAT=JSON FOR $thr2;
+ERROR HY000: Target is not executing an operation with a query plan
+connection con1;
+count(*) - count(*)
+0
+# End
+connection default;
+disconnect con1;
+set debug_sync='RESET';
diff --git a/mysql-test/main/show_explain_json.test b/mysql-test/main/show_explain_json.test
new file mode 100644
index 00000000000..8d2a6aa82bb
--- /dev/null
+++ b/mysql-test/main/show_explain_json.test
@@ -0,0 +1,502 @@
+#
+# Tests for SHOW EXPLAIN FORMAT=JSON FOR functionality.
+# FORMAT=JSON is essential here, tests for traditional SHOW EXPLAIN FOR
+# can be found at show_explain.test
+#
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+# Using valgrind can cause 'reap' to fail. See comment below
+--source include/not_valgrind.inc
+
+--disable_warnings
+drop table if exists t0, t1, t2, t3, t4;
+drop view if exists v1;
+--enable_warnings
+SET @old_debug= @@session.debug;
+
+#
+# Testcases in this file do not work with embedded server. The reason for this
+# is that we use the following commands for synchronization:
+#
+# set @show_explain_probe_select_id=1;
+# SET debug_dbug='d,show_explain_probe_join_exec_start';
+# send select count(*) from t1 where a < 100000;
+#
+# When ran with mysqltest_embedded, this translates into:
+#
+# Thread1> DBUG_PUSH("d,show_explain_probe_join_exec_start");
+# Thread1> create another thread for doing "send ... reap"
+# Thread2> mysql_parse("select count(*) from t1 where a < 100000");
+#
+# That is, "select count(*) ..." is ran in a thread for which DBUG_PUSH(...)
+# has not been called. As a result, show_explain_probe_join_exec_start does not fire, and
+# "select count(*) ..." does not wait till its SHOW EXPLAIN command, and the
+# test fails.
+#
+-- source include/not_embedded.inc
+
+set debug_sync='RESET';
+
+create table t0 (a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int);
+insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
+alter table t1 add b int, add c int, add filler char(32);
+update t1 set b=a, c=a, filler='fooo';
+alter table t1 add key(a), add key(b);
+
+
+#
+# Try to call SHOW EXPLAIN with a missing thread ID
+#
+--error ER_PARSE_ERROR
+show explain format=JSON for;
+
+#
+# Also test MySQL-compatible syntax EXPLAIN FOR CONNECTION which was introduced for MDEV-10000
+#
+--error ER_PARSE_ERROR
+explain format=JSON for connection;
+
+#
+# Try to call SHOW EXPLAIN/EXPLAIN FOR CONNECTION for a non-existent thread
+#
+--error ER_NO_SUCH_THREAD
+show explain FORMAT=json for 123456789;
+
+--error ER_NO_SUCH_THREAD
+explain FORMAT=json for connection 123456789;
+
+--error ER_SET_CONSTANTS_ONLY
+show explain FORMAT=json for (select max(a) from t0);
+
+--error ER_SET_CONSTANTS_ONLY
+explain FORMAT=json for connection (select max(a) from t0);
+
+#
+# Setup two threads and their ids
+#
+let $thr1=`select connection_id()`;
+connect (con1, localhost, root,,);
+connection con1;
+let $thr2=`select connection_id()`;
+SET @old_debug= @@session.debug;
+connection default;
+
+# SHOW EXPLAIN FOR <idle thread>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain format=JSON for $thr2;
+
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp explain format=json for connection $thr2;
+
+# SHOW EXPLAIN FOR <ourselves>
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain format=json for $thr1;
+
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp explain FORMAT=JSON for connection $thr1;
+
+# Not supported format of output
+--error ER_UNKNOWN_EXPLAIN_FORMAT
+evalp show explain FORMAT=HTML for $thr1;
+
+--error ER_UNKNOWN_EXPLAIN_FORMAT
+evalp explain FORMAT=XML for connection $thr1;
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+
+#
+# Test SHOW EXPLAIN/EXPLAIN FOR CONNECTION for simple queries
+#
+connection con1;
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select count(*) from t1 where a < 100000;
+
+connection default;
+--source include/wait_condition.inc
+evalp show explain FORMAT=JSON for $thr2;
+connection con1;
+reap;
+
+
+send select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp explain FORMAT=JSON for connection $thr2;
+connection con1;
+reap;
+
+
+send select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+connection con1;
+reap;
+
+
+--echo # We can catch EXPLAIN, too.
+set @show_expl_tmp= @@optimizer_switch;
+set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
+send explain select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+connection con1;
+reap;
+
+--echo # Same for EXPLAIN FOR CONNECTION
+send explain select max(c) from t1 where a < 10;
+connection default;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+connection con1;
+reap;
+set optimizer_switch= @show_expl_tmp;
+SET debug_dbug=@old_debug;
+
+--echo # UNION, first branch
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send explain select a from t0 A union select a+1 from t0 B;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format = JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # UNION, second branch
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send explain select a from t0 A union select a+1 from t0 B;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Uncorrelated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo # Uncorrelated subquery, explain
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send explain select a, (select max(a) from t0 B) from t0 A where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo # correlated subquery, select
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo # correlated subquery, explain
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send explain select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo # correlated subquery, select, while inside the subquery
+set @show_explain_probe_select_id=2; # <---
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo # correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo # correlated subquery, explain, while inside the subquery
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_end';
+send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+# TODO: explain in the parent subuqery when the un-correlated child has been
+# run (and have done irreversible cleanups)
+# ^^ Is this at all possible after 5.3?
+# Maybe, for 5.3 try this:
+# - run before/after the parent has invoked child's optimization
+# - run after materialization
+
+--echo # Try to do SHOW EXPLAIN for a query that runs a SET command:
+--echo # I've found experimentally that select_id==2 here...
+--echo #
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send set @foo= (select max(a) from t0 where sin(a) >0);
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp show explain format=JSON for $thr2;
+evalp kill query $thr2;
+connection con1;
+--error ER_QUERY_INTERRUPTED
+reap;
+SET debug_dbug=@old_debug;
+
+--echo #
+--echo # Attempt SHOW EXPLAIN for an UPDATE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+connection con1;
+reap;
+
+
+--echo #
+--echo # EXPLAIN FOR CONNECTION for an UPDATE
+--echo #
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Attempt SHOW EXPLAIN for a DELETE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+--echo #
+--echo # Attempt EXPLAIN FOR CONNECTION for a DELETE
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 2;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
+connection default;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+--echo #
+--echo # Multiple SHOW EXPLAIN calls for one select
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Multiple EXPLAIN FOR CONNECTION calls for one select
+--echo #
+create table t2 as select a as a, a as dummy from t0 limit 3;
+set @show_explain_probe_select_id=2;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
+connection default;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+--source include/wait_condition.inc
+evalp explain format=JSON for connection $thr2;
+connection con1;
+reap;
+drop table t2;
+SET debug_dbug=@old_debug;
+
+--echo #
+--echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
+--echo #
+explain select * from t0 order by a;
+
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+send select * from t0 order by a;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo #
+--echo # SHOW EXPLAIN for SELECT ... with "Using temporary"
+--echo #
+connection default;
+explain select distinct a from t0;
+connection con1;
+
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+--echo #
+--echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
+--echo #
+connection default;
+explain select distinct a from t0;
+connection con1;
+
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+set @show_explain_probe_select_id=1;
+
+send select distinct a from t0;
+connection default;
+--source include/wait_condition.inc
+evalp show explain format=json for $thr2;
+connection con1;
+reap;
+SET debug_dbug=@old_debug;
+
+
+--echo #
+--echo # Check if queries in non-default charsets work.
+--echo #
+
+--disable_service_connection
+
+set names cp1251;
+# The below are two Russian letters with codes E3FB in cp1251 encoding.
+select charset('ãû');
+select hex('ãû');
+
+set @show_explain_probe_select_id=1;
+SET debug_dbug='+d,show_explain_probe_join_exec_start';
+
+send
+select * from t0 where length('ãû') = a;
+
+connection default;
+set names utf8;
+--source include/wait_condition.inc
+evalp show explain format=JSON for $thr2;
+set names default;
+
+connection con1;
+# The constant should be two letters, the last looking like 'bl'
+reap;
+
+SET debug_dbug=@old_debug;
+set names default;
+
+drop table if exists t0,t1,t2;
+
+--enable_service_connection
+
+--echo #
+--echo # MDEV-28124: Server crashes in Explain_aggr_filesort::print_json_members
+--echo # upon SHOW ANALYZE/EXPLAIN FORMAT=JSON
+--echo #
+
+let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
+connection con1;
+set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
+set debug_dbug='+d,explain_notify_tables_are_closed';
+
+# Statement guarantees to produce 0 on every run
+send SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;
+connection default;
+--source include/wait_condition.inc
+--error ER_TARGET_NOT_EXPLAINABLE
+evalp SHOW EXPLAIN FORMAT=JSON FOR $thr2;
+
+connection con1;
+reap;
+
+--echo # End
+connection default;
+disconnect con1;
+set debug_sync='RESET';
+
diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test
index 2bbdb54b9c8..827037c6d5f 100644
--- a/mysql-test/main/subselect4.test
+++ b/mysql-test/main/subselect4.test
@@ -2601,3 +2601,4 @@ select * from t1 where t1.a in (select t2.a from t2 order by t2.b);
drop table t0, t1, t2;
--echo # End of 10.4 tests
+
diff --git a/mysql-test/main/type_blob.result b/mysql-test/main/type_blob.result
index e5ffb898a93..851d0bd72d4 100644
--- a/mysql-test/main/type_blob.result
+++ b/mysql-test/main/type_blob.result
@@ -908,6 +908,8 @@ a
2042
DROP TABLE b15776;
CREATE TABLE b15776 (a year(4294967296));
+Warnings:
+Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE b15776;
Table Create Table
b15776 CREATE TABLE `b15776` (
@@ -921,11 +923,11 @@ DROP TABLE b15776;
CREATE TABLE b15776 (a year(-2));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2))' at line 1
CREATE TABLE b15776 (a timestamp(4294967294));
-ERROR 42000: Too big precision 4294967294 specified for 'a'. Maximum is 6
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
CREATE TABLE b15776 (a timestamp(4294967295));
-ERROR 42000: Too big precision 4294967295 specified for 'a'. Maximum is 6
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
CREATE TABLE b15776 (a timestamp(4294967296));
-ERROR 42000: Too big precision 4294967296 specified for 'a'. Maximum is 6
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
CREATE TABLE b15776 (a timestamp(-1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1))' at line 1
CREATE TABLE b15776 (a timestamp(-2));
@@ -935,6 +937,8 @@ ERROR 42000: Display width out of range for 'a' (max = 255)
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+Warnings:
+Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
SHOW CREATE TABLE b15776;
Table Create Table
b15776 CREATE TABLE `b15776` (
diff --git a/mysql-test/main/type_blob.test b/mysql-test/main/type_blob.test
index c61ed124139..f958a055b6c 100644
--- a/mysql-test/main/type_blob.test
+++ b/mysql-test/main/type_blob.test
@@ -532,7 +532,9 @@ CREATE TABLE b15776 (a year(4294967295));
INSERT INTO b15776 VALUES (42);
SELECT * FROM b15776;
DROP TABLE b15776;
+--enable_prepare_warnings
CREATE TABLE b15776 (a year(4294967296));
+--disable_prepare_warnings
SHOW CREATE TABLE b15776;
DROP TABLE b15776;
--enable_prepare_warnings
@@ -560,7 +562,9 @@ CREATE TABLE b15776 (a timestamp(-2));
CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
--error ER_TOO_BIG_FIELDLENGTH
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+--enable_prepare_warnings
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+--disable_prepare_warnings
SHOW CREATE TABLE b15776;
DROP TABLE b15776;
diff --git a/mysql-test/main/type_datetime_hires.result b/mysql-test/main/type_datetime_hires.result
index bec5d5be415..db0e1cae334 100644
--- a/mysql-test/main/type_datetime_hires.result
+++ b/mysql-test/main/type_datetime_hires.result
@@ -1,7 +1,7 @@
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
drop table if exists t1, t2, t3;
create table t1 (a datetime(7));
-ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
create table t1 (a datetime(3), key(a));
insert t1 values ('2010-12-11 00:20:03.1234');
insert t1 values ('2010-12-11 15:47:11.1234');
diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result
index 3643dbea272..b2853f18f1c 100644
--- a/mysql-test/main/type_decimal.result
+++ b/mysql-test/main/type_decimal.result
@@ -721,7 +721,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (d decimal(66,0));
-ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65
+ERROR 42000: Too big precision specified for 'd'. Maximum is 65
CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2));
INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
(2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result
index 500f906642d..ddb80bf24e8 100644
--- a/mysql-test/main/type_float.result
+++ b/mysql-test/main/type_float.result
@@ -133,7 +133,7 @@ min(a)
-0.010
drop table t1;
create table t1 (a float(200,100), b double(200,100));
-ERROR 42000: Too big scale 100 specified for 'a'. Maximum is 30
+ERROR 42000: Too big scale specified for 'a'. Maximum is 30
create table t1 (c20 char);
insert ignore into t1 values (5000.0);
Warnings:
@@ -788,7 +788,7 @@ DROP TABLE t1,t2;
#
create or replace table t1 (a double(40,30));
create or replace table t1 (a double(40,31));
-ERROR 42000: Too big scale 31 specified for 'a'. Maximum is 30
+ERROR 42000: Too big scale specified for 'a'. Maximum is 30
create or replace table t1 as select 1.01e1;
show create table t1;
Table Create Table
@@ -1169,3 +1169,36 @@ fdec 123.456.789,12345678900000000000000000000000000000
#
# End of 10.4 tests
#
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
+#
+CREATE TABLE t1 (a DOUBLE(1000,1000));
+ERROR 42000: Too big scale specified for 'a'. Maximum is 30
+CREATE TABLE t1 (a DOUBLE(1000,0));
+ERROR 42000: Display width out of range for 'a' (max = 255)
+CREATE TABLE t1 (a DOUBLE(0,1000));
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a')
+CREATE TABLE t1 (a DOUBLE(2147483647,2147483647));
+ERROR 42000: Too big scale specified for 'a'. Maximum is 30
+CREATE TABLE t1 (a DOUBLE(2147483647,0));
+ERROR 42000: Display width out of range for 'a' (max = 255)
+CREATE TABLE t1 (a DOUBLE(0,2147483647));
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a')
+CREATE TABLE t1 (a DOUBLE(2147483648,2147483648));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2147483648,2147483648))' at line 1
+CREATE TABLE t1 (a DOUBLE(2147483648,0));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2147483648,0))' at line 1
+CREATE TABLE t1 (a DOUBLE(0,2147483648));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2147483648))' at line 1
+CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,999999999999999999999999999999));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '999999999999999999999999999999,999999999999999999999999999999))' at line 1
+CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,0));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '999999999999999999999999999999,0))' at line 1
+CREATE TABLE t1 (a DOUBLE(0,999999999999999999999999999999));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '999999999999999999999999999999))' at line 1
+#
+# End of 10.9 tests
+#
diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test
index 7516508ac3c..6a1636cf9b9 100644
--- a/mysql-test/main/type_float.test
+++ b/mysql-test/main/type_float.test
@@ -719,3 +719,44 @@ DELIMITER ;$$
--echo #
--echo # End of 10.4 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
+--echo #
+
+--error ER_TOO_BIG_SCALE
+CREATE TABLE t1 (a DOUBLE(1000,1000));
+--error ER_TOO_BIG_DISPLAYWIDTH
+CREATE TABLE t1 (a DOUBLE(1000,0));
+--error ER_M_BIGGER_THAN_D
+CREATE TABLE t1 (a DOUBLE(0,1000));
+
+--error ER_TOO_BIG_SCALE
+CREATE TABLE t1 (a DOUBLE(2147483647,2147483647));
+--error ER_TOO_BIG_DISPLAYWIDTH
+CREATE TABLE t1 (a DOUBLE(2147483647,0));
+--error ER_M_BIGGER_THAN_D
+CREATE TABLE t1 (a DOUBLE(0,2147483647));
+
+--error ER_PARSE_ERROR
+CREATE TABLE t1 (a DOUBLE(2147483648,2147483648));
+--error ER_PARSE_ERROR
+CREATE TABLE t1 (a DOUBLE(2147483648,0));
+--error ER_PARSE_ERROR
+CREATE TABLE t1 (a DOUBLE(0,2147483648));
+
+--error ER_PARSE_ERROR
+CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,999999999999999999999999999999));
+--error ER_PARSE_ERROR
+CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,0));
+--error ER_PARSE_ERROR
+CREATE TABLE t1 (a DOUBLE(0,999999999999999999999999999999));
+
+--echo #
+--echo # End of 10.9 tests
+--echo #
diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result
index 1aa8c28b44a..d42de5b7e0d 100644
--- a/mysql-test/main/type_newdecimal.result
+++ b/mysql-test/main/type_newdecimal.result
@@ -923,13 +923,13 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column
select cast(ln(14000) as decimal(2,3)) c1;
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
create table t1 (sl decimal(70,30));
-ERROR 42000: Too big precision 70 specified for 'sl'. Maximum is 65
+ERROR 42000: Too big precision specified for 'sl'. Maximum is 65
create table t1 (sl decimal(32,39));
-ERROR 42000: Too big scale 39 specified for 'sl'. Maximum is 38
+ERROR 42000: Too big scale specified for 'sl'. Maximum is 38
create table t1 (sl decimal(67,38));
-ERROR 42000: Too big precision 67 specified for 'sl'. Maximum is 65
+ERROR 42000: Too big precision specified for 'sl'. Maximum is 65
create table t1 (sl decimal(0,50));
-ERROR 42000: Too big scale 50 specified for 'sl'. Maximum is 38
+ERROR 42000: Too big scale specified for 'sl'. Maximum is 38
create table t1 (sl decimal(0,30));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl')
create table t1 (sl decimal(5, 5));
@@ -1482,12 +1482,12 @@ SELECT CAST(1 AS decimal(65,10));
CAST(1 AS decimal(65,10))
1.0000000000
SELECT CAST(1 AS decimal(66,10));
-ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
+ERROR 42000: Too big precision specified for '1'. Maximum is 65
SELECT CAST(1 AS decimal(65,38));
CAST(1 AS decimal(65,38))
1.00000000000000000000000000000000000000
SELECT CAST(1 AS decimal(65,39));
-ERROR 42000: Too big scale 39 specified for '1'. Maximum is 38
+ERROR 42000: Too big scale specified for '1'. Maximum is 38
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
@@ -1496,7 +1496,7 @@ aa SUM(b)
3.000000000000000000000000000000 10
4.000000000000000000000000000000 30
SELECT a+CAST(1 AS decimal(65,49)) AS aa, SUM(b) FROM t1 GROUP BY aa;
-ERROR 42000: Too big scale 49 specified for '1'. Maximum is 38
+ERROR 42000: Too big scale specified for '1'. Maximum is 38
DROP TABLE t1;
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
diff --git a/mysql-test/main/type_time_hires.result b/mysql-test/main/type_time_hires.result
index ed00a8d473d..a5270c98c24 100644
--- a/mysql-test/main/type_time_hires.result
+++ b/mysql-test/main/type_time_hires.result
@@ -1,7 +1,7 @@
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
drop table if exists t1, t2, t3;
create table t1 (a time(7));
-ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
create table t1 (a time(3), key(a));
insert t1 values ('2010-12-11 00:20:03.1234');
Warnings:
@@ -918,3 +918,24 @@ drop table t1;
#
# End of 10.4 tests
#
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
+#
+CREATE TABLE t1 (a TIME(4294967295));
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
+CREATE TABLE t1 (a TIME(4294967296));
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
+CREATE TABLE t1 (a TIME(999999999999999999999999999999));
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
+SELECT CAST(1 AS TIME(4294967295));
+ERROR 42000: Too big precision specified for '1'. Maximum is 6
+SELECT CAST(1 AS TIME(4294967296));
+ERROR 42000: Too big precision specified for '1'. Maximum is 6
+SELECT CAST(1 AS TIME(999999999999999999999999999999));
+ERROR 42000: Too big precision specified for '1'. Maximum is 6
+#
+# Start of 10.9 tests
+#
diff --git a/mysql-test/main/type_time_hires.test b/mysql-test/main/type_time_hires.test
index 51824c689ad..35463c3b36b 100644
--- a/mysql-test/main/type_time_hires.test
+++ b/mysql-test/main/type_time_hires.test
@@ -207,3 +207,30 @@ drop table t1;
--echo #
--echo # End of 10.4 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
+--echo #
+
+--error ER_TOO_BIG_PRECISION
+CREATE TABLE t1 (a TIME(4294967295));
+--error ER_TOO_BIG_PRECISION
+CREATE TABLE t1 (a TIME(4294967296));
+--error ER_TOO_BIG_PRECISION
+CREATE TABLE t1 (a TIME(999999999999999999999999999999));
+
+--error ER_TOO_BIG_PRECISION
+SELECT CAST(1 AS TIME(4294967295));
+--error ER_TOO_BIG_PRECISION
+SELECT CAST(1 AS TIME(4294967296));
+--error ER_TOO_BIG_PRECISION
+SELECT CAST(1 AS TIME(999999999999999999999999999999));
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
diff --git a/mysql-test/main/type_timestamp_hires.result b/mysql-test/main/type_timestamp_hires.result
index b3b7a008083..94807e8c561 100644
--- a/mysql-test/main/type_timestamp_hires.result
+++ b/mysql-test/main/type_timestamp_hires.result
@@ -1,7 +1,7 @@
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
drop table if exists t1, t2, t3;
create table t1 (a timestamp(7));
-ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
+ERROR 42000: Too big precision specified for 'a'. Maximum is 6
create table t1 (a timestamp(3), key(a));
insert t1 values ('2010-12-11 00:20:03.1234');
insert t1 values ('2010-12-11 15:47:11.1234');
diff --git a/mysql-test/main/view_debug.result b/mysql-test/main/view_debug.result
index cfb70b5e74c..2aeba2e1c65 100644
--- a/mysql-test/main/view_debug.result
+++ b/mysql-test/main/view_debug.result
@@ -21,5 +21,8 @@ connection con1;
3
3
SET DEBUG_SYNC= 'RESET';
+disconnect con1;
+disconnect con2;
+connection default;
drop procedure proc;
drop view v1,v2;
diff --git a/mysql-test/main/view_debug.test b/mysql-test/main/view_debug.test
index bf8074ddeb1..35fc0c6e02f 100644
--- a/mysql-test/main/view_debug.test
+++ b/mysql-test/main/view_debug.test
@@ -31,7 +31,8 @@ SET DEBUG_SYNC= 'now SIGNAL created';
--connection con1
--reap
SET DEBUG_SYNC= 'RESET';
-
-
+--disconnect con1
+--disconnect con2
+--connection default
drop procedure proc;
drop view v1,v2;
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 109296ef2a1..3b323d8a600 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -3925,7 +3925,7 @@ DROP TABLE t1;
# MDEV-18916: crash in Window_spec::print_partition() with decimals
#
SELECT cast((rank() over w1) as decimal (53,56));
-ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
+ERROR 42000: Too big scale specified for 'rank() over w1'. Maximum is 38
SELECT cast((rank() over w1) as decimal (53,30));
ERROR HY000: Window specification with name 'w1' is not defined
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result
new file mode 100644
index 00000000000..0f5d1694522
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_do_server_ids.result
@@ -0,0 +1,161 @@
+###############################
+# Test Setup
+###############################
+set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22");
+SET timestamp=@a;
+RESET MASTER;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+SET @@session.server_id= 2;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 values (3);
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 1;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 values (4);
+SET @@session.server_id= 3;
+SET timestamp=@a+1;
+CREATE TABLE t4 (a int);
+SET timestamp=@a+2;
+INSERT INTO t4 values (5);
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (1);
+SET @@session.gtid_domain_id= 2;
+SET @@session.server_id= 1;
+CREATE TABLE t5 (a int);
+INSERT INTO t5 values (6);
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (2);
+FLUSH LOGS;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 2;
+CREATE TABLE t6 (a int);
+INSERT INTO t6 values (1);
+FLUSH LOGS;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+RESET MASTER;
+###############################
+# Test Cases
+###############################
+#
+# Test Case 1) --do-server-ids with a single server id limits output
+# to that single server
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 2) --do-server-ids with multiple server ids limits output
+# to the provided servers
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2,3 | MYSQL
+DROP TABLE t2;
+DROP TABLE t4;
+#
+# Test Case 3) --do-server-ids when combined with --do-domain-ids should
+# intersect the results
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 4) --do-server-ids when combined with --ignore-domain-ids should
+# intersect the results
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | MYSQL
+DROP TABLE t3;
+DROP TABLE t5;
+#
+# Test Case 5) --do-server-ids when combined with a GTID range should
+# intersect the results
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | MYSQL
+DROP TABLE t1;
+#
+# Test Case 6) --do-server-ids when combined with both --ignore-domain-ids
+# and a GTID range should intersect all results
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | MYSQL
+DROP TABLE t3;
+DROP TABLE t5;
+#
+# Test Case 7) --do-server-ids when combined with both --do-domain-ids and
+# a GTID range should intersect all results
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 8) --do-server-ids and --offset=<n> skips n events after the
+# first GTID is found
+CREATE TABLE t4 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | MYSQL
+DROP TABLE t4;
+#
+# Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs
+# after the first GTID is found results in no events before T
+CREATE TABLE t4 (a int);
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | MYSQL
+DROP TABLE t4;
+#
+# Test Case 10) --do-server-ids works with --read-from-remote-server
+# Setup test specific data
+RESET MASTER;
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+SET @@session.server_id= 2;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 VALUES (1);
+SET @@session.server_id= 1;
+DROP TABLE t1;
+DROP TABLE t2;
+# MYSQL_BINLOG BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 11) --do-server-ids works over multiple binary log input
+# files
+# MYSQL_BINLOG BINLOG_FILE_PARAM BINLOG_FILE_PARAM2 --do-server-ids=2 | MYSQL
+DROP TABLE t2;
+DROP TABLE t6;
+#
+# Test Case 12) --do-server-ids re-specifications should override
+# previous ones
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 13) --do-server-ids and --server-id should be aliases and
+# a re-specification of one should override the former
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 14) --ignore-server-ids re-specifications should override
+# previous ones
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | MYSQL
+DROP TABLE t2;
+#
+# Test Case 15) --do-domain-ids re-specifications should override
+# previous ones
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | MYSQL
+DROP TABLE t1,t2;
+#
+# Test Case 16) --ignore-domain-ids re-specifications should override
+# previous ones
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | MYSQL
+DROP TABLE t1,t2;
+##############################
+# Error Cases
+##############################
+#
+# Error Case 1:
+# --ignore-server-ids and --do-server-ids both specified
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2
+#
+# Error Case 2:
+# Invalid server ID number provided
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=-1
+##############################
+# Cleanup
+##############################
+SET @@global.gtid_domain_id= 0;
+SET @@global.server_id= 1;
+# End of tests
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test
new file mode 100644
index 00000000000..9f32e2db071
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_do_server_ids.test
@@ -0,0 +1,477 @@
+#
+# Purpose:
+#
+# This test validates that the option --do-server-ids for the mariadb-binlog
+# command line tool correctly filters events by server id.
+#
+#
+# Methodology:
+#
+# This test invokes mariadb-binlog using combinations of --do-server-ids with
+# various combinations of other parameters to ensure it correctly filters by
+# server id. Specifically, the following test cases are validated:
+# Test Case 1) --do-server-ids with a single server id limits output to that
+# single server
+# Test Case 2) --do-server-ids with multiple server ids limits output to the
+# provided servers
+# Test Case 3) --do-server-ids when combined with --do-domain-ids should
+# intersect the results
+# Test Case 4) --do-server-ids when combined with --ignore-domain-ids should
+# intersect the results
+# Test Case 5) --do-server-ids when combined with a GTID range should
+# intersect the results
+# Test Case 6) --do-server-ids when combined with both --ignore-domain-ids
+# and a GTID range should intersect all results
+# Test Case 7) --do-server-ids when combined with both --do-domain-ids and
+# a GTID range should intersect all results
+# Test Case 8) --do-server-ids and --offset=<n> skips n events after the
+# first GTID is found
+# Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs
+# after the first GTID is found results in no events before T
+# Test Case 10) --do-server-ids works with --read-from-remote-server
+# Test Case 11) --do-server-ids works over multiple binary log input files
+# Test Case 12) --do-server-ids re-specifications should override previous
+# ones
+# Test Case 13) --do-server-ids and --server-id should be aliases and a
+# re-specification of one should override the former
+# Test Case 14) --ignore-server-ids re-specifications should override
+# previous ones
+# Test Case 15) --do-domain-ids re-specifications should override previous
+# ones
+# Test Case 16) --ignore-domain-ids re-specifications should override
+# previous ones
+#
+# Additionally, this test validates the following error scenarios:
+# Error Case 1) --do-server-ids and --ignore-server-ids cannot be specified
+# together
+# Error Case 2) Invalid server ID number provided
+#
+#
+# References:
+#
+# MDEV-20119: Implement the --do-domain-ids, --ignore-domain-ids, and
+# --ignore-server-ids options for mysqlbinlog
+#
+
+--source include/have_log_bin.inc
+
+--echo ###############################
+--echo # Test Setup
+--echo ###############################
+
+
+# Save old state
+let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`;
+let $ORIG_SERVER_ID = `select @@session.server_id`;
+
+# Configure test variables
+--let $MYSQLD_DATADIR=`select @@datadir`
+
+--let table_inconsistent_err= "table data is inconsistent after replaying binlog events";
+--let table_exists_error= "table exists but binlog playback should have excluded its creation";
+
+# Initialize test data
+set @a=UNIX_TIMESTAMP("1970-01-21 15:32:22");
+SET timestamp=@a;
+RESET MASTER;
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+
+SET @@session.server_id= 2;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 values (3);
+--let t2_checksum= `CHECKSUM TABLE t2`
+
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 1;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 values (4);
+--let t3_checksum= `CHECKSUM TABLE t3`
+
+SET @@session.server_id= 3;
+SET timestamp=@a+1;
+CREATE TABLE t4 (a int);
+SET timestamp=@a+2;
+INSERT INTO t4 values (5);
+--let t4_checksum= `CHECKSUM TABLE t4`
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (1);
+--let t1_partial_checksum= `CHECKSUM TABLE t1`
+
+SET @@session.gtid_domain_id= 2;
+SET @@session.server_id= 1;
+CREATE TABLE t5 (a int);
+INSERT INTO t5 values (6);
+--let t5_checksum= `CHECKSUM TABLE t5`
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (2);
+--let t1_checksum= `CHECKSUM TABLE t1`
+
+FLUSH LOGS;
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 2;
+CREATE TABLE t6 (a int);
+INSERT INTO t6 values (1);
+--let t6_checksum= `CHECKSUM TABLE t6`
+FLUSH LOGS;
+
+--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1)
+--let BINLOG_FILENAME2= query_get_value(SHOW BINARY LOGS, Log_name, 2)
+--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig
+--let BINLOG_FILE_PARAM2= $MYSQLD_DATADIR/$BINLOG_FILENAME2.orig
+--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME $BINLOG_FILE_PARAM
+--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME2 $BINLOG_FILE_PARAM2
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP TABLE t5;
+DROP TABLE t6;
+RESET MASTER;
+
+--echo ###############################
+--echo # Test Cases
+--echo ###############################
+
+--echo #
+--echo # Test Case 1) --do-server-ids with a single server id limits output
+--echo # to that single server
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=2 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+
+
+--echo #
+--echo # Test Case 2) --do-server-ids with multiple server ids limits output
+--echo # to the provided servers
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2,3 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=2,3 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if ($t4_checksum != `CHECKSUM TABLE t4`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+DROP TABLE t4;
+
+
+--echo #
+--echo # Test Case 3) --do-server-ids when combined with --do-domain-ids should
+--echo # intersect the results
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --do-domain-ids=0 | $MYSQL
+if ($t1_checksum != `CHECKSUM TABLE t1`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t2','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t1;
+
+
+--echo #
+--echo # Test Case 4) --do-server-ids when combined with --ignore-domain-ids should
+--echo # intersect the results
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 | $MYSQL
+if ($t3_checksum != `CHECKSUM TABLE t3`)
+{
+ die $table_inconsistent_err;
+}
+if ($t5_checksum != `CHECKSUM TABLE t5`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t4','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t3;
+DROP TABLE t5;
+
+
+--echo #
+--echo # Test Case 5) --do-server-ids when combined with a GTID range should
+--echo # intersect the results
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --stop-position=0-1-4 | $MYSQL
+if ($t1_partial_checksum != `CHECKSUM TABLE t1`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t2','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t1;
+
+
+--echo #
+--echo # Test Case 6) --do-server-ids when combined with both --ignore-domain-ids
+--echo # and a GTID range should intersect all results
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --ignore-domain-ids=0 --start-position=1-1-0 | $MYSQL
+if ($t3_checksum != `CHECKSUM TABLE t3`)
+{
+ die $table_inconsistent_err;
+}
+if ($t5_checksum != `CHECKSUM TABLE t5`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t4','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t3;
+DROP TABLE t5;
+
+
+--echo #
+--echo # Test Case 7) --do-server-ids when combined with both --do-domain-ids and
+--echo # a GTID range should intersect all results
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=2 --do-domain-ids=0 --start-position=0-1-0 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+
+
+
+--echo #
+--echo # Test Case 8) --do-server-ids and --offset=<n> skips n events after the
+--echo # first GTID is found
+
+# t4 needs to be specified because its creation should be skipped from
+# --offset specification
+CREATE TABLE t4 (a int);
+
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --offset=5 --do-server-ids=3 --do-domain-ids=1 | $MYSQL
+if ($t4_checksum != `CHECKSUM TABLE t4`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t3','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t4;
+
+
+--echo #
+--echo # Test Case 9) --do-server-ids with --start-datetime=<T> where T occurs
+--echo # after the first GTID is found results in no events before T
+
+# t4 needs to be specified because its creation should be skipped from
+# --start-datetime specification
+CREATE TABLE t4 (a int);
+
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --start-datetime="1970-01-21 15:32:24" --do-server-ids=3 --do-domain-ids=1 | $MYSQL
+if ($t4_checksum != `CHECKSUM TABLE t4`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t2','t3','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t4;
+
+
+--echo #
+--echo # Test Case 10) --do-server-ids works with --read-from-remote-server
+
+--echo # Setup test specific data
+RESET MASTER;
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+
+SET @@session.server_id= 2;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 VALUES (1);
+--let t11_t2_checksum= `CHECKSUM TABLE t2`
+
+SET @@session.server_id= 1;
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo # MYSQL_BINLOG BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILENAME --read-from-remote-server --do-server-ids=2 | $MYSQL
+if ($t11_t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+
+
+--echo #
+--echo # Test Case 11) --do-server-ids works over multiple binary log input
+--echo # files
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM BINLOG_FILE_PARAM2 --do-server-ids=2 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM $BINLOG_FILE_PARAM2 --do-server-ids=2 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if ($t6_checksum != `CHECKSUM TABLE t6`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+DROP TABLE t6;
+
+--echo #
+--echo # Test Case 12) --do-server-ids re-specifications should override
+--echo # previous ones
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --do-server-ids=2 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+
+--echo #
+--echo # Test Case 13) --do-server-ids and --server-id should be aliases and
+--echo # a re-specification of one should override the former
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --server-id=2 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+
+--echo #
+--echo # Test Case 14) --ignore-server-ids re-specifications should override
+--echo # previous ones
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --ignore-server-ids=2 --ignore-server-ids=1,3 | $MYSQL
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t1','t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t2;
+
+--echo #
+--echo # Test Case 15) --do-domain-ids re-specifications should override
+--echo # previous ones
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-domain-ids=1 --do-domain-ids=0 | $MYSQL
+if ($t1_checksum != `CHECKSUM TABLE t1`)
+{
+ die $table_inconsistent_err;
+}
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Test Case 16) --ignore-domain-ids re-specifications should override
+--echo # previous ones
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --ignore-domain-ids=0 --ignore-domain-ids=1,2 | $MYSQL
+if ($t1_checksum != `CHECKSUM TABLE t1`)
+{
+ die $table_inconsistent_err;
+}
+if ($t2_checksum != `CHECKSUM TABLE t2`)
+{
+ die $table_inconsistent_err;
+}
+if (`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name IN ('t3','t4','t5','t6')`)
+{
+ die $table_exists_error;
+}
+DROP TABLE t1,t2;
+
+--echo ##############################
+--echo # Error Cases
+--echo ##############################
+
+--echo #
+--echo # Error Case 1:
+--echo # --ignore-server-ids and --do-server-ids both specified
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2
+--error 1
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=1 --ignore-server-ids=2
+
+--echo #
+--echo # Error Case 2:
+--echo # Invalid server ID number provided
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM --do-server-ids=-1
+--error 1
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM --do-server-ids=-1
+
+--echo ##############################
+--echo # Cleanup
+--echo ##############################
+--eval SET @@global.gtid_domain_id= $ORIG_GTID_DOMAIN_ID
+--eval SET @@global.server_id= $ORIG_SERVER_ID
+
+--remove_file $BINLOG_FILE_PARAM
+--remove_file $BINLOG_FILE_PARAM2
+
+--echo # End of tests
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log.result b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
index b436435090b..5c6c7ebae90 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_log.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
@@ -21,7 +21,6 @@ Warning 1478 Ignoring encryption parameter during temporary table creation.
INSERT INTO t VALUES
(NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'),
(NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament');
-SET GLOBAL innodb_change_buffering=none;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
INSERT INTO t0
SELECT NULL, t1.col_int, t1.col_int_key, t1.col_char, t1.col_char_key
diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
index 4643e846be5..04897ef3105 100644
--- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result
+++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result
@@ -3931,7 +3931,7 @@ DROP TABLE t1;
# MDEV-18916: crash in Window_spec::print_partition() with decimals
#
SELECT cast((rank() over w1) as decimal (53,56));
-ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
+ERROR 42000: Too big scale specified for 'rank() over w1'. Maximum is 38
SELECT cast((rank() over w1) as decimal (53,30));
ERROR HY000: Window specification with name 'w1' is not defined
#
diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_log.test b/mysql-test/suite/encryption/t/innodb_encrypt_log.test
index 1d016be73c8..5448a606ba8 100644
--- a/mysql-test/suite/encryption/t/innodb_encrypt_log.test
+++ b/mysql-test/suite/encryption/t/innodb_encrypt_log.test
@@ -29,11 +29,6 @@ INSERT INTO t VALUES
(NULL,1,1,'private','secret'),(NULL,2,2,'sacred','success'),
(NULL,3,3,'story','secure'),(NULL,4,4,'security','sacrament');
-# Prevent change buffering of key(col_char_key), so that
-# after the restart, the data ('secret','success','secure','sacrament')
-# cannot be emitted to the unencrypted redo log by change buffer merge.
-SET GLOBAL innodb_change_buffering=none;
-
# Force a redo log flush at the next commit.
SET GLOBAL innodb_flush_log_at_trx_commit=1;
INSERT INTO t0
diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result
index 2f174c5e70b..a36c6c852dc 100644
--- a/mysql-test/suite/engines/iuds/r/insert_decimal.result
+++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result
@@ -1010,7 +1010,7 @@ ROUND(c1,c2) TRUNCATE(c1,c2)
1.133000 1.132000
DROP TABLE t5;
CREATE TABLE t7(c1 DECIMAL(66,0));
-ERROR 42000: Too big precision 66 specified for 'c1'. Maximum is 65
+ERROR 42000: Too big precision specified for 'c1'. Maximum is 65
CREATE TABLE t7(c1 DECIMAL(5,10));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1')
DROP TABLE t1,t2;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index efeb63ae616..6b10384744c 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -143,7 +143,7 @@ BEGIN
SET @v1 = f1;
SELECT @v1;
END//
-ERROR 42000: Too big precision 256 specified for 'f1'. Maximum is 65
+ERROR 42000: Too big precision specified for 'f1'. Maximum is 65
DROP PROCEDURE IF EXISTS sp1//
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -153,7 +153,7 @@ BEGIN
SET @v1 = f1;
SELECT @v1;
END//
-ERROR 42000: Too big precision 66 specified for 'f1'. Maximum is 65
+ERROR 42000: Too big precision specified for 'f1'. Maximum is 65
DROP PROCEDURE IF EXISTS sp1//
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@@ -1549,7 +1549,7 @@ BEGIN
SET f1 = 1000000 + f1;
RETURN f1;
END//
-ERROR 42000: Too big scale 61 specified for 'f1'. Maximum is 38
+ERROR 42000: Too big scale specified for 'f1'. Maximum is 38
SELECT fn1( 1.3326e+8 );
ERROR 42000: FUNCTION db_storedproc.fn1 does not exist
CREATE FUNCTION fn1( f1 DECIMAL(63, 30) ) RETURNS DECIMAL(63, 30)
@@ -5837,7 +5837,7 @@ fetch cur1 into e;
SELECT x, y, z, a, b, c, d, e;
close cur1;
END//
-ERROR 42000: Too big scale 255 specified for 'b'. Maximum is 38
+ERROR 42000: Too big scale specified for 'b'. Maximum is 38
CALL sp6();
ERROR 42000: PROCEDURE db_storedproc.sp6 does not exist
DROP PROCEDURE IF EXISTS sp6;
diff --git a/mysql-test/suite/galera/r/MDEV-22458.result b/mysql-test/suite/galera/r/MDEV-22458.result
index d1f9d94bd1c..7c853735641 100644
--- a/mysql-test/suite/galera/r/MDEV-22458.result
+++ b/mysql-test/suite/galera/r/MDEV-22458.result
@@ -4,7 +4,7 @@ CREATE TABLE t1 (a INT);
connect con1,localhost,root,,test;
INSERT INTO t1 VALUES (1),(2),(3),(4);
SHOW EXPLAIN FOR $con1;
-ERROR HY000: Target is not running an EXPLAINable command
+ERROR HY000: Target is not executing an operation with a query plan
connection con1;
INSERT INTO t1 VALUES (5),(6),(7),(8);
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
index d6bbcbae680..04f45a7c770 100644
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -3,7 +3,7 @@ connection node_1;
# Correct Galera library found
SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
expect 50
-49
+50
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
@@ -57,6 +57,7 @@ WSREP_SST_AUTH
WSREP_SST_DONOR
WSREP_SST_DONOR_REJECTS_QUERIES OFF
WSREP_SST_METHOD rsync
+WSREP_STATUS_FILE
WSREP_SYNC_WAIT 15
WSREP_TRX_FRAGMENT_SIZE 0
WSREP_TRX_FRAGMENT_UNIT bytes
diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def
index 1132a0097c4..9cca05eb62c 100644
--- a/mysql-test/suite/galera_sr/disabled.def
+++ b/mysql-test/suite/galera_sr/disabled.def
@@ -13,3 +13,5 @@
GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill
galera_sr_cc_master : MDEV-29882 Galera test failure on galera_sr_cc_master
mysql-wsrep-features#138 : At line 25: query 'DROP TABLE t1' failed: 2013: Lost connection to MySQL server during query
+# Links to below failures in MDEV-30172
+MDEV-25718 : timeout related to wsrep_sync_wait and DEBUG_SYNC
diff --git a/mysql-test/suite/innodb/r/ibuf_delete.result b/mysql-test/suite/innodb/r/ibuf_delete.result
index 1481fca9bf6..7423d3cfa3e 100644
--- a/mysql-test/suite/innodb/r/ibuf_delete.result
+++ b/mysql-test/suite/innodb/r/ibuf_delete.result
@@ -1,5 +1,7 @@
SET @buffering= @@innodb_change_buffering;
SET GLOBAL innodb_change_buffering= deletes;
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
SET @flush= @@innodb_flush_log_at_trx_commit;
SET GLOBAL innodb_flush_log_at_trx_commit= 0;
CREATE TABLE t1 (
@@ -46,4 +48,6 @@ INSERT INTO t2 SELECT @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x, @x
FROM seq_1_to_768;
DROP TABLE t1, t2;
SET GLOBAL innodb_change_buffering= @buffering;
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
SET GLOBAL innodb_flush_log_at_trx_commit= @flush;
diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result
index dbb9814c111..1dc7f0324d3 100644
--- a/mysql-test/suite/innodb/r/ibuf_not_empty.result
+++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result
@@ -6,6 +6,8 @@ INDEX(b))
ENGINE=InnoDB STATS_PERSISTENT=0;
SET GLOBAL innodb_change_buffering_debug = 1;
SET GLOBAL innodb_change_buffering=all;
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
INSERT INTO t1 SELECT 0,'x',1 FROM seq_1_to_1024;
# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump
check table t1;
diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result
new file mode 100644
index 00000000000..1db2fdde576
--- /dev/null
+++ b/mysql-test/suite/innodb/r/log_file_size_online.result
@@ -0,0 +1,47 @@
+SET GLOBAL innodb_log_file_size=4194304;
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+Variable_name Value
+innodb_log_file_size 4194304
+SELECT global_value FROM information_schema.system_variables
+WHERE variable_name = 'innodb_log_file_size';
+global_value
+4194304
+CREATE TABLE t (
+a INT PRIMARY KEY AUTO_INCREMENT,
+b CHAR(255) NOT NULL)
+ENGINE=INNODB;
+INSERT INTO t SELECT NULL, REPEAT('a', 255) FROM seq_1_to_20000;
+# restart: --innodb-log-file-size=4194304
+SELECT COUNT(*) FROM t;
+COUNT(*)
+20000
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+Variable_name Value
+innodb_log_file_size 4194304
+FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err
+UPDATE t SET b='' WHERE a<10;
+SET GLOBAL innodb_log_file_size=5242880;
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+Variable_name Value
+innodb_log_file_size 5242880
+SELECT global_value FROM information_schema.system_variables
+WHERE variable_name = 'innodb_log_file_size';
+global_value
+5242880
+# restart
+SELECT * FROM t WHERE a<10;
+a b
+1
+2
+3
+4
+5
+6
+7
+8
+9
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+Variable_name Value
+innodb_log_file_size 5242880
+FOUND 1 /InnoDB: Resized log to 5\.000MiB/ in mysqld.1.err
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/log_file_size_online.combinations b/mysql-test/suite/innodb/t/log_file_size_online.combinations
new file mode 100644
index 00000000000..846aff4c158
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file_size_online.combinations
@@ -0,0 +1,11 @@
+[encrypted]
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--loose-file-key-management
+--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt
+--innodb-encrypt-log=ON
+--innodb-log-file-size=5M
+
+[slow]
+--innodb-flush-sync=OFF
+--innodb-encrypt-log=OFF
+--innodb-log-file-size=5M
diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test
new file mode 100644
index 00000000000..65551f13dbc
--- /dev/null
+++ b/mysql-test/suite/innodb/t/log_file_size_online.test
@@ -0,0 +1,44 @@
+--source include/have_innodb.inc
+--source include/have_sequence.inc
+--source include/no_valgrind_without_big.inc
+
+let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+
+SET GLOBAL innodb_log_file_size=4194304;
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+SELECT global_value FROM information_schema.system_variables
+WHERE variable_name = 'innodb_log_file_size';
+
+CREATE TABLE t (
+ a INT PRIMARY KEY AUTO_INCREMENT,
+ b CHAR(255) NOT NULL)
+ENGINE=INNODB;
+
+INSERT INTO t SELECT NULL, REPEAT('a', 255) FROM seq_1_to_20000;
+
+--let $restart_parameters=--innodb-log-file-size=4194304
+--source include/restart_mysqld.inc
+
+SELECT COUNT(*) FROM t;
+
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+let SEARCH_PATTERN = InnoDB: Resized log to 4\\.000MiB;
+--source include/search_pattern_in_file.inc
+
+UPDATE t SET b='' WHERE a<10;
+
+SET GLOBAL innodb_log_file_size=5242880;
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+SELECT global_value FROM information_schema.system_variables
+WHERE variable_name = 'innodb_log_file_size';
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+SELECT * FROM t WHERE a<10;
+
+SHOW VARIABLES LIKE 'innodb_log_file_size';
+let SEARCH_PATTERN = InnoDB: Resized log to 5\\.000MiB;
+--source include/search_pattern_in_file.inc
+
+DROP TABLE t;
diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result
index 10dd5d4b4ca..375b29d51de 100644
--- a/mysql-test/suite/json/r/json_no_table.result
+++ b/mysql-test/suite/json/r/json_no_table.result
@@ -402,7 +402,7 @@ select json_length( 'true', '$.*' );
json_length( 'true', '$.*' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_length'
# wildcards not allowed in path expressions for this function
error ER_INVALID_JSON_PATH_WILDCARD
@@ -410,7 +410,7 @@ select json_length( 'true', '$.foo**.bar' );
json_length( 'true', '$.foo**.bar' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_length'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_length'
select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' );
json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[0]' )
1
@@ -691,25 +691,25 @@ select json_remove( '[ 1, 2, 3 ]', '$[*]' );
json_remove( '[ 1, 2, 3 ]', '$[*]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
error ER_INVALID_JSON_PATH_WILDCARD
select json_remove( '[ 1, 2, 3 ]', '$**[2]' );
json_remove( '[ 1, 2, 3 ]', '$**[2]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
error ER_INVALID_JSON_PATH_WILDCARD
select json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' );
json_remove( '[ 1, 2, 3 ]', '$[2]', '$[*]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 3 to function 'json_remove'
error ER_INVALID_JSON_PATH_WILDCARD
select json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' );
json_remove( '[ 1, 2, 3 ]', '$[2]', '$**[2]' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 3 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 3 to function 'json_remove'
select json_remove( '[ 1, 2, 3 ]', '$[0]' );
json_remove( '[ 1, 2, 3 ]', '$[0]' )
[2, 3]
@@ -730,7 +730,7 @@ select json_remove( '[ { "a": { "a": true } } ]', '$**.a' );
json_remove( '[ { "a": { "a": true } } ]', '$**.a' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
select json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' );
json_remove( '[ { "a": true }, { "b": false }, { "c": null }, { "a": null } ]', '$[0].a', '$[2].c' )
[{}, {"b": false}, {}, {"a": null}]
@@ -739,7 +739,7 @@ select json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c
json_remove( '[ { "a": true }, { "b": [ { "c": { "a": true } } ] }, { "c": null }, { "a": null } ]', '$**.a' )
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_remove'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_remove'
select json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' );
json_remove( '{"id": 123, "name": "systemQA", "array": [1, 2, 3]}', '$[0]' )
{"id": 123, "name": "systemQA", "array": [1, 2, 3]}
@@ -1210,7 +1210,7 @@ select json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b');
json_keys('{"a": 1, "b": {"e": "foo", "b": 3}}', '$.*.b')
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_keys'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_keys'
# returns [ "a", "b" ]
SELECT JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }');
JSON_KEYS('{ "a" : "foo", "b" : [ true, { "c" : "123" } ] }')
@@ -1637,7 +1637,7 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6);
json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
# Auto-wrapping, since because the paths identify scalars.
# should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]}
SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}',
@@ -1668,13 +1668,13 @@ select json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4);
json_array_append( '[[], [], []]', '$[*]', 3, '$[*]', 4)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
error ER_INVALID_JSON_PATH_WILDCARD
select json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4);
json_array_append( '[[], "not array", []]', '$[*]', 3, '$[*]', 4)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_array_append'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_array_append'
SELECT JSON_ARRAY_APPEND
(
'{ "a" : "foo", "b" : "bar", "c" : "wibble" }',
@@ -1775,73 +1775,73 @@ select json_insert(json_compact('{"a": [1], "b": 2}'), '$.*[1]', 6);
json_insert(json_compact('{"a": [1], "b": 2}'), '$.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": 1, "b": 2}'), '$.*[1]', 6);
json_insert(json_compact('{"a": 1, "b": 2}'), '$.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": 3}}'), '$.a.*[1]', 6);
json_insert(json_compact('{"a": {"b": 3}}'), '$.a.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": [3]}}'), '$.a.*[1]', 6);
json_insert(json_compact('{"a": {"b": [3]}}'), '$.a.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": 3}}'), '$**[1]', 6);
json_insert(json_compact('{"a": {"b": 3}}'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6);
json_insert(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1]'), '$[*][1]', 6);
json_insert(json_compact('[1]'), '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1]'), '$**[1]', 6);
json_insert(json_compact('[1]'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1, [2], 3]'), '$[*][1]', 6);
json_insert(json_compact('[1, [2], 3]'), '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[1, [2], 3]'), '$**[1]', 6);
json_insert(json_compact('[1, [2], 3]'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[[1]]'), '$[*][1]', 6);
json_insert(json_compact('[[1]]'), '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert(json_compact('[[1]]'), '$**[1]', 6);
json_insert(json_compact('[[1]]'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
select json_insert(json_compact('{"a": 3}'), '$[1]', 6);
json_insert(json_compact('{"a": 3}'), '$[1]', 6)
[{"a": 3}, 6]
@@ -2053,19 +2053,19 @@ select json_insert('[]', '$.a.*[1]', 6);
json_insert('[]', '$.a.*[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert('[]', '$**[1]', 6);
json_insert('[]', '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
error ER_INVALID_JSON_PATH_WILDCARD
select json_insert('[]', '$[*][1]', 6);
json_insert('[]', '$[*][1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_insert'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_insert'
select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false );
json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false )
[1, false, true, 2, 3]
@@ -2154,7 +2154,7 @@ select json_set(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6);
json_set(json_compact('{"a": {"b": [3]}}'), '$**[1]', 6)
NULL
Warnings:
-Warning 4044 Wildcards in JSON path not allowed in argument 2 to function 'json_set'
+Warning 4044 Wildcards or range in JSON path not allowed in argument 2 to function 'json_set'
SELECT JSON_SET('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
'$.a',
JSON_OBJECT());
diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result
index b71cc95a4e3..44957352865 100644
--- a/mysql-test/suite/json/r/json_table.result
+++ b/mysql-test/suite/json/r/json_table.result
@@ -1017,3 +1017,129 @@ ERROR 21000: Operand should contain 1 column(s)
#
# End of 10.6 tests
#
+#
+# Start of 10.9 tests
+#
+#
+# MDEV-27743 Remove Lex::charset
+#
+SELECT collation(name)
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) PATH '$.name'
+ )
+) AS jt;
+collation(name)
+utf8mb4_general_ci
+SELECT collation(name)
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+collation(name)
+utf8mb4_general_ci
+SELECT collation(name)
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) BINARY PATH '$.name'
+ )
+) AS jt;
+collation(name)
+utf8mb4_bin
+CREATE VIEW v1 AS
+SELECT *
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) PATH '$.name'
+ )
+) AS jt;
+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 `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Jeans"}]', '$[*]' COLUMNS (`name` varchar(10) PATH '$.name')) `jt` latin1 latin1_swedish_ci
+SELECT collation(name) FROM v1;
+collation(name)
+utf8mb4_general_ci
+DROP VIEW v1;
+CREATE VIEW v1 AS
+SELECT *
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+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 `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Jeans"}]', '$[*]' COLUMNS (`name` varchar(10) PATH '$.name')) `jt` latin1 latin1_swedish_ci
+SELECT collation(name) FROM v1;
+collation(name)
+utf8mb4_general_ci
+DROP VIEW v1;
+CREATE VIEW v1 AS
+SELECT *
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+name VARCHAR(10) BINARY PATH '$.name'
+ )
+) AS jt;
+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 `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Jeans"}]', '$[*]' COLUMNS (`name` varchar(10) CHARSET utf8mb4 COLLATE utf8mb4_bin PATH '$.name')) `jt` latin1 latin1_swedish_ci
+SELECT collation(name) FROM v1;
+collation(name)
+utf8mb4_bin
+DROP VIEW v1;
+#
+# MDEV-28319: Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path
+#
+SELECT * FROM JSON_TABLE('{"foo":{"bar":1},"qux":2}', '$' COLUMNS(c1 VARCHAR(8) PATH '$[0]', c2 CHAR(8) PATH '$.*.x')) AS js;
+c1 c2
+NULL NULL
+#
+# MDEV-29446 Change SHOW CREATE TABLE to display default collations
+#
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+name VARCHAR(10) CHARACTER SET latin1 PATH '$.name')
+) AS jt;
+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 `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Laptop"}]', '$[*]' COLUMNS (`name` varchar(10) CHARSET latin1 COLLATE latin1_swedish_ci PATH '$.name')) `jt` latin1 latin1_swedish_ci
+DROP VIEW v1;
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+name VARCHAR(10) CHARACTER SET utf8mb3 PATH '$.name')
+) AS jt;
+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 `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Laptop"}]', '$[*]' COLUMNS (`name` varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci PATH '$.name')) `jt` latin1 latin1_swedish_ci
+DROP VIEW v1;
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+name VARCHAR(10) CHARACTER SET BINARY PATH '$.name')
+) AS jt;
+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 `jt`.`name` AS `name` from JSON_TABLE('[{"name":"Laptop"}]', '$[*]' COLUMNS (`name` varbinary(10) PATH '$.name')) `jt` latin1 latin1_swedish_ci
+DROP VIEW v1;
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name')
+) AS jt;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ENUM('Laptop') CHARACTER SET BINARY PATH '$.name')
+) AS jt' at line 6
+#
+# End of 10.9 tests
+#
diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test
index ec330046f25..05db8f66a59 100644
--- a/mysql-test/suite/json/t/json_table.test
+++ b/mysql-test/suite/json/t/json_table.test
@@ -874,3 +874,124 @@ SELECT 1 FROM JSON_TABLE (row(1,2), '$' COLUMNS (o FOR ORDINALITY)) AS j;
--echo #
--echo # End of 10.6 tests
--echo #
+
+--echo #
+--echo # Start of 10.9 tests
+--echo #
+
+--echo #
+--echo # MDEV-27743 Remove Lex::charset
+--echo #
+
+SELECT collation(name)
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) PATH '$.name'
+ )
+) AS jt;
+
+SELECT collation(name)
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+
+SELECT collation(name)
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) BINARY PATH '$.name'
+ )
+) AS jt;
+
+
+CREATE VIEW v1 AS
+SELECT *
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE VIEW v1;
+SELECT collation(name) FROM v1;
+DROP VIEW v1;
+
+CREATE VIEW v1 AS
+SELECT *
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) COLLATE DEFAULT PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE VIEW v1;
+SELECT collation(name) FROM v1;
+DROP VIEW v1;
+
+CREATE VIEW v1 AS
+SELECT *
+FROM json_table('[{"name":"Jeans"}]', '$[*]'
+ COLUMNS(
+ name VARCHAR(10) BINARY PATH '$.name'
+ )
+) AS jt;
+SHOW CREATE VIEW v1;
+SELECT collation(name) FROM v1;
+DROP VIEW v1;
+
+--echo #
+--echo # MDEV-28319: Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path
+--echo #
+
+SELECT * FROM JSON_TABLE('{"foo":{"bar":1},"qux":2}', '$' COLUMNS(c1 VARCHAR(8) PATH '$[0]', c2 CHAR(8) PATH '$.*.x')) AS js;
+
+
+--echo #
+--echo # MDEV-29446 Change SHOW CREATE TABLE to display default collations
+--echo #
+
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+ name VARCHAR(10) CHARACTER SET latin1 PATH '$.name')
+) AS jt;
+SHOW CREATE VIEW v1;
+DROP VIEW v1;
+
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+ name VARCHAR(10) CHARACTER SET utf8mb3 PATH '$.name')
+) AS jt;
+SHOW CREATE VIEW v1;
+DROP VIEW v1;
+
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+ name VARCHAR(10) CHARACTER SET BINARY PATH '$.name')
+) AS jt;
+SHOW CREATE VIEW v1;
+DROP VIEW v1;
+
+# ENUM is not supported yet in JSON_TABLE.
+# But if it is eventually supported, the below
+# test should be modified to make sure that "CHARACTER SET BINARY"
+# is not followed by "COLLATE BINARY".
+--error ER_PARSE_ERROR
+CREATE VIEW v1 AS
+SELECT * FROM
+JSON_TABLE('[{"name":"Laptop"}]', '$[*]'
+COLUMNS
+(
+ name ENUM('Laptop') CHARACTER SET BINARY PATH '$.name')
+) AS jt;
+
+--echo #
+--echo # End of 10.9 tests
+--echo #
diff --git a/mysql-test/suite/perfschema/r/max_program_zero.result b/mysql-test/suite/perfschema/r/max_program_zero.result
index f236f149a77..5435efb34ae 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 221
+performance_schema_max_statement_classes 222
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/nesting.result b/mysql-test/suite/perfschema/r/nesting.result
index ba655d3c329..9e18e5ac272 100644
--- a/mysql-test/suite/perfschema/r/nesting.result
+++ b/mysql-test/suite/perfschema/r/nesting.result
@@ -128,12 +128,12 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
11 11 stage/sql/Executing (stage) STATEMENT 0
12 12 stage/sql/End of update loop (stage) STATEMENT 0
13 13 stage/sql/Query end (stage) STATEMENT 0
-14 14 stage/sql/Commit (stage) STATEMENT 0
-15 15 stage/sql/closing tables (stage) STATEMENT 0
-16 16 stage/sql/Starting cleanup (stage) STATEMENT 0
-17 17 stage/sql/Freeing items (stage) STATEMENT 0
-18 18 wait/io/socket/sql/client_connection send STATEMENT 0
-19 19 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 0
+14 15 stage/sql/Commit (stage) STATEMENT 0
+15 15 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 14
+16 16 stage/sql/closing tables (stage) STATEMENT 0
+17 17 stage/sql/Starting cleanup (stage) STATEMENT 0
+18 18 stage/sql/Freeing items (stage) STATEMENT 0
+19 19 wait/io/socket/sql/client_connection send STATEMENT 0
20 21 stage/sql/Reset for next command (stage) STATEMENT 0
21 21 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 20
22 22 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 0
@@ -152,12 +152,12 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
35 35 stage/sql/Executing (stage) STATEMENT 24
36 36 stage/sql/End of update loop (stage) STATEMENT 24
37 37 stage/sql/Query end (stage) STATEMENT 24
-38 38 stage/sql/Commit (stage) STATEMENT 24
-39 39 stage/sql/closing tables (stage) STATEMENT 24
-40 40 stage/sql/Starting cleanup (stage) STATEMENT 24
-41 41 stage/sql/Freeing items (stage) STATEMENT 24
-42 42 wait/io/socket/sql/client_connection send STATEMENT 24
-43 43 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 24
+38 39 stage/sql/Commit (stage) STATEMENT 24
+39 39 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 38
+40 40 stage/sql/closing tables (stage) STATEMENT 24
+41 41 stage/sql/Starting cleanup (stage) STATEMENT 24
+42 42 stage/sql/Freeing items (stage) STATEMENT 24
+43 43 wait/io/socket/sql/client_connection send STATEMENT 24
44 45 stage/sql/Reset for next command (stage) STATEMENT 24
45 45 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 44
46 46 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 24
@@ -176,12 +176,12 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
59 59 stage/sql/Executing (stage) STATEMENT 48
60 60 stage/sql/End of update loop (stage) STATEMENT 48
61 61 stage/sql/Query end (stage) STATEMENT 48
-62 62 stage/sql/Commit (stage) STATEMENT 48
-63 63 stage/sql/closing tables (stage) STATEMENT 48
-64 64 stage/sql/Starting cleanup (stage) STATEMENT 48
-65 65 stage/sql/Freeing items (stage) STATEMENT 48
-66 66 wait/io/socket/sql/client_connection send STATEMENT 48
-67 67 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 48
+62 63 stage/sql/Commit (stage) STATEMENT 48
+63 63 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 62
+64 64 stage/sql/closing tables (stage) STATEMENT 48
+65 65 stage/sql/Starting cleanup (stage) STATEMENT 48
+66 66 stage/sql/Freeing items (stage) STATEMENT 48
+67 67 wait/io/socket/sql/client_connection send STATEMENT 48
68 69 stage/sql/Reset for next command (stage) STATEMENT 48
69 69 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 68
70 70 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 48
@@ -203,12 +203,12 @@ select "With a third part to make things complete" as payload NULL NULL
84 84 stage/sql/Executing (stage) STATEMENT 72
85 85 stage/sql/End of update loop (stage) STATEMENT 72
86 86 stage/sql/Query end (stage) STATEMENT 72
-87 87 stage/sql/Commit (stage) STATEMENT 72
-88 88 stage/sql/closing tables (stage) STATEMENT 72
-89 89 stage/sql/Starting cleanup (stage) STATEMENT 72
-90 92 stage/sql/Freeing items (stage) STATEMENT 72
-91 91 wait/io/socket/sql/client_connection send STAGE 90
-92 92 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 90
+87 88 stage/sql/Commit (stage) STATEMENT 72
+88 88 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 87
+89 89 stage/sql/closing tables (stage) STATEMENT 72
+90 90 stage/sql/Starting cleanup (stage) STATEMENT 72
+91 92 stage/sql/Freeing items (stage) STATEMENT 72
+92 92 wait/io/socket/sql/client_connection send STAGE 91
93 110 statement/sql/select select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
94 96 stage/sql/starting (stage) STATEMENT 93
@@ -222,12 +222,12 @@ select "With a third part to make things complete" as payload NULL NULL
102 102 stage/sql/Executing (stage) STATEMENT 93
103 103 stage/sql/End of update loop (stage) STATEMENT 93
104 104 stage/sql/Query end (stage) STATEMENT 93
-105 105 stage/sql/Commit (stage) STATEMENT 93
-106 106 stage/sql/closing tables (stage) STATEMENT 93
-107 107 stage/sql/Starting cleanup (stage) STATEMENT 93
-108 110 stage/sql/Freeing items (stage) STATEMENT 93
-109 109 wait/io/socket/sql/client_connection send STAGE 108
-110 110 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 108
+105 106 stage/sql/Commit (stage) STATEMENT 93
+106 106 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 105
+107 107 stage/sql/closing tables (stage) STATEMENT 93
+108 108 stage/sql/Starting cleanup (stage) STATEMENT 93
+109 110 stage/sql/Freeing items (stage) STATEMENT 93
+110 110 wait/io/socket/sql/client_connection send STAGE 109
111 129 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
112 113 stage/sql/starting (stage) STATEMENT 111
113 113 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 112
@@ -239,12 +239,12 @@ select "With a third part to make things complete" as payload NULL NULL
119 119 stage/sql/Executing (stage) STATEMENT 111
120 120 stage/sql/End of update loop (stage) STATEMENT 111
121 121 stage/sql/Query end (stage) STATEMENT 111
-122 122 stage/sql/Commit (stage) STATEMENT 111
-123 123 stage/sql/closing tables (stage) STATEMENT 111
-124 124 stage/sql/Starting cleanup (stage) STATEMENT 111
-125 125 stage/sql/Freeing items (stage) STATEMENT 111
-126 126 wait/io/socket/sql/client_connection send STATEMENT 111
-127 127 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 111
+122 123 stage/sql/Commit (stage) STATEMENT 111
+123 123 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 122
+124 124 stage/sql/closing tables (stage) STATEMENT 111
+125 125 stage/sql/Starting cleanup (stage) STATEMENT 111
+126 126 stage/sql/Freeing items (stage) STATEMENT 111
+127 127 wait/io/socket/sql/client_connection send STATEMENT 111
128 129 stage/sql/Reset for next command (stage) STATEMENT 111
129 129 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 128
130 130 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 111
@@ -263,12 +263,12 @@ select "With a third part to make things complete" as payload NULL NULL
143 143 stage/sql/Executing (stage) STATEMENT 132
144 144 stage/sql/End of update loop (stage) STATEMENT 132
145 145 stage/sql/Query end (stage) STATEMENT 132
-146 146 stage/sql/Commit (stage) STATEMENT 132
-147 147 stage/sql/closing tables (stage) STATEMENT 132
-148 148 stage/sql/Starting cleanup (stage) STATEMENT 132
-149 149 stage/sql/Freeing items (stage) STATEMENT 132
-150 150 wait/io/socket/sql/client_connection send STATEMENT 132
-151 151 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 132
+146 147 stage/sql/Commit (stage) STATEMENT 132
+147 147 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 146
+148 148 stage/sql/closing tables (stage) STATEMENT 132
+149 149 stage/sql/Starting cleanup (stage) STATEMENT 132
+150 150 stage/sql/Freeing items (stage) STATEMENT 132
+151 151 wait/io/socket/sql/client_connection send STATEMENT 132
152 153 stage/sql/Reset for next command (stage) STATEMENT 132
153 153 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 152
disconnect con1;
diff --git a/mysql-test/suite/perfschema/r/ortho_iter.result b/mysql-test/suite/perfschema/r/ortho_iter.result
index 4224c3e520d..9489c1049e5 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 221
+performance_schema_max_statement_classes 222
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 ab0d18e3227..94cc2b33b49 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 221
+performance_schema_max_statement_classes 222
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 fda05bf6df5..bfc49fd3480 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 221
+performance_schema_max_statement_classes 222
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 7db242f237f..e9f20398467 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 221
+performance_schema_max_statement_classes 222
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 31ddb4eb3cd..ffb45f4f55f 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 221
+performance_schema_max_statement_classes 222
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 2a2d42f4d51..e271d5a10e6 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 221
+performance_schema_max_statement_classes 222
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 2115c747755..833da22583e 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 221
+performance_schema_max_statement_classes 222
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 25b8a7b9c1f..e3ff0f514a7 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 221
+performance_schema_max_statement_classes 222
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_index.result b/mysql-test/suite/perfschema/r/start_server_low_index.result
index b34f86da89f..ffdf9d65b87 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 221
+performance_schema_max_statement_classes 222
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 e8bf9f48da8..dbb404f6129 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 221
+performance_schema_max_statement_classes 222
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 021ff9f9e3d..f92b0e6bec6 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 221
+performance_schema_max_statement_classes 222
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 0a7f1c601ef..fefad55c209 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 221
+performance_schema_max_statement_classes 222
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 de4ff2f5a72..0c2f65f6ac9 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 221
+performance_schema_max_statement_classes 222
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 997220d3169..c3f06b53425 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 221
+performance_schema_max_statement_classes 222
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 de81943afe8..fd39807d567 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 221
+performance_schema_max_statement_classes 222
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 ce156302b22..43111c5ec40 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 221
+performance_schema_max_statement_classes 222
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 d46095841c2..15d1184bcbe 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 221
+performance_schema_max_statement_classes 222
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 c1f7e656dc6..b8de90453ce 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 221
+performance_schema_max_statement_classes 222
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 94c8a7da85a..60066264c90 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 221
+performance_schema_max_statement_classes 222
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 e44307fdbe6..3353b46bbcb 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 221
+performance_schema_max_statement_classes 222
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 6647def50c1..d41da361733 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 221
+performance_schema_max_statement_classes 222
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 9b5ad931858..4919de6bb6c 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 221
+performance_schema_max_statement_classes 222
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 fdd3fe48bf3..02a119bdc68 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 221
+performance_schema_max_statement_classes 222
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 09faadaa4ce..ead01ce2d0e 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 221
+performance_schema_max_statement_classes 222
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 2d93be52186..a99f1c0f9be 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 221
+performance_schema_max_statement_classes 222
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 e9eff67712f..7c148889412 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 221
+performance_schema_max_statement_classes 222
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 f5b00a114dd..dec0680c511 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 221
+performance_schema_max_statement_classes 222
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 d1b3e14d349..20adf1a9f64 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 221
+performance_schema_max_statement_classes 222
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 136c54885bf..044f9475041 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 221
+performance_schema_max_statement_classes 222
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 3e2d7acf4ec..350f2c6637d 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 221
+performance_schema_max_statement_classes 222
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 5db6987834b..d2d7063c32f 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 221
+performance_schema_max_statement_classes 222
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 69a69986a72..8bcb3c56a00 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 221
+performance_schema_max_statement_classes 222
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 2f68483cfae..2a2bf5d3f7c 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 221
+performance_schema_max_statement_classes 222
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 3d131f1a2e0..ec6e40acc00 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 221
+performance_schema_max_statement_classes 222
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 95f8f226c41..b3f1e4cbcf2 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 221
+performance_schema_max_statement_classes 222
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 b54d6c762e1..baf9f761358 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 221
+performance_schema_max_statement_classes 222
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 9182677d8b8..cd204f3d811 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 221
+performance_schema_max_statement_classes 222
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 ff90c471599..d083484cd7c 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 221
+performance_schema_max_statement_classes 222
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 4535bcd02ed..f5a12e5473d 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 221
+performance_schema_max_statement_classes 222
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 f3eefb98a43..76ae9d5fa4e 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 221
+performance_schema_max_statement_classes 222
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 9ca79837845..4bd472a22a9 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 221
+performance_schema_max_statement_classes 222
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 ee22d5b5bed..f59b156ce1e 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 221
+performance_schema_max_statement_classes 222
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 adbad8d166f..cc70572c7ef 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 221
+performance_schema_max_statement_classes 222
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 022f7d1096e..a53d591938c 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 221
+performance_schema_max_statement_classes 222
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 25b8a7b9c1f..e3ff0f514a7 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 221
+performance_schema_max_statement_classes 222
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 65d3a7b55b5..7d1d1e05375 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 221
+performance_schema_max_statement_classes 222
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 264778c06e4..05ec7b0b2b5 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 221
+performance_schema_max_statement_classes 222
performance_schema_max_statement_stack 2
performance_schema_max_table_handles 1000
performance_schema_max_table_instances 500
diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result
index 55cbbd8843d..dfad83e4b75 100644
--- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result
+++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result
@@ -18,7 +18,7 @@ grant test_role to test_user@localhost;
set default role test_role for root@localhost;
drop role test_role;
drop user test_user@localhost;
-alter table user add column default_role char(80) binary default '' not null
+alter table user add column default_role char(80) default '' not null
COLLATE utf8_general_ci
after is_role;
alter table user add max_statement_time decimal(12,6) default 0 not null
diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test
index 9cf0d7b4aff..dac6eab21e9 100644
--- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test
+++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.test
@@ -36,7 +36,7 @@ set default role test_role for root@localhost;
drop role test_role;
drop user test_user@localhost;
-alter table user add column default_role char(80) binary default '' not null
+alter table user add column default_role char(80) default '' not null
COLLATE utf8_general_ci
after is_role;
alter table user add max_statement_time decimal(12,6) default 0 not null
diff --git a/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
new file mode 100644
index 00000000000..48e4399d162
--- /dev/null
+++ b/mysql-test/suite/rpl/include/mysqlbinlog_slave_consistency.inc
@@ -0,0 +1,194 @@
+# This file provides the structure to run a single test that ensures the
+# mariadb-binlog command line tool is consistent with replicas for event
+# filtering. The test is configured using the following input parameters, where
+# each is nullable (i.e. it will not be used to configure mariadb-binlog or
+# the replica).
+#
+# param $do_domain_ids : A list of domain ids to include in replication
+# param $ignore_domain_ids : A list of domain ids to exclude from replication
+# param $ignore_server_ids : A list of server ids to exclude from replication
+# param $start_position : The GTID positions to begin replication from in
+# the specified domains
+# param $stop_position : The GTID positions that mark the end of an event
+# stream in a particular domain
+#
+# param $con1 : The connection name of the primary server
+# param $con2 : The connection name of the replica server
+# param $strict_mode : Uses input and checks for out of order GTIDs
+# param $strict_mode_err : A boolean that provides expectations for strict
+# mode to error
+# param $slave_sql_errno : Expected error number of the slave SQL thread
+
+
+--let $include_filename= mysqlbinlog_slave_consistency.inc
+--source include/begin_include_file.inc
+
+--enable_query_log
+
+if (!$con1)
+{
+ --let $con1=master
+}
+if (!$con2)
+{
+ --let $con2=slave
+}
+
+if (!$strict_mode)
+{
+ --connection $con2
+ set @@global.gtid_strict_mode=0;
+ --let $sql_input_file=include/sql_multisource.inc
+}
+
+if ($strict_mode)
+{
+ --connection $con2
+ set @@global.gtid_strict_mode=1;
+ --let $sql_input_file=include/sql_out_of_order_gtid.inc
+}
+
+--connection $con2
+--source include/stop_slave.inc
+
+--connection $con1
+--echo # Populating $con1 data
+--source $sql_input_file
+--source include/save_master_gtid.inc
+
+--let $MYSQLD_DATADIR=`select @@datadir`
+--let $MYSQLBINLOG_STDERR=$MYSQLD_DATADIR/mysqlbinlog_stderr.out
+--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1)
+--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig
+--copy_file $MYSQLD_DATADIR/$BINLOG_FILENAME $BINLOG_FILE_PARAM
+
+--connection $con2
+--let $msbl_args=
+if (`SELECT strcmp("$start_position","") != 0`)
+{
+ eval set global gtid_slave_pos="$start_position";
+ --let $msbl_args= $msbl_args --start-position=$start_position
+}
+
+--let $cm_args= MASTER_USE_GTID=slave_pos
+if (`SELECT strcmp("$do_domain_ids","") != 0`)
+{
+ --let $cm_args= $cm_args, DO_DOMAIN_IDS=($do_domain_ids)
+ --let $msbl_args= $msbl_args --do-domain-ids=$do_domain_ids
+}
+if (`SELECT strcmp("$ignore_domain_ids","") != 0`)
+{
+ --let $cm_args= $cm_args, IGNORE_DOMAIN_IDS=($ignore_domain_ids)
+ --let $msbl_args= $msbl_args --ignore-domain-ids=$ignore_domain_ids
+}
+if (`SELECT strcmp("$ignore_server_ids","") != 0`)
+{
+ --let $cm_args= $cm_args, IGNORE_SERVER_IDS=($ignore_server_ids)
+ --let $msbl_args= $msbl_args --ignore-server-ids=$ignore_server_ids
+}
+if ($strict_mode)
+{
+ --let $msbl_args= $msbl_args --gtid-strict-mode
+}
+eval CHANGE MASTER TO $cm_args;
+
+--let $start_slave_args=
+if (`SELECT strcmp("$stop_position","") != 0`)
+{
+ --let $start_slave_args= UNTIL master_gtid_pos="$stop_position"
+ --let $msbl_args= $msbl_args --stop-position=$stop_position
+}
+
+eval START SLAVE $start_slave_args;
+
+if ($slave_sql_errno)
+{
+ --echo # $con2 SQL Thread error expected - waiting for errno $slave_sql_errno
+ --source include/wait_for_slave_sql_error.inc
+}
+
+# If we are not expecting an error, wait for con2 to catch up
+if (!$slave_sql_errno)
+{
+ --echo # No $con2 error expecting - waiting for $con2 to catch up to $con1
+
+ # Stop position was not specified
+ if (`SELECT strcmp("$stop_position","") = 0`)
+ {
+ --source include/sync_with_master_gtid.inc
+ }
+
+ # Stop position was specified
+ if (`SELECT strcmp("$stop_position","") != 0`)
+ {
+ --echo # Because there is a stop position we wait for all events to process
+ --echo # and $con2 to automatically stop
+ --source include/wait_for_slave_to_stop.inc
+ }
+}
+
+--echo # Stop $con2 so it stops receiving $con1 events.
+--source include/stop_slave.inc
+
+--connection $con1
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+--echo # MYSQL_BINLOG BINLOG_FILE_PARAM $msbl_args 2> MYSQLBINLOG_STDERR | MYSQL
+--exec $MYSQL_BINLOG $BINLOG_FILE_PARAM $msbl_args 2> $MYSQLBINLOG_STDERR | $MYSQL
+
+--source include/rpl_check_table_consistency.inc
+
+if ($strict_mode)
+{
+ --echo # Strict mode enabled - checking mysqlbinlog error output for out
+ --echo # of order GTIDs
+ --let SEARCH_FILE=$MYSQLBINLOG_STDERR
+ --let SEARCH_PATTERN=Found out of order GTID
+ if ($strict_mode_err)
+ {
+ --echo # Expecting to find out of order GTID error..
+ }
+ if (!$strict_mode_err)
+ {
+ --echo # Not expecting to find out of order GTID error..
+ }
+ --source include/search_pattern_in_file.inc
+}
+
+--echo # Test finished - resetting $con1 and $con2..
+--connection $con2
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+
+--connection $con1
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+--source include/save_master_gtid.inc
+
+--connection $con2
+--source include/start_slave.inc
+--source include/wait_for_slave_to_start.inc
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+
+--connection $con1
+RESET MASTER;
+
+--connection $con2
+if ($strict_mode)
+{
+ set @@global.gtid_strict_mode=0;
+}
+--source include/start_slave.inc
+
+--connection $con1
+--remove_file $BINLOG_FILE_PARAM
+--remove_file $MYSQLBINLOG_STDERR
+
+--let $include_filename= mysqlbinlog_slave_consistency.inc
+--source include/end_include_file.inc
diff --git a/mysql-test/suite/rpl/include/rpl_check_table_consistency.inc b/mysql-test/suite/rpl/include/rpl_check_table_consistency.inc
new file mode 100644
index 00000000000..957a5d525a7
--- /dev/null
+++ b/mysql-test/suite/rpl/include/rpl_check_table_consistency.inc
@@ -0,0 +1,63 @@
+# This file provides logic to ensure that all tables in a database are the
+# same between two connections.
+#
+# param $check_db : The name of the database to validate all tables are the
+# same within (test by default)
+# param $con1 : The connection name of the primary server, defaults to
+# master
+# param $con2 : The connection name of the replica server, defaults to
+# slave
+
+--let $include_filename= rpl_check_table_consistency.inc
+--source include/begin_include_file.inc
+
+if (!$con1)
+{
+ --let $con1= master
+}
+if (!$con2)
+{
+ --let $con2= slave
+}
+if (!$check_db)
+{
+ --let $check_db= test
+}
+
+--connection $con2
+--let $n_tables= `select count(*) from information_schema.tables WHERE table_schema = '$check_db'`
+
+--echo # Checking consistency of '$check_db' database tables between $con1 and $con2
+
+--connection $con1
+--let $c1_n_tables= `select count(*) from information_schema.tables WHERE table_schema = '$check_db'`
+if (`SELECT $c1_n_tables != $n_tables`)
+{
+ die "$con1 had $c1_n_tables tables but $con2 had $n_tables after binlog replay";
+}
+--echo # Both servers have $n_tables tables
+
+--let $ctr= 1
+--echo # Verifying integrity of tables..
+while($ctr <= $n_tables)
+{
+ --let $cksum_tbl= query_get_value(SELECT table_name FROM information_schema.tables WHERE table_schema = 'test' ORDER BY table_name ASC, table_name, $ctr)
+ --connection $con1
+ --let $c1_cksum= `CHECKSUM TABLE $cksum_tbl`
+ --connection $con2
+ --let $c2_cksum= `CHECKSUM TABLE $cksum_tbl`
+
+ if ($c1_cksum != $c2_cksum)
+ {
+ die "Table $cksum_tbl differs between connections $con1 and $con2";
+ }
+ if ($c1_cksum == $c2_cksum)
+ {
+ --echo # $cksum_tbl is equivalent on $con1 and $con2
+ }
+ --let $ctr= `SELECT $ctr+1`
+}
+--echo # All tables are consistent
+
+--let $include_filename= rpl_check_table_consistency.inc
+--source include/end_include_file.inc
diff --git a/mysql-test/suite/rpl/include/sql_multisource.inc b/mysql-test/suite/rpl/include/sql_multisource.inc
new file mode 100644
index 00000000000..761b68421d9
--- /dev/null
+++ b/mysql-test/suite/rpl/include/sql_multisource.inc
@@ -0,0 +1,45 @@
+# Populate the active connection server with events that come from varying
+# domain and server ids
+
+--disable_query_log
+
+# Save old state
+let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`;
+let $ORIG_SERVER_ID = `select @@session.server_id`;
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+
+SET @@session.server_id= 3;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 values (3);
+
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 1;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 values (4);
+
+SET @@session.server_id= 4;
+CREATE TABLE t4 (a int);
+INSERT INTO t4 values (5);
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (1);
+
+SET @@session.gtid_domain_id= 2;
+SET @@session.server_id= 1;
+CREATE TABLE t5 (a int);
+INSERT INTO t5 values (6);
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (2);
+
+FLUSH LOGS;
+
+--eval SET @@session.gtid_domain_id= $ORIG_GTID_DOMAIN_ID
+--eval SET @@session.server_id= $ORIG_SERVER_ID
+
+--enable_query_log
diff --git a/mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc b/mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc
new file mode 100644
index 00000000000..82291a887e9
--- /dev/null
+++ b/mysql-test/suite/rpl/include/sql_out_of_order_gtid.inc
@@ -0,0 +1,43 @@
+# SQL file with out of order GTIDs coming from various domains and servers
+
+--disable_query_log
+
+# Save old state
+let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`;
+let $ORIG_SERVER_ID = `select @@session.server_id`;
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 values (1);
+
+SET @@session.server_id= 3;
+CREATE TABLE t2 (a int);
+SET @@session.gtid_seq_no= 6;
+INSERT INTO t2 values (2);
+SET @@session.gtid_seq_no= 5;
+INSERT INTO t2 values (1);
+SET @@session.gtid_seq_no= 7;
+INSERT INTO t2 values (3);
+
+SET @@session.gtid_domain_id= 1;
+SET @@session.server_id= 1;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 values (1);
+SET @@session.gtid_seq_no= 4;
+INSERT INTO t3 values (3);
+SET @@session.gtid_seq_no= 3;
+INSERT INTO t3 values (2);
+SET @@session.gtid_seq_no= 5;
+INSERT INTO t3 values (4);
+
+SET @@session.gtid_domain_id= 0;
+SET @@session.server_id= 1;
+INSERT INTO t1 values (2);
+
+FLUSH LOGS;
+
+--eval SET @@session.gtid_domain_id= $ORIG_GTID_DOMAIN_ID
+--eval SET @@session.server_id= $ORIG_SERVER_ID
+
+--enable_query_log
diff --git a/mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result b/mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result
new file mode 100644
index 00000000000..e69fb2fc62d
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mysqlbinlog_slave_consistency.result
@@ -0,0 +1,1343 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+SET sql_log_bin=0;
+call mtr.add_suppression("Slave: An attempt was made.*");
+call mtr.add_suppression("Both DO_DOMAIN_IDS & IGNORE_DOMAIN_IDS lists can't be non-empty at the same time");
+SET sql_log_bin=1;
+include/stop_slave.inc
+connection master;
+RESET MASTER;
+connection slave;
+include/start_slave.inc
+#
+#
+# Test Case 1: Base case to ensure that mariadb-binlog and replica
+# are consistent without any filtering
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 5 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+connection master;
+connection slave;
+# t3 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+connection master;
+connection slave;
+# t5 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 2: Ensure filtering by a single id in --do-domain-ids is
+# consistent between mariadb-binlog and replica
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 2 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 3: Ensure filtering by multiple ids in --do-domain-ids is
+# consistent between mariadb-binlog and replica
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0,1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0,1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 4 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+connection master;
+connection slave;
+# t3 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+# Test Case 4: Ensure filtering by a single id in --ignore-domain-ids
+# is consistent between mariadb-binlog and replica
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 3 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t3 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+connection master;
+connection slave;
+# t5 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 5: Ensure filtering by multiple ids in --ignore-domain-ids
+# is consistent between mariadb-binlog and replica
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0,1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0,1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t5 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+# Test Case 6: Ensure filtering by a single id in --ignore-server-ids
+# is consistent between mariadb-binlog and replica
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 2 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 7: Ensure filtering by multiple ids in --ignore-server-ids
+# is consistent between mariadb-binlog and replica
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(0,1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=0,1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 2 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 8: Ensure stop position consistency
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+START SLAVE UNTIL master_gtid_pos="1-1-2";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --stop-position=1-1-2 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t3 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 9: Ensure start position consistency
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="1-4-2";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-4-2 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 4 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+connection master;
+connection slave;
+# t5 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t3'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 10: Ensure consistency when filtering by both
+# --do-domain-ids and --ignore-server-ids
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_SERVER_IDS=(1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 11: Ensure consistency when filtering by both
+# --ignore-domain-ids and --ignore-server-ids
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(1,2), IGNORE_SERVER_IDS=(1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=1,2 --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 12: Ensure consistency when filtering by
+# --do-domain-ids with a stop position
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0);
+START SLAVE UNTIL master_gtid_pos="0-1-4";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 --stop-position=0-1-4 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 2 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 13: Ensure consistency when filtering by
+# --ignore-domain-ids with a stop position
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0);
+START SLAVE UNTIL master_gtid_pos="0-1-4";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-domain-ids=0 --stop-position=0-1-4 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 0 tables
+# Verifying integrity of tables..
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 14: Ensure consistency when filtering by
+# --ignore-server-ids with a stop position
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(3);
+START SLAVE UNTIL master_gtid_pos="0-1-4";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=3 --stop-position=0-1-4 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t2,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 15: Ensure consistency when filtering by
+# --do-domain-ids with a start position
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="1-1-2";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(2);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=1-1-2 --do-domain-ids=2 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t5 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 16: Ensure consistency when filtering by
+# --ignore-domain-ids with a start position
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-1";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-domain-ids=0 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 3 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t3 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+connection master;
+connection slave;
+# t5 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 17: Ensure consistency when filtering by
+# --ignore-server-ids with a start position
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-1";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(1);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-server-ids=1 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 2 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+connection master;
+connection slave;
+# t4 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 18: Ensure consistency when filtering by
+# --do-domain-ids with both a start position and stop position that
+# all have the same domain id
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-1";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0);
+START SLAVE UNTIL master_gtid_pos="0-3-3";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --do-domain-ids=0 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 19: Ensure consistency when filtering by
+# --do-domain-ids with both a start position and stop position that
+# have differing domain ids. Due to the implicit filtering in stop
+# position, the result should be empty (no tables replicated).
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-1";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(1);
+START SLAVE UNTIL master_gtid_pos="0-3-3";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --do-domain-ids=1 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 0 tables
+# Verifying integrity of tables..
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 20: Ensure consistency when filtering by
+# --ignore-domain-ids with both a start position and stop position that
+# all have the same domain id. The result set should be empty due to
+# implicit filtering from stop position and ignoring that same domain.
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-1";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(0);
+START SLAVE UNTIL master_gtid_pos="0-3-3";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-domain-ids=0 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 0 tables
+# Verifying integrity of tables..
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 21: Ensure consistency when filtering by
+# --ignore-domain-ids with both a start position and stop position that
+# have differing domain ids. The ignore domain ids should take no
+# effect due to the implicit filtering by stop position, i.e. the
+# specified domain to ignore is already being filtered.
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-1";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_DOMAIN_IDS=(1);
+START SLAVE UNTIL master_gtid_pos="0-3-3";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-1 --ignore-domain-ids=1 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 22: Ensure consistency when filtering by
+# --ignore-server-ids with both a start position and stop position.
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+set global gtid_slave_pos="0-1-0";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(3);
+START SLAVE UNTIL master_gtid_pos="0-3-3";
+# No slave error expecting - waiting for slave to catch up to master
+# Because there is a stop position we wait for all events to process
+# and slave to automatically stop
+# Stop slave so it stops receiving master events.
+Warnings:
+Note 1255 Slave already has been stopped
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --start-position=0-1-0 --ignore-server-ids=3 --stop-position=0-3-3 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+# All tables are consistent
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t2,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+connection master;
+#
+#
+# Test Case 23: Out of order GTIDs from domains or servers which are
+# filtered out should not error
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=1;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_SERVER_IDS=(3);
+START SLAVE ;
+# No slave error expecting - waiting for slave to catch up to master
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t4,test.t5'
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=0 --ignore-server-ids=3 --gtid-strict-mode 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t1 is equivalent on master and slave
+# All tables are consistent
+# Strict mode enabled - checking mysqlbinlog error output for out
+# of order GTIDs
+# Not expecting to find out of order GTID error..
+NOT FOUND /Found out of order GTID/ in mysqlbinlog_stderr.out
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t2,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection master;
+#
+#
+# Test Case 24: Out of order GTIDs from included domains should error
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=1;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(1);
+START SLAVE ;
+# slave SQL Thread error expected - waiting for errno 1950
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t4,test.t5'
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --do-domain-ids=1 --gtid-strict-mode 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t3 is equivalent on master and slave
+# All tables are consistent
+# Strict mode enabled - checking mysqlbinlog error output for out
+# of order GTIDs
+# Expecting to find out of order GTID error..
+FOUND 1 /Found out of order GTID/ in mysqlbinlog_stderr.out
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t2,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection master;
+#
+#
+# Test Case 25: Out of order GTIDs from included servers should error
+#
+include/mysqlbinlog_slave_consistency.inc
+connection slave;
+set @@global.gtid_strict_mode=1;
+connection slave;
+connection master;
+# Populating master data
+connection slave;
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, IGNORE_SERVER_IDS=(1);
+START SLAVE ;
+# slave SQL Thread error expected - waiting for errno 1950
+# Stop slave so it stops receiving master events.
+connection master;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t4,test.t5'
+RESET MASTER;
+# MYSQL_BINLOG BINLOG_FILE_PARAM --ignore-server-ids=1 --gtid-strict-mode 2> MYSQLBINLOG_STDERR | MYSQL
+connection slave;
+# Checking consistency of 'test' database tables between master and slave
+connection master;
+# Both servers have 1 tables
+# Verifying integrity of tables..
+connection master;
+connection slave;
+# t2 is equivalent on master and slave
+# All tables are consistent
+# Strict mode enabled - checking mysqlbinlog error output for out
+# of order GTIDs
+# Expecting to find out of order GTID error..
+FOUND 1 /Found out of order GTID/ in mysqlbinlog_stderr.out
+# Test finished - resetting master and slave..
+connection slave;
+RESET SLAVE;
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=(), IGNORE_SERVER_IDS=();
+connection master;
+RESET MASTER;
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
+Warnings:
+Note 1051 Unknown table 'test.t1,test.t3,test.t4,test.t5'
+connection slave;
+RESET SLAVE;
+set global gtid_slave_pos="";
+RESET MASTER;
+connection master;
+RESET MASTER;
+connection slave;
+set @@global.gtid_strict_mode=0;
+connection master;
+#
+#
+# Test Case 26: Neither mysqlbinlog nor CHANGE MASTER TO should allow
+# both do domain ids and ignore domain ids to be set together
+#
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_DOMAIN_IDS=(1);
+ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
+include/start_slave.inc
+connection master;
+RESET MASTER;
+include/rpl_end.inc
+# End of tests (rpl.rpl_mysqlbinlog_slave_consistency)
diff --git a/mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test b/mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test
new file mode 100644
index 00000000000..d2918e3a890
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mysqlbinlog_slave_consistency.test
@@ -0,0 +1,401 @@
+#
+# Purpose:
+#
+# This test ensures the mariadb-binlog command line tool filters events
+# by domain id (via --do-domain-ids and --ignore-domain-ids) and server id (via
+# --ignore-server-ids) in the same way that a replica server does.
+#
+#
+# Methodology:
+#
+# This test validates that the domain and server id filtering logic of
+# mariadb-binlog matches that of a replica server. In particular, it validates
+# a mariadb-binlog replay of a master's binary log is consistent with a
+# replica's state which is configured using the same filtering configuration.
+#
+# It uses a repeatable process to allow for multiple test cases that span
+# different filtering configurations. First, a master is seeded with an initial
+# set of SQL statements with varying domain and server ids. Then, a set of
+# filtering parameters supported by both mariadb-binlog and replica
+# capabilities are defined. The replica is configured using these parameters
+# and run it until it has processed all events from the primary server; it is
+# stopped afterward. For mariadb-binlog validation, the binary log of the
+# primary server is copied to a different location for later replay. The
+# primary is then reset to its initial state (i.e. the tables are dropped and
+# the logs are reset). The mariadb-binlog tool is then used to replay the
+# copied binary log file back onto the clean primary server under the same
+# filtering conditions as the replica. At this point, the data on the primary
+# and replica should be exactly the same because the filtering conditions were
+# the same, and all existing tables on both servers are compared using.
+# checksums.
+#
+#
+# References:
+#
+# MDEV-20119: Implement the --do-domain-ids, --ignore-domain-ids, and
+# --ignore-server-ids options for mysqlbinlog
+#
+--source include/master-slave.inc
+
+--connection slave
+SET sql_log_bin=0;
+call mtr.add_suppression("Slave: An attempt was made.*");
+call mtr.add_suppression("Both DO_DOMAIN_IDS & IGNORE_DOMAIN_IDS lists can't be non-empty at the same time");
+SET sql_log_bin=1;
+
+--source include/stop_slave.inc
+
+--connection master
+RESET MASTER;
+
+# Save old state
+let $ORIG_GTID_DOMAIN_ID = `select @@session.gtid_domain_id`;
+let $ORIG_SERVER_ID = `select @@session.server_id`;
+
+--connection slave
+--source include/start_slave.inc
+
+# Initial tests do not use strict mode
+--let $strict_mode=0
+--let $slave_sql_errno=0
+
+--echo #
+--echo #
+--echo # Test Case 1: Base case to ensure that mariadb-binlog and replica
+--echo # are consistent without any filtering
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 2: Ensure filtering by a single id in --do-domain-ids is
+--echo # consistent between mariadb-binlog and replica
+--echo #
+--let $do_domain_ids=0
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 3: Ensure filtering by multiple ids in --do-domain-ids is
+--echo # consistent between mariadb-binlog and replica
+--echo #
+--let $do_domain_ids=0,1
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo # Test Case 4: Ensure filtering by a single id in --ignore-domain-ids
+--echo # is consistent between mariadb-binlog and replica
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=0
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 5: Ensure filtering by multiple ids in --ignore-domain-ids
+--echo # is consistent between mariadb-binlog and replica
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=0,1
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo # Test Case 6: Ensure filtering by a single id in --ignore-server-ids
+--echo # is consistent between mariadb-binlog and replica
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=1
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 7: Ensure filtering by multiple ids in --ignore-server-ids
+--echo # is consistent between mariadb-binlog and replica
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=0,1
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 8: Ensure stop position consistency
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=1-1-2
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 9: Ensure start position consistency
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=1-4-2
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 10: Ensure consistency when filtering by both
+--echo # --do-domain-ids and --ignore-server-ids
+--echo #
+--let $do_domain_ids=0
+--let $ignore_domain_ids=
+--let $ignore_server_ids=1
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 11: Ensure consistency when filtering by both
+--echo # --ignore-domain-ids and --ignore-server-ids
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=1,2
+--let $ignore_server_ids=1
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 12: Ensure consistency when filtering by
+--echo # --do-domain-ids with a stop position
+--echo #
+--let $do_domain_ids=0
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=0-1-4
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 13: Ensure consistency when filtering by
+--echo # --ignore-domain-ids with a stop position
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=0
+--let $ignore_server_ids=
+--let $stop_position=0-1-4
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 14: Ensure consistency when filtering by
+--echo # --ignore-server-ids with a stop position
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=3
+--let $stop_position=0-1-4
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 15: Ensure consistency when filtering by
+--echo # --do-domain-ids with a start position
+--echo #
+--let $do_domain_ids=2
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=1-1-2
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 16: Ensure consistency when filtering by
+--echo # --ignore-domain-ids with a start position
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=0
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=0-1-1
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 17: Ensure consistency when filtering by
+--echo # --ignore-server-ids with a start position
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=1
+--let $stop_position=
+--let $start_position=0-1-1
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 18: Ensure consistency when filtering by
+--echo # --do-domain-ids with both a start position and stop position that
+--echo # all have the same domain id
+--echo #
+--let $do_domain_ids=0
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=0-3-3
+--let $start_position=0-1-1
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 19: Ensure consistency when filtering by
+--echo # --do-domain-ids with both a start position and stop position that
+--echo # have differing domain ids. Due to the implicit filtering in stop
+--echo # position, the result should be empty (no tables replicated).
+--echo #
+--let $do_domain_ids=1
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=0-3-3
+--let $start_position=0-1-1
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 20: Ensure consistency when filtering by
+--echo # --ignore-domain-ids with both a start position and stop position that
+--echo # all have the same domain id. The result set should be empty due to
+--echo # implicit filtering from stop position and ignoring that same domain.
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=0
+--let $ignore_server_ids=
+--let $stop_position=0-3-3
+--let $start_position=0-1-1
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 21: Ensure consistency when filtering by
+--echo # --ignore-domain-ids with both a start position and stop position that
+--echo # have differing domain ids. The ignore domain ids should take no
+--echo # effect due to the implicit filtering by stop position, i.e. the
+--echo # specified domain to ignore is already being filtered.
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=1
+--let $ignore_server_ids=
+--let $stop_position=0-3-3
+--let $start_position=0-1-1
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 22: Ensure consistency when filtering by
+--echo # --ignore-server-ids with both a start position and stop position.
+--echo #
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=3
+--let $stop_position=0-3-3
+--let $start_position=0-1-0
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 23: Out of order GTIDs from domains or servers which are
+--echo # filtered out should not error
+--echo #
+--let $strict_mode=1
+--let $strict_mode_err=0
+--let $slave_sql_errno=0
+--let $do_domain_ids=0
+--let $ignore_domain_ids=
+--let $ignore_server_ids=3
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 24: Out of order GTIDs from included domains should error
+--echo #
+--let $strict_mode=1
+--let $strict_mode_err=1
+--let $slave_sql_errno=1950
+--let $do_domain_ids=1
+--let $ignore_domain_ids=
+--let $ignore_server_ids=
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 25: Out of order GTIDs from included servers should error
+--echo #
+--let $strict_mode=1
+--let $strict_mode_err=1
+--let $slave_sql_errno=1950
+--let $do_domain_ids=
+--let $ignore_domain_ids=
+--let $ignore_server_ids=1
+--let $stop_position=
+--let $start_position=
+--source include/mysqlbinlog_slave_consistency.inc
+
+--echo #
+--echo #
+--echo # Test Case 26: Neither mysqlbinlog nor CHANGE MASTER TO should allow
+--echo # both do domain ids and ignore domain ids to be set together
+--echo #
+--connection slave
+--source include/stop_slave.inc
+
+--error 1201
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(0), IGNORE_DOMAIN_IDS=(1);
+
+--let $MYSQLD_DATADIR=`select @@datadir`
+--let BINLOG_FILENAME= query_get_value(SHOW BINARY LOGS, Log_name, 1)
+--let BINLOG_FILE_PARAM= $MYSQLD_DATADIR/$BINLOG_FILENAME.orig
+--error 1
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$BINLOG_FILENAME --do-domain-ids=0 --ignore-domain-ids=1
+
+RESET MASTER;
+set global gtid_slave_pos="";
+CHANGE MASTER TO MASTER_USE_GTID=slave_pos, DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
+--source include/start_slave.inc
+
+# Cleanup
+--connection master
+RESET MASTER;
+
+--source include/rpl_end.inc
+
+--echo # End of tests (rpl.rpl_mysqlbinlog_slave_consistency)
diff --git a/mysql-test/suite/sys_vars/r/character_set_client_basic.result b/mysql-test/suite/sys_vars/r/character_set_client_basic.result
index a15e1d10b79..14c8bcfd058 100644
--- a/mysql-test/suite/sys_vars/r/character_set_client_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_client_basic.result
@@ -383,10 +383,9 @@ SET @@character_set_client = 1;
SELECT @@character_set_client;
@@character_set_client
big5
+# latin2_czech_cs is not a default collation
SET @@character_set_client = 2;
-SELECT @@character_set_client;
-@@character_set_client
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@character_set_client = 3;
SELECT @@character_set_client;
@@character_set_client
@@ -395,20 +394,19 @@ SET @@character_set_client = 36;
SELECT @@character_set_client;
@@character_set_client
cp866
+# cp1250_polish_ci is not a default collation
SET @@character_set_client = 99;
-SELECT @@character_set_client;
-@@character_set_client
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@character_set_client = 100;
ERROR 42000: Unknown character set: '100'
SET @@global.character_set_client = 1;
SELECT @@global.character_set_client;
@@global.character_set_client
big5
+# latin2_czech_cs is not a default collation
SET @@global.character_set_client = 2;
-SELECT @@global.character_set_client;
-@@global.character_set_client
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@global.character_set_client = 3;
SELECT @@global.character_set_client;
@@global.character_set_client
@@ -417,10 +415,10 @@ SET @@global.character_set_client = 36;
SELECT @@global.character_set_client;
@@global.character_set_client
cp866
+# cp1250_polish_ci is not a default collation
SET @@global.character_set_client = 99;
-SELECT @@global.character_set_client;
-@@global.character_set_client
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@global.character_set_client = 100;
ERROR 42000: Unknown character set: '100'
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
@@ -497,5 +495,21 @@ SELECT @@session.character_set_client =
WHERE VARIABLE_NAME='character_set_client') AS res;
res
1
+#
+# MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES
+#
+SET GLOBAL character_set_client=2;
+ERROR 42000: Unknown character set: '2'
+#
+# MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+#
+SET @@pseudo_slave_mode=1;
+SET character_set_client=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_client';
+Variable_name Value
+character_set_client latin2
+SET @@pseudo_slave_mode=0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_client = @global_start_value;
SET @@session.character_set_client = @session_start_value;
diff --git a/mysql-test/suite/sys_vars/r/character_set_connection_basic.result b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result
index 6d098f37bd1..bbb4f4e5f75 100644
--- a/mysql-test/suite/sys_vars/r/character_set_connection_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_connection_basic.result
@@ -378,10 +378,9 @@ SET @@character_set_connection = 1;
SELECT @@character_set_connection;
@@character_set_connection
big5
+# latin2_czech_cs is not a default collation
SET @@character_set_connection = 2;
-SELECT @@character_set_connection;
-@@character_set_connection
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@character_set_connection = 3;
SELECT @@character_set_connection;
@@character_set_connection
@@ -390,20 +389,19 @@ SET @@character_set_connection = 36;
SELECT @@character_set_connection;
@@character_set_connection
cp866
+# cp1250_polish_ci is not a default collation
SET @@character_set_connection = 99;
-SELECT @@character_set_connection;
-@@character_set_connection
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@character_set_connection = 100;
ERROR 42000: Unknown character set: '100'
SET @@global.character_set_connection = 1;
SELECT @@global.character_set_connection;
@@global.character_set_connection
big5
+# latin2_czech_cs is not a default collation
SET @@global.character_set_connection = 2;
-SELECT @@global.character_set_connection;
-@@global.character_set_connection
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@global.character_set_connection = 3;
SELECT @@global.character_set_connection;
@@global.character_set_connection
@@ -412,10 +410,10 @@ SET @@global.character_set_connection = 36;
SELECT @@global.character_set_connection;
@@global.character_set_connection
cp866
+# cp1250_polish_ci is not a default collation
SET @@global.character_set_connection = 99;
-SELECT @@global.character_set_connection;
-@@global.character_set_connection
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@global.character_set_connection = 100;
ERROR 42000: Unknown character set: '100'
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
@@ -435,8 +433,12 @@ SET @@character_set_connection = -1;
ERROR 42000: Unknown character set: '-1'
SET @@character_set_connection = 'utf8 ';
ERROR 42000: Unknown character set: 'utf8 '
+SET @@character_set_connection=cp1250;
SET @@character_set_connection = 'lätin2';
ERROR 42000: Unknown character set: 'lätin2'
+SET @@character_set_connection=cp866;
+SET @@character_set_connection = 'lätin2';
+ERROR 42000: Unknown character set: 'l?tin2'
SET @@character_set_connection = true;
SELECT @@character_set_connection AS res_with_true;
res_with_true
@@ -492,5 +494,21 @@ SELECT @@session.character_set_connection =
WHERE VARIABLE_NAME='character_set_connection') AS res;
res
1
+#
+# MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+#
+SET character_set_connection=2/*latin2_czech_cs*/;
+ERROR 42000: Unknown character set: '2'
+SET @@pseudo_slave_mode=1;
+SET character_set_connection=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_connection';
+Variable_name Value
+character_set_connection latin2
+SHOW VARIABLES LIKE 'collation_connection';
+Variable_name Value
+collation_connection latin2_general_ci
+SET @@pseudo_slave_mode=0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_connection = @global_start_value;
SET @@global.character_set_client = @save_character_set_client;
diff --git a/mysql-test/suite/sys_vars/r/character_set_database_basic.result b/mysql-test/suite/sys_vars/r/character_set_database_basic.result
index 752dad8500e..c15e0531efc 100644
--- a/mysql-test/suite/sys_vars/r/character_set_database_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_database_basic.result
@@ -380,10 +380,9 @@ SET @@character_set_database = 1;
SELECT @@character_set_database;
@@character_set_database
big5
+# latin2_czech_cs is not a default collation
SET @@character_set_database = 2;
-SELECT @@character_set_database;
-@@character_set_database
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@character_set_database = 3;
SELECT @@character_set_database;
@@character_set_database
@@ -392,20 +391,19 @@ SET @@character_set_database = 36;
SELECT @@character_set_database;
@@character_set_database
cp866
+# cp1250_polish_ci is not a default collation
SET @@character_set_database = 99;
-SELECT @@character_set_database;
-@@character_set_database
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@character_set_database = 100;
ERROR 42000: Unknown character set: '100'
SET @@global.character_set_database = 1;
SELECT @@global.character_set_database;
@@global.character_set_database
big5
+# latin2_czech_cs is not a default collation
SET @@global.character_set_database = 2;
-SELECT @@global.character_set_database;
-@@global.character_set_database
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@global.character_set_database = 3;
SELECT @@global.character_set_database;
@@global.character_set_database
@@ -414,10 +412,10 @@ SET @@global.character_set_database = 36;
SELECT @@global.character_set_database;
@@global.character_set_database
cp866
+# cp1250_polish_ci is not a default collation
SET @@global.character_set_database = 99;
-SELECT @@global.character_set_database;
-@@global.character_set_database
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@global.character_set_database = 100;
ERROR 42000: Unknown character set: '100'
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
diff --git a/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result b/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result
index 8c5b5e524ba..da85a7dee54 100644
--- a/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_filesystem_basic.result
@@ -379,10 +379,9 @@ SET @@character_set_filesystem = 1;
SELECT @@character_set_filesystem;
@@character_set_filesystem
big5
+# latin2_czech_cs is not a default collation
SET @@character_set_filesystem = 2;
-SELECT @@character_set_filesystem;
-@@character_set_filesystem
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@character_set_filesystem = 3;
SELECT @@character_set_filesystem;
@@character_set_filesystem
@@ -391,10 +390,10 @@ SET @@character_set_filesystem = 36;
SELECT @@character_set_filesystem;
@@character_set_filesystem
cp866
+# cp1250_polish_ci is not a default collation
SET @@character_set_filesystem = 99;
-SELECT @@character_set_filesystem;
-@@character_set_filesystem
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@character_set_filesystem = 100;
ERROR 42000: Unknown character set: '100'
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
diff --git a/mysql-test/suite/sys_vars/r/character_set_results_basic.result b/mysql-test/suite/sys_vars/r/character_set_results_basic.result
index 86cd9265efb..1346c8b42ca 100644
--- a/mysql-test/suite/sys_vars/r/character_set_results_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_results_basic.result
Binary files differ
diff --git a/mysql-test/suite/sys_vars/r/character_set_server_basic.result b/mysql-test/suite/sys_vars/r/character_set_server_basic.result
index e395b048f42..7445be6aef1 100644
--- a/mysql-test/suite/sys_vars/r/character_set_server_basic.result
+++ b/mysql-test/suite/sys_vars/r/character_set_server_basic.result
@@ -382,10 +382,9 @@ SET @@character_set_server = 1;
SELECT @@character_set_server;
@@character_set_server
big5
+# latin2_czech_cs is not a default collation
SET @@character_set_server = 2;
-SELECT @@character_set_server;
-@@character_set_server
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@character_set_server = 3;
SELECT @@character_set_server;
@@character_set_server
@@ -394,28 +393,27 @@ SET @@character_set_server = 36;
SELECT @@character_set_server;
@@character_set_server
cp866
+# cp1250_polish_ci is not a default collation
SET @@character_set_server = 99;
-SELECT @@character_set_server;
-@@character_set_server
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@character_set_server = 100;
ERROR 42000: Unknown character set: '100'
SET @@global.character_set_server = 1;
SELECT @@global.character_set_server;
@@global.character_set_server
big5
+# latin2_czech_cs is not a default collation
SET @@global.character_set_server = 2;
-SELECT @@global.character_set_server;
-@@global.character_set_server
-latin2
+ERROR 42000: Unknown character set: '2'
SET @@global.character_set_server = 36;
SELECT @@global.character_set_server;
@@global.character_set_server
cp866
+# cp1250_polish_ci is not a default collation
SET @@global.character_set_server = 99;
-SELECT @@global.character_set_server;
-@@global.character_set_server
-cp1250
+ERROR 42000: Unknown character set: '99'
+# Collation ID 100 does not exist
SET @@global.character_set_server = 100;
ERROR 42000: Unknown character set: '100'
'#--------------------FN_DYNVARS_009_10-------------------------#'
@@ -488,5 +486,21 @@ SELECT @@session.character_set_server =
WHERE VARIABLE_NAME='character_set_server') AS res;
res
1
+#
+# MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+#
+SET character_set_server=2/*latin2_czech_cs*/;
+ERROR 42000: Unknown character set: '2'
+SET @@pseudo_slave_mode=1;
+SET character_set_server=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_server';
+Variable_name Value
+character_set_server latin2
+SHOW VARIABLES LIKE 'collation_server';
+Variable_name Value
+collation_server latin2_general_ci
+SET @@pseudo_slave_mode=0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
SET @@global.character_set_server = @global_start_value;
SET @@session.character_set_server = @session_start_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result
index c11f4ee617c..f3b7ac80523 100644
--- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_basic.result
@@ -24,6 +24,8 @@ select * from information_schema.session_variables where variable_name='innodb_c
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING none
set global innodb_change_buffering='none';
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
select @@global.innodb_change_buffering;
@@global.innodb_change_buffering
none
@@ -34,6 +36,8 @@ select * from information_schema.session_variables where variable_name='innodb_c
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING none
set @@global.innodb_change_buffering='inserts';
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
select @@global.innodb_change_buffering;
@@global.innodb_change_buffering
inserts
@@ -50,6 +54,8 @@ ERROR HY000: Variable 'innodb_change_buffering' is a GLOBAL variable and should
set global innodb_change_buffering=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering'
set global innodb_change_buffering=1;
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
SELECT @@global.innodb_change_buffering;
@@global.innodb_change_buffering
inserts
@@ -60,6 +66,8 @@ ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering'
set global innodb_change_buffering='some';
ERROR 42000: Variable 'innodb_change_buffering' can't be set to the value of 'some'
SET @@global.innodb_change_buffering = @start_global_value;
+Warnings:
+Warning 1287 '@@innodb_change_buffering' is deprecated and will be removed in a future release
SELECT @@global.innodb_change_buffering;
@@global.innodb_change_buffering
none
diff --git a/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result
index 119e95df1e1..0c83f03d35a 100644
--- a/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_log_file_size_basic.result
@@ -4,9 +4,7 @@ COUNT(@@GLOBAL.innodb_log_file_size)
1
1 Expected
'#---------------------BS_STVARS_035_02----------------------#'
-SET @@GLOBAL.innodb_log_file_size=1;
-ERROR HY000: Variable 'innodb_log_file_size' is a read only variable
-Expected error 'Read only variable'
+SET @@GLOBAL.innodb_log_file_size=10485760;
SELECT COUNT(@@GLOBAL.innodb_log_file_size);
COUNT(@@GLOBAL.innodb_log_file_size)
1
diff --git a/mysql-test/suite/sys_vars/r/old_basic.result b/mysql-test/suite/sys_vars/r/old_basic.result
index bafe7128821..1eba60ed4a7 100644
--- a/mysql-test/suite/sys_vars/r/old_basic.result
+++ b/mysql-test/suite/sys_vars/r/old_basic.result
@@ -17,7 +17,11 @@ select * from information_schema.session_variables where variable_name='old';
VARIABLE_NAME VARIABLE_VALUE
OLD OFF
set global old=1;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
set session old=1;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
select @@global.old;
@@global.old
1
@@ -25,3 +29,5 @@ select @@session.old;
@@session.old
1
set @@global.old=DEFAULT;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
diff --git a/mysql-test/suite/sys_vars/r/old_mode_basic.result b/mysql-test/suite/sys_vars/r/old_mode_basic.result
index a6b95f1c60c..252316dc1cb 100644
--- a/mysql-test/suite/sys_vars/r/old_mode_basic.result
+++ b/mysql-test/suite/sys_vars/r/old_mode_basic.result
@@ -114,8 +114,8 @@ SET @@global.old_mode = 4;
SELECT @@global.old_mode;
@@global.old_mode
ZERO_DATE_TIME_CAST
-SET @@global.old_mode = 16;
-ERROR 42000: Variable 'old_mode' can't be set to the value of '16'
+SET @@global.old_mode = 64;
+ERROR 42000: Variable 'old_mode' can't be set to the value of '64'
SELECT @@global.old_mode;
@@global.old_mode
ZERO_DATE_TIME_CAST
@@ -264,3 +264,42 @@ SET @@collation_database = @save_collation_database;
#
# End of 10.6 test
#
+#
+# Beginning of 10.9 test
+#
+#
+# MDEV-24920: Merge "old" SQL variable to "old_mode" sql variable
+#
+# Checking that setting old will also set old_mode
+SELECT @@OLD_MODE;
+@@OLD_MODE
+UTF8_IS_UTF8MB3
+SET old= 1;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
+SELECT @@OLD_MODE;
+@@OLD_MODE
+NO_PROGRESS_INFO,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM
+SET old= DEFAULT;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
+SELECT @@OLD_MODE;
+@@OLD_MODE
+UTF8_IS_UTF8MB3
+# Checking that old_mode can be set independently as well
+SELECT @@OLD_MODE;
+@@OLD_MODE
+UTF8_IS_UTF8MB3
+SET @save_old_mode = @@OLD_MODE;
+SET @@OLD_MODE= IGNORE_INDEX_ONLY_FOR_JOIN;
+SELECT @@OLD_MODE;
+@@OLD_MODE
+IGNORE_INDEX_ONLY_FOR_JOIN
+SET @@OLD_MODE= COMPAT_5_1_CHECKSUM;
+SELECT @@OLD_MODE;
+@@OLD_MODE
+COMPAT_5_1_CHECKSUM
+SET @@OLD_MODE= @save_old_mode;
+#
+# End of 10.9 test
+#
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 4ded9b44ff3..047085339b7 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -1014,7 +1014,7 @@ NUMERIC_MIN_VALUE 4194304
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 4096
ENUM_VALUE_LIST NULL
-READ_ONLY YES
+READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOG_GROUP_HOME_DIR
SESSION_VALUE NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 8b8b9d9834c..6d854065538 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -2229,7 +2229,7 @@ VARIABLE_COMMENT Used to emulate old behavior from earlier MariaDB or MySQL vers
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3
+ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OLD_PASSWORDS
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 99857a3baf5..c180518210a 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -2399,7 +2399,7 @@ VARIABLE_COMMENT Used to emulate old behavior from earlier MariaDB or MySQL vers
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3
+ENUM_VALUE_LIST NO_DUP_KEY_WARNINGS_WITH_IGNORE,NO_PROGRESS_INFO,ZERO_DATE_TIME_CAST,UTF8_IS_UTF8MB3,IGNORE_INDEX_ONLY_FOR_JOIN,COMPAT_5_1_CHECKSUM
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME OLD_PASSWORDS
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index ae7cce823ef..df8b7c73f9d 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -706,6 +706,21 @@ ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
GLOBAL_VALUE_PATH NULL
+VARIABLE_NAME WSREP_STATUS_FILE
+SESSION_VALUE NULL
+GLOBAL_VALUE
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE VARCHAR
+VARIABLE_COMMENT wsrep status output filename
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST NULL
+READ_ONLY YES
+COMMAND_LINE_ARGUMENT REQUIRED
+GLOBAL_VALUE_PATH NULL
VARIABLE_NAME WSREP_SYNC_WAIT
SESSION_VALUE 0
GLOBAL_VALUE 0
diff --git a/mysql-test/suite/sys_vars/t/character_set_client_basic.test b/mysql-test/suite/sys_vars/t/character_set_client_basic.test
index e3461e4ac77..44c0d240a9d 100644
--- a/mysql-test/suite/sys_vars/t/character_set_client_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_client_basic.test
@@ -229,33 +229,44 @@ SELECT @@global.character_set_client;
##############################################################
SET @@character_set_client = 1;
SELECT @@character_set_client;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_client = 2;
-SELECT @@character_set_client;
+
SET @@character_set_client = 3;
SELECT @@character_set_client;
SET @@character_set_client = 36;
SELECT @@character_set_client;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_client = 99;
-SELECT @@character_set_client;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_client = 100;
SET @@global.character_set_client = 1;
SELECT @@global.character_set_client;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_client = 2;
-SELECT @@global.character_set_client;
+
SET @@global.character_set_client = 3;
SELECT @@global.character_set_client;
SET @@global.character_set_client = 36;
SELECT @@global.character_set_client;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_client = 99;
-SELECT @@global.character_set_client;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_client = 100;
-
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
SELECT @total_charset;
@@ -332,6 +343,22 @@ SELECT @@session.character_set_client =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_client') AS res;
+--echo #
+--echo # MDEV-28769 Assertion `(m_ci->state & 32) || m_with_collate' failed in Lex_exact_charset_opt_extended_collate::Lex_exact_charset_opt_extended_collate on SET NAMES
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET GLOBAL character_set_client=2;
+
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+SET @@pseudo_slave_mode=1;
+SET character_set_client=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_client';
+SET @@pseudo_slave_mode=0;
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
index 5d6412dd420..46bdfcb52e2 100644
--- a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test
@@ -155,30 +155,42 @@ SELECT @@global.character_set_connection;
##############################################################
SET @@character_set_connection = 1;
SELECT @@character_set_connection;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_connection = 2;
-SELECT @@character_set_connection;
+
SET @@character_set_connection = 3;
SELECT @@character_set_connection;
SET @@character_set_connection = 36;
SELECT @@character_set_connection;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_connection = 99;
-SELECT @@character_set_connection;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_connection = 100;
SET @@global.character_set_connection = 1;
SELECT @@global.character_set_connection;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_connection = 2;
-SELECT @@global.character_set_connection;
+
SET @@global.character_set_connection = 3;
SELECT @@global.character_set_connection;
SET @@global.character_set_connection = 36;
SELECT @@global.character_set_connection;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_connection = 99;
-SELECT @@global.character_set_connection;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_connection = 100;
@@ -201,6 +213,10 @@ SET @@character_set_connection = 1.1;
SET @@character_set_connection = -1;
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_connection = 'utf8 ';
+SET @@character_set_connection=cp1250;
+--Error ER_UNKNOWN_CHARACTER_SET
+SET @@character_set_connection = 'lätin2';
+SET @@character_set_connection=cp866;
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_connection = 'lätin2';
SET @@character_set_connection = true;
@@ -259,6 +275,19 @@ SELECT @@session.character_set_connection =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_connection') AS res;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_connection=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_connection=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_connection';
+SHOW VARIABLES LIKE 'collation_connection';
+SET @@pseudo_slave_mode=0;
+
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_database_basic.test b/mysql-test/suite/sys_vars/t/character_set_database_basic.test
index 54ccc5afddb..95ffa83950f 100644
--- a/mysql-test/suite/sys_vars/t/character_set_database_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_database_basic.test
@@ -154,30 +154,42 @@ SELECT @@global.character_set_database;
##############################################################
SET @@character_set_database = 1;
SELECT @@character_set_database;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_database = 2;
-SELECT @@character_set_database;
+
SET @@character_set_database = 3;
SELECT @@character_set_database;
SET @@character_set_database = 36;
SELECT @@character_set_database;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_database = 99;
-SELECT @@character_set_database;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_database = 100;
SET @@global.character_set_database = 1;
SELECT @@global.character_set_database;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_database = 2;
-SELECT @@global.character_set_database;
+
SET @@global.character_set_database = 3;
SELECT @@global.character_set_database;
SET @@global.character_set_database = 36;
SELECT @@global.character_set_database;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_database = 99;
-SELECT @@global.character_set_database;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_database = 100;
diff --git a/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test
index 33b77eede06..b3ebb38360e 100644
--- a/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test
@@ -151,15 +151,21 @@ SELECT @@character_set_filesystem;
##############################################################
SET @@character_set_filesystem = 1;
SELECT @@character_set_filesystem;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_filesystem = 2;
-SELECT @@character_set_filesystem;
+
SET @@character_set_filesystem = 3;
SELECT @@character_set_filesystem;
SET @@character_set_filesystem = 36;
SELECT @@character_set_filesystem;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_filesystem = 99;
-SELECT @@character_set_filesystem;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_filesystem = 100;
diff --git a/mysql-test/suite/sys_vars/t/character_set_results_basic.test b/mysql-test/suite/sys_vars/t/character_set_results_basic.test
index cca2277713e..41090be6657 100644
--- a/mysql-test/suite/sys_vars/t/character_set_results_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_results_basic.test
@@ -153,29 +153,42 @@ SELECT @@global.character_set_results;
##############################################################
SET @@character_set_results = 1;
SELECT @@character_set_results;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_results = 2;
-SELECT @@character_set_results;
+
SET @@character_set_results = 3;
SELECT @@character_set_results;
SET @@character_set_results = 36;
SELECT @@character_set_results;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_results = 99;
-SELECT @@character_set_results;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_results = 100;
+
SET @@global.character_set_results = 1;
SELECT @@global.character_set_results;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_results = 2;
-SELECT @@global.character_set_results;
+
SET @@global.character_set_results = 3;
SELECT @@global.character_set_results;
SET @@global.character_set_results = 36;
SELECT @@global.character_set_results;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_results = 99;
-SELECT @@global.character_set_results;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_results = 100;
@@ -259,6 +272,18 @@ SELECT @@session.character_set_results =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_results') AS res;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_results=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_results=2;
+SHOW VARIABLES LIKE 'character_set_results';
+SET @@pseudo_slave_mode=0;
+
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/character_set_server_basic.test b/mysql-test/suite/sys_vars/t/character_set_server_basic.test
index de090348307..929dbfaf143 100644
--- a/mysql-test/suite/sys_vars/t/character_set_server_basic.test
+++ b/mysql-test/suite/sys_vars/t/character_set_server_basic.test
@@ -155,27 +155,39 @@ SELECT @@global.character_set_server;
##############################################################
SET @@character_set_server = 1;
SELECT @@character_set_server;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_server = 2;
-SELECT @@character_set_server;
+
SET @@character_set_server = 3;
SELECT @@character_set_server;
SET @@character_set_server = 36;
SELECT @@character_set_server;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_server = 99;
-SELECT @@character_set_server;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@character_set_server = 100;
SET @@global.character_set_server = 1;
SELECT @@global.character_set_server;
+
+--echo # latin2_czech_cs is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_server = 2;
-SELECT @@global.character_set_server;
+
SET @@global.character_set_server = 36;
SELECT @@global.character_set_server;
+
+--echo # cp1250_polish_ci is not a default collation
+--error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_server = 99;
-SELECT @@global.character_set_server;
+--echo # Collation ID 100 does not exist
--Error ER_UNKNOWN_CHARACTER_SET
SET @@global.character_set_server = 100;
@@ -254,6 +266,18 @@ SELECT @@session.character_set_server =
(SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='character_set_server') AS res;
+--echo #
+--echo # MDEV-31018 Replica of 10.3, 10.4, <10.5.19 and <10.6.12 to 10.11 will not work when using non-default charset
+--echo #
+
+--error ER_UNKNOWN_CHARACTER_SET
+SET character_set_server=2/*latin2_czech_cs*/;
+SET @@pseudo_slave_mode=1;
+SET character_set_server=2/*latin2_czech_cs*/;
+SHOW VARIABLES LIKE 'character_set_server';
+SHOW VARIABLES LIKE 'collation_server';
+SET @@pseudo_slave_mode=0;
+
####################################
# Restore initial value #
####################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test
index 21fd2a80021..4d67c22e619 100644
--- a/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test
@@ -37,9 +37,8 @@ SELECT COUNT(@@GLOBAL.innodb_log_file_size);
# Check if Value can set #
####################################################################
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.innodb_log_file_size=1;
---echo Expected error 'Read only variable'
+#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.innodb_log_file_size=10485760;
SELECT COUNT(@@GLOBAL.innodb_log_file_size);
--echo 1 Expected
diff --git a/mysql-test/suite/sys_vars/t/old_mode_basic.test b/mysql-test/suite/sys_vars/t/old_mode_basic.test
index f2fba791859..631d638767f 100644
--- a/mysql-test/suite/sys_vars/t/old_mode_basic.test
+++ b/mysql-test/suite/sys_vars/t/old_mode_basic.test
@@ -172,7 +172,7 @@ SET @@global.old_mode = 4;
SELECT @@global.old_mode;
--Error ER_WRONG_VALUE_FOR_VAR
-SET @@global.old_mode = 16;
+SET @@global.old_mode = 64;
SELECT @@global.old_mode;
# use of decimal values
@@ -314,6 +314,39 @@ SET @@collation_database = @save_collation_database;
--echo # End of 10.6 test
--echo #
+--echo #
+--echo # Beginning of 10.9 test
+--echo #
+--echo #
+--echo # MDEV-24920: Merge "old" SQL variable to "old_mode" sql variable
+--echo #
+
+--echo # Checking that setting old will also set old_mode
+SELECT @@OLD_MODE;
+
+SET old= 1;
+SELECT @@OLD_MODE;
+
+SET old= DEFAULT;
+SELECT @@OLD_MODE;
+
+--echo # Checking that old_mode can be set independently as well
+
+SELECT @@OLD_MODE;
+
+SET @save_old_mode = @@OLD_MODE;
+
+SET @@OLD_MODE= IGNORE_INDEX_ONLY_FOR_JOIN;
+SELECT @@OLD_MODE;
+
+SET @@OLD_MODE= COMPAT_5_1_CHECKSUM;
+SELECT @@OLD_MODE;
+
+SET @@OLD_MODE= @save_old_mode;
+
+--echo #
+--echo # End of 10.9 test
+--echo #
################################################################
# END OF old_mode TESTS #
################################################################
diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc
index 0c65720fa1a..aff6b9fbc2d 100644
--- a/mysql-test/suite/versioning/common.inc
+++ b/mysql-test/suite/versioning/common.inc
@@ -6,6 +6,7 @@ source include/have_innodb.inc;
--disable_query_log
set @@session.time_zone='+00:00';
+set @@global.time_zone='+00:00';
select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry;
set @test_start=now(6);
diff --git a/mysql-test/suite/versioning/common_finish.inc b/mysql-test/suite/versioning/common_finish.inc
index 3c4e7b66ff3..255daa1963a 100644
--- a/mysql-test/suite/versioning/common_finish.inc
+++ b/mysql-test/suite/versioning/common_finish.inc
@@ -6,5 +6,6 @@ drop function if exists current_row;
drop function if exists check_row;
drop function if exists current_row_ts;
drop function if exists check_row_ts;
+set @@global.time_zone= default;
--enable_warnings
--enable_query_log
diff --git a/mysql-test/suite/versioning/r/debug.result b/mysql-test/suite/versioning/r/debug.result
index 3efddd40275..2c944f75436 100644
--- a/mysql-test/suite/versioning/r/debug.result
+++ b/mysql-test/suite/versioning/r/debug.result
@@ -51,6 +51,8 @@ t4 CREATE TABLE `t4` (
PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
drop table t1, t2, t3, t4;
+set debug_dbug= @old_dbug;
+set global debug_dbug= @old_dbug;
#
# MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image()
#
@@ -63,4 +65,42 @@ Level Code Message
Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
Error 1033 Incorrect information in file: './test/t1.frm'
drop table t1;
-set global debug_dbug=@old_dbug;
+set debug_dbug= @old_dbug;
+#
+# MDEV-17554 Auto-create new partition for system versioned tables
+# with history partitioned by INTERVAL/LIMIT
+#
+call mtr.add_suppression("need more HISTORY partitions");
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 1 auto partitions 2;
+insert into t1 values (1);
+update t1 set x= x + 1;
+connect con2, localhost, root;
+connect con1, localhost, root;
+# Both threads create partition simultaneously
+connection con1;
+set debug_sync= 'add_history_partition signal s1 wait_for s2';
+update t1 set x= x + 10;
+connection con2;
+set debug_sync= 'now wait_for s1';
+flush tables t1;
+set debug_sync= 'add_history_partition signal s2';
+update t1 set x= x + 20;
+connection con1;
+connection default;
+update t1 set x= x + 2;
+# Second thread skips to reopen 3 times until first thread creates partition
+connection con1;
+set debug_sync= 'add_history_partition SIGNAL s1 WAIT_FOR s2';
+update t1 set x= x + 30;
+connection con2;
+set debug_sync= 'now WAIT_FOR s1';
+set debug_sync= 'reopen_history_partition SIGNAL s2 EXECUTE 3';
+update t1 set x= x + 40;
+connection con1;
+connection default;
+disconnect con1;
+disconnect con2;
+set @@timestamp= default;
+drop tables t1;
+set debug_sync= 'reset';
diff --git a/mysql-test/suite/versioning/r/delete_history.result b/mysql-test/suite/versioning/r/delete_history.result
index d07c71ee9f5..9365145e699 100644
--- a/mysql-test/suite/versioning/r/delete_history.result
+++ b/mysql-test/suite/versioning/r/delete_history.result
@@ -224,3 +224,22 @@ ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
DROP TABLE t1;
# End of 10.4 tests
+#
+# MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
+#
+# Don't auto-create new partition on DELETE HISTORY:
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+set timestamp= unix_timestamp('2000-01-01 10:00:00');
+delete history from t;
+set timestamp= default;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 2
+drop table t;
+# End of 10.9 tests
diff --git a/mysql-test/suite/versioning/r/not_embedded.result b/mysql-test/suite/versioning/r/not_embedded.result
index b8972a48370..23574f34da9 100644
--- a/mysql-test/suite/versioning/r/not_embedded.result
+++ b/mysql-test/suite/versioning/r/not_embedded.result
@@ -70,3 +70,26 @@ drop database mysqltest;
disconnect user1;
disconnect root;
connection default;
+#
+# MDEV-25559 Auto-create: infinite loop after interrupted lock wait
+#
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create table t (pk int primary key, a int) engine innodb with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1, 0);
+begin;
+update t set a= a + 1;
+connect con1,localhost,root,,;
+set max_statement_time= 1;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t set a= a + 2;
+connection default;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t set a= a + 3;
+connection con1;
+ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
+disconnect con1;
+connection default;
+commit;
+drop table t;
+set timestamp= default;
diff --git a/mysql-test/suite/versioning/r/partition,heap.rdiff b/mysql-test/suite/versioning/r/partition,heap.rdiff
index 361a74a4271..387a3cee754 100644
--- a/mysql-test/suite/versioning/r/partition,heap.rdiff
+++ b/mysql-test/suite/versioning/r/partition,heap.rdiff
@@ -1,4 +1,4 @@
-@@ -1969,85 +1969,6 @@
+@@ -2132,85 +2132,6 @@
(PARTITION `p0` HISTORY ENGINE = X,
PARTITION `pn` CURRENT ENGINE = X)
drop tables t1, tp1;
@@ -84,3 +84,138 @@
#
# End of 10.7 tests
#
+@@ -2765,134 +2686,6 @@
+ Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
+ drop prepare s;
+ affected rows: 0
+-# Complex table
+-set timestamp= unix_timestamp('2000-01-01 00:00:00');
+-affected rows: 0
+-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,
+-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 system_time interval 1 hour auto (
+-partition p2 history,
+-partition pn current);
+-affected rows: 0
+-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 `u` (`u`,`e`),
+- KEY `three` (`i1`,`i2`,`i3`),
+- PERIOD FOR SYSTEM_TIME (`s`, `e`),
+- CONSTRAINT `check_constr` CHECK (`u` > -1)
+-) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+-(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+- PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+-affected rows: 1
+-insert into t1 (x, c, u, i1, i2, i3, ps, pe)
+-values (1, 'cc', 0, 1, 2, 3, '1999-01-01', '2000-01-01');
+-affected rows: 1
+-set timestamp= unix_timestamp('2000-01-01 01:00:00');
+-affected rows: 0
+-update t1 set x= x + 8;
+-affected rows: 1
+-info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+-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 `u` (`u`,`e`),
+- KEY `three` (`i1`,`i2`,`i3`),
+- PERIOD FOR SYSTEM_TIME (`s`, `e`),
+- CONSTRAINT `check_constr` CHECK (`u` > -1)
+-) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+-(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+- PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+- PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+-affected rows: 1
+-set timestamp= unix_timestamp('2000-01-01 02:00:00');
+-affected rows: 0
+-update t1 set x= x - 8;
+-affected rows: 1
+-info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+-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 `u` (`u`,`e`),
+- KEY `three` (`i1`,`i2`,`i3`),
+- PERIOD FOR SYSTEM_TIME (`s`, `e`),
+- CONSTRAINT `check_constr` CHECK (`u` > -1)
+-) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+- PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+-(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+- PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+- PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
+- PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+-affected rows: 1
+ # INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
+ set timestamp= unix_timestamp('2000-01-01 00:00:00');
+ create or replace table t1 (x int primary key) with system versioning
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 6feee27818b..0266464c5d6 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -247,7 +247,9 @@ select @ts0 = @ts1;
select @ts2 = @ts3;
@ts2 = @ts3
1
-## rotation by LIMIT
+#
+# Rotation by LIMIT
+#
create or replace table t1 (x int)
with system versioning
partition by system_time limit 0 partitions 3;
@@ -301,7 +303,9 @@ x
6
7
8
-## rotation by INTERVAL
+#
+# Rotation by INTERVAL
+#
create or replace table t1 (x int)
with system versioning
partition by system_time interval 0 second partitions 3;
@@ -361,19 +365,25 @@ delete from t1;
set timestamp=unix_timestamp('2001-02-04 10:20:50');
insert t1 values (2);
delete from t1;
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
+select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name partition_description table_rows
p1sp0 2001-02-04 00:00:00 1
p1sp1 2001-02-04 00:00:00 1
pnsp0 CURRENT 0
pnsp1 CURRENT 0
+select * from t1 partition (p1);
+i
+1
+2
set timestamp=unix_timestamp('2001-02-04 10:20:55');
alter table t1 add partition (partition p0 history, partition p2 history);
set timestamp=unix_timestamp('2001-02-04 10:30:00');
insert t1 values (4),(5);
set timestamp=unix_timestamp('2001-02-04 10:30:10');
update t1 set i=6 where i=5;
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
subpartition_name partition_description table_rows
p1sp0 2001-02-04 00:00:00 1
p1sp1 2001-02-04 00:00:00 0
@@ -383,6 +393,25 @@ p2sp0 2001-02-06 00:00:00 0
p2sp1 2001-02-06 00:00:00 0
pnsp0 CURRENT 0
pnsp1 CURRENT 2
+select * from t1 partition (p1);
+i
+1
+select * from t1 partition (p0);
+i
+5
+2
+select * from t1 partition (p2);
+i
+alter table t1 rebuild partition p0, p1, p2;
+select * from t1 partition (p1);
+i
+1
+select * from t1 partition (p0);
+i
+5
+2
+select * from t1 partition (p2);
+i
## pruning check
set @ts=(select partition_description from information_schema.partitions
where table_schema='test' and table_name='t1' and partition_name='p0' limit 1);
@@ -566,12 +595,15 @@ set timestamp= unix_timestamp('2001-01-01 00:00:00');
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day starts '2000-01-01 00:00:00'
partitions 3;
-# we are warned when we push to present:
insert into t1 values (0);
set timestamp= unix_timestamp('2001-01-01 00:00:01');
update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
set timestamp= unix_timestamp('2001-01-01 00:00:02');
update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
select *, row_end from t1 partition (p0);
i row_end
select *, row_end from t1 partition (p1);
@@ -602,8 +634,8 @@ i row_end
select *, row_end from t1 partition (p1);
i row_end
3 2000-01-04 00:00:01.000000
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
# and this is how it usually goes:
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day
partitions 3;
@@ -614,8 +646,12 @@ set timestamp= unix_timestamp('2000-01-02 00:00:01');
update t1 set i= i + 1;
set timestamp= unix_timestamp('2000-01-03 00:00:01');
update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
set timestamp= unix_timestamp('2000-01-04 00:00:01');
update t1 set i= i + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
alter table t1 add partition (partition p2 history, partition p3 history);
select *, row_end from t1 partition (p0);
i row_end
@@ -646,7 +682,6 @@ select * from t1 partition (pnsp1);
x
2
4
-### warn about full partition
delete from t1 where x < 3;
delete from t1;
Warnings:
@@ -1144,11 +1179,11 @@ f varchar(45000)
partition by system_time interval 1 year (partition p1 history,
partition pn current);
insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
-select * into outfile 'load.data' from t1;
-load data infile 'load.data' replace into table t1;
-load data infile 'load.data' replace into table t1;
+select * into outfile 'MDEV-17891.data' from t1;
+load data infile 'MDEV-17891.data' replace into table t1;
+load data infile 'MDEV-17891.data' replace into table t1;
ERROR HY000: The table 't1' is full
-load data infile 'load.data' replace into table t1;
+load data infile 'MDEV-17891.data' replace into table t1;
ERROR HY000: The table 't1' is full
set @@max_heap_table_size= 1048576;
drop table t1;
@@ -1170,6 +1205,8 @@ insert into t1 values (0);
update t1 set x= x + 1;
set timestamp= unix_timestamp('2000-01-01 02:00:01');
update t1 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p1`) is out of INTERVAL, need more HISTORY partitions
select *, row_start, row_end from t1 for system_time as of '2000-01-01 02:00:00';
x row_start row_end
1 2000-01-01 00:00:00.000000 2000-01-01 02:00:01.000000
@@ -1219,6 +1256,11 @@ delete from t1 partition (p0, pn);
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
delete from t1 partition (p0, p1, pn);
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
+lock tables t1 write;
+delete from t1 partition (p0, pn);
+ERROR HY000: Not allowed for system-versioned table `test`.`t1`
+delete from t1;
+unlock tables;
drop table t1;
set timestamp= default;
#
@@ -1792,8 +1834,129 @@ t1 CREATE TABLE `t1` (
PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
drop tables t1;
#
-# End of 10.5 tests
+# MDEV-27328 Change of SYSTEM_TIME partitioning options is not possible without data copy
#
+create or replace table t1 (f int) with system versioning
+partition by hash(f);
+alter table t1 partition by system_time;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME
+PARTITIONS 2
+create or replace table t1 (f int) with system versioning
+partition by system_time;
+alter table t1 partition by hash(f);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY HASH (`f`)
+create or replace table t1 (x int) with system versioning;
+alter table t1 partition by system_time;
+show create table t1;
+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 SYSTEM_TIME
+PARTITIONS 2
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 100 partitions 4;
+show create table t1;
+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 SYSTEM_TIME LIMIT 100
+PARTITIONS 4
+alter table t1 add partition partitions 2;
+alter table t1 partition by system_time;
+show create table t1;
+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 SYSTEM_TIME
+PARTITIONS 6
+alter table t1 partition by system_time limit 33;
+show create table t1;
+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 SYSTEM_TIME LIMIT 33
+PARTITIONS 6
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+insert t1 values (0);
+set timestamp= unix_timestamp('2000-01-01 00:10:00');
+update t1 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 01:30:00');
+update t1 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1;
+alter table t1 partition by system_time interval 1 hour
+starts '2000-01-01 00:00:00';
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00'
+PARTITIONS 6
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+1
+2
+select * from t1 partition (p2);
+x
+3
+select * from t1 partition (pn);
+x
+4
+set timestamp= default;
+alter table t1 partition by system_time limit 1;
+show create table t1;
+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 SYSTEM_TIME LIMIT 1
+PARTITIONS 6
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p4`) is out of LIMIT, need more HISTORY partitions
+# You see warning above ^
+select * from t1 partition (p0);
+x
+0
+select * from t1 partition (p1);
+x
+1
+2
+select * from t1 partition (p2);
+x
+3
+select * from t1 partition (p3);
+x
+4
+select * from t1 partition (p4);
+x
+5
+select * from t1 partition (pn);
+x
+6
+drop table t1;
+# End of 10.6 tests
#
# MDEV-22166 MIGRATE PARTITION: move out partition into a table
#
@@ -2172,4 +2335,1056 @@ drop tables t, tp;
#
# End of 10.7 tests
#
+#
+# MDEV-17554 Auto-create new partition for system versioned tables
+# with history partitioned by INTERVAL/LIMIT
+#
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 1 auto;
+show create table t1;
+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 SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 2
+# Turn off AUTO
+alter table t1 partition by system_time limit 1;
+show create table t1;
+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 SYSTEM_TIME LIMIT 1
+PARTITIONS 2
+# Get AUTO back
+alter table t1 partition by system_time limit 1 auto;
+show create table t1;
+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 SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 2
+insert into t1 values (1);
+create or replace table t2 (y int);
+insert into t2 values (2);
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+show create table t1;
+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 SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 2
+# Too many partitions error
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+set timestamp= unix_timestamp('2001-01-01 00:01:00');
+update t1 set x= x + 1;
+ERROR HY000: Versioned table `test`.`t1`: adding HISTORY partition(s) failed
+show warnings;
+Level Code Message
+Warning 1499 Too many partitions (including subpartitions) were defined
+Error 4189 Versioned table `test`.`t1`: adding HISTORY partition(s) failed
+# Auto-create failed error
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+insert into t1 values (1);
+call mtr.add_suppression("rror number .*(File exists|file operation)");
+call mtr.add_suppression("InnoDB: Cannot create file");
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1 set x= x + 2;
+ERROR HY000: Got error 184 "Tablespace already exists" from storage engine InnoDB
+show warnings;
+Level Code Message
+Error 1030 Got error 184 "Tablespace already exists" from storage engine InnoDB
+Warning 4189 Versioned table `test`.`t1`: adding HISTORY partition(s) failed
+# Partition overflow error and manual fix
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour;
+insert into t1 values (440);
+set timestamp= unix_timestamp('2000-01-01 00:10:00');
+update t1 set x= x + 1;
+# Check how pruning boundaries work
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,pn # NULL NULL NULL NULL # #
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,pn # NULL NULL NULL NULL # #
+explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,pn # NULL NULL NULL NULL # #
+select * from t1 for system_time as of '2000-01-01 00:09:59';
+x
+440
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1;
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
+select * from t1 for system_time as of '2000-01-01 01:00:00';
+x
+441
+select * from t1 partition (p0) order by x;
+x
+440
+441
+# Here is how manual fix works: just add new partitions there
+alter table t1 add partition partitions 3;
+select * from t1 for system_time as of '2000-01-01 01:00:00';
+x
+441
+select * from t1 partition (p0) order by x;
+x
+440
+# Check pruning after ALTER
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p0,p1,p2,p3,pn # NULL NULL NULL NULL # #
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3,pn # NULL NULL NULL NULL # #
+explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00';
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 p1,p2,p3,pn # NULL NULL NULL NULL # #
+drop table t1;
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 3600 second
+starts '2000-01-01 00:00:00' auto partitions 3;
+affected rows: 0
+insert into t1 values (1);
+affected rows: 1
+show create table t1;
+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 SYSTEM_TIME INTERVAL 3600 SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+affected rows: 0
+update t1 set x= x + 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 3600 SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+affected rows: 0
+update t1 set x= x + 2;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 3600 SECOND STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 5
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+affected rows: 0
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto (
+partition p1 history,
+partition p3 history,
+partition pn current);
+affected rows: 0
+insert into t1 values (1);
+affected rows: 1
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+affected rows: 0
+update t1 set x= x + 3;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+affected rows: 0
+update t1 set x= x + 4;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p4` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 04:00:00');
+affected rows: 0
+lock tables t1 write;
+affected rows: 0
+update t1 set x= x + 5;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p4` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p5` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+unlock tables;
+affected rows: 0
+set timestamp= default;
+affected rows: 0
+# Couple of more LOCK TABLES cases
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 1 auto;
+affected rows: 0
+lock tables t1 write;
+affected rows: 0
+insert into t1 values (1);
+affected rows: 1
+update t1 set x= x + 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+update t1 set x= x + 2;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+update t1 set x= x + 3;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 4
+affected rows: 1
+unlock tables;
+affected rows: 0
+show create table t1;
+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 SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 4
+affected rows: 1
+# Overflow prevention under LOCK TABLES
+create or replace table t1 (x int)
+with system versioning partition by system_time
+limit 10 auto;
+affected rows: 0
+insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9);
+affected rows: 9
+info: Records: 9 Duplicates: 0 Warnings: 0
+update t1 set x= x + 10;
+affected rows: 9
+info: Rows matched: 9 Changed: 9 Inserted: 9 Warnings: 0
+lock tables t1 write;
+affected rows: 0
+update t1 set x= 1 where x = 11;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+update t1 set x= 2 where x = 12;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+update t1 set x= 3 where x = 13;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+unlock tables;
+affected rows: 0
+select count(x) from t1 partition (p0);
+count(x)
+10
+affected rows: 1
+show create table t1;
+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 SYSTEM_TIME LIMIT 10 AUTO
+PARTITIONS 3
+affected rows: 1
+drop tables t1;
+affected rows: 0
+# Test VIEW, LOCK TABLES
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+affected rows: 0
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+affected rows: 0
+create or replace view v1 as select * from t1;
+affected rows: 0
+insert into t1 values (1);
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+affected rows: 0
+update v1 set x= x + 2;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+affected rows: 0
+lock tables v1 write;
+affected rows: 0
+update v1 set x= x + 3;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+affected rows: 1
+unlock tables;
+affected rows: 0
+drop view v1;
+affected rows: 0
+drop tables t1;
+affected rows: 0
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+affected rows: 0
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto partitions 3;
+affected rows: 0
+create or replace table t2 (y int) with system versioning
+partition by system_time interval 1 hour auto;
+affected rows: 0
+insert into t1 values (1);
+affected rows: 1
+insert into t2 values (2);
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+affected rows: 0
+update t1, t2 set x= x + 1, y= y + 1;
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+affected rows: 1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `y` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+affected rows: 0
+update t1, t2 set x= x + 1, y= y + 1;
+affected rows: 2
+info: Rows matched: 2 Changed: 2 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+affected rows: 1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `y` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+affected rows: 0
+update t1, t2 set t1.x= 0 where t1.x< t2.y;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 5
+affected rows: 1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `y` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS ok
+affected rows: 1
+drop tables t1, t2;
+affected rows: 0
+# PS, SP, LOCK TABLES
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+affected rows: 0
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+affected rows: 0
+insert into t1 values (1);
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+affected rows: 0
+execute immediate 'update t1 set x= x + 5';
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+affected rows: 1
+prepare s from 'update t1 set x= x + 6';
+affected rows: 0
+info: Statement prepared
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+affected rows: 0
+execute s;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+execute s;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+affected rows: 0
+lock tables t1 write;
+affected rows: 0
+execute s;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+execute s;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 5
+affected rows: 1
+unlock tables;
+affected rows: 0
+drop prepare s;
+affected rows: 0
+create procedure sp() update t1 set x= x + 7;
+affected rows: 0
+set timestamp= unix_timestamp('2000-01-01 04:00:00');
+affected rows: 0
+call sp;
+affected rows: 1
+call sp;
+affected rows: 1
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 6
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 05:00:00');
+affected rows: 0
+lock tables t1 write;
+affected rows: 0
+call sp;
+affected rows: 1
+call sp;
+affected rows: 1
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 7
+affected rows: 1
+unlock tables;
+affected rows: 0
+drop procedure sp;
+affected rows: 0
+set timestamp= unix_timestamp('2001-01-01 00:00:00');
+affected rows: 0
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2001-01-01 00:00:00';
+affected rows: 0
+insert into t1 values (0);
+affected rows: 1
+set timestamp= unix_timestamp('2001-01-01 00:00:01');
+affected rows: 0
+prepare s from 'update t1 set i= i + 1';
+affected rows: 0
+info: Statement prepared
+execute s;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+set timestamp= unix_timestamp('2001-01-02 00:00:01');
+affected rows: 0
+execute s;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 1
+Warnings:
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
+drop prepare s;
+affected rows: 0
+# Complex table
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+affected rows: 0
+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,
+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 system_time interval 1 hour auto (
+partition p2 history,
+partition pn current);
+affected rows: 0
+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 `u` (`u`,`e`),
+ KEY `three` (`i1`,`i2`,`i3`),
+ PERIOD FOR SYSTEM_TIME (`s`, `e`),
+ CONSTRAINT `check_constr` CHECK (`u` > -1)
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+insert into t1 (x, c, u, i1, i2, i3, ps, pe)
+values (1, 'cc', 0, 1, 2, 3, '1999-01-01', '2000-01-01');
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+affected rows: 0
+update t1 set x= x + 8;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+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 `u` (`u`,`e`),
+ KEY `three` (`i1`,`i2`,`i3`),
+ PERIOD FOR SYSTEM_TIME (`s`, `e`),
+ CONSTRAINT `check_constr` CHECK (`u` > -1)
+) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+affected rows: 0
+update t1 set x= x - 8;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Inserted: 1 Warnings: 0
+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 `u` (`u`,`e`),
+ KEY `three` (`i1`,`i2`,`i3`),
+ PERIOD FOR SYSTEM_TIME (`s`, `e`),
+ CONSTRAINT `check_constr` CHECK (`u` > -1)
+) ENGINE=DEFAULT_ENGINE AUTO_INCREMENT=10 DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+(PARTITION `p2` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p1` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `p3` HISTORY ENGINE = DEFAULT_ENGINE,
+ PARTITION `pn` CURRENT ENGINE = DEFAULT_ENGINE)
+affected rows: 1
+# INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+insert into t1 values (1) on duplicate key update x= x + 1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+# LOAD DATA .. REPLACE
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert t1 values (1), (2), (3);
+select x into outfile 'MDEV-17554.data' from t1;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+load data infile 'MDEV-17554.data' replace into table t1 (x);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) NOT NULL,
+ PRIMARY KEY (`x`)
+) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+# Concurrent DML
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto partitions 3;
+insert into t1 values (1);
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+connect con8, localhost, root;
+connect con7, localhost, root;
+connect con6, localhost, root;
+connect con5, localhost, root;
+connect con4, localhost, root;
+connect con3, localhost, root;
+connect con2, localhost, root;
+connect con1, localhost, root;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 10;
+connection con2;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 20;
+connection con3;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 30;
+connection con4;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 40;
+connection con5;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 50;
+connection con6;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 60;
+connection con7;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 70;
+connection con8;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 80;
+connection con1;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection con3;
+disconnect con3;
+connection con4;
+disconnect con4;
+connection con5;
+disconnect con5;
+connection con6;
+disconnect con6;
+connection con7;
+disconnect con7;
+disconnect con8;
+connection default;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+drop tables t1;
+set timestamp= default;
+# Concurrent DML (LIMIT)
+create or replace table t1 (x int) with system versioning engine heap
+partition by system_time limit 1 auto partitions 3;
+insert into t1 values (1);
+update t1 set x= x + N; # (running multithreaded for 3 times)
+drop tables t1;
+# Transaction
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+start transaction;
+update t1 set x= 0;
+connect con1, localhost, root;
+select * from t1;
+x
+1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+connection default;
+commit;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+start transaction;
+update t1 set x= 1;
+connection con1;
+select * from t1;
+x
+0
+connection default;
+rollback;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+disconnect con1;
+connection default;
+drop table t1;
+#
+# MDEV-25479 Auto-create: 2nd and further executions of PS or SP fail to create partition
+#
+create table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+prepare stmt from "update t set a= a + 1";
+set @@timestamp= @@timestamp + 3601;
+execute stmt;
+set @@timestamp= @@timestamp + 3601;
+execute stmt;
+drop prepare stmt;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE 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' AUTO
+PARTITIONS 4
+create procedure sp() update t set a= a + 1;
+set @@timestamp= @@timestamp + 3601;
+call sp();
+set @@timestamp= @@timestamp + 3601;
+call sp();
+drop procedure sp;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=DEFAULT_ENGINE 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' AUTO
+PARTITIONS 6
+drop table t;
+#
+# MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers
+#
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto
+partitions 3;
+create table t2 (x int);
+create table t3 (x int);
+insert into t3 values (3);
+create trigger tr after insert on t2 for each row update t1 set x= x + 11;
+create or replace procedure sp() update t1 set x= x + 5;
+create or replace procedure sp2() insert into t2 values (5);
+prepare ps from 'update t1 set x= x + 6';
+prepare ps2 from 'insert into t2 values (6)';
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+insert into t2 values (2);
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 4
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+call sp;
+call sp;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 5
+set timestamp= unix_timestamp('2000-01-01 04:00:00');
+call sp2;
+call sp2;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 6
+set timestamp= unix_timestamp('2000-01-01 05:00:00');
+execute ps;
+execute ps;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 7
+set timestamp= unix_timestamp('2000-01-01 06:00:00');
+execute ps2;
+execute ps2;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 8
+set timestamp= unix_timestamp('2000-01-01 08:00:00');
+lock tables t1 write, t2 write;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 10
+set timestamp= unix_timestamp('2000-01-01 09:00:00');
+update t1 set x= x + 1;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 11
+set timestamp= unix_timestamp('2000-01-01 10:00:00');
+update t1 set x= x + 2;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 12
+update t2 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 11:00:00');
+insert into t2 values (4);
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 13
+update t3 set x= x + 1;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+set timestamp= unix_timestamp('2000-01-01 12:00:00');
+call sp;
+call sp;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 14
+set timestamp= unix_timestamp('2000-01-01 13:00:00');
+call sp2;
+call sp2;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 15
+set timestamp= unix_timestamp('2000-01-01 14:00:00');
+execute ps;
+execute ps;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 16
+set timestamp= unix_timestamp('2000-01-01 15:00:00');
+execute ps2;
+execute ps2;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 17
+unlock tables;
+show create table t1;
+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 SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 17
+drop tables t1, t2, t3;
+drop procedure sp;
+drop procedure sp2;
+drop prepare ps;
+drop prepare ps2;
+#
+# MDEV-27456 Assertion `!thd->is_error()' fails in vers_create_partitions upon DML with ER_UNKNOWN_PARTITION
+#
+create table t (a int) with system versioning
+partition by system_time interval 1 minute auto;
+set @@timestamp= @@timestamp + 61;
+select * from t;
+a
+delete from t partition (px);
+ERROR HY000: Unknown partition 'px' in table 't'
+lock tables t write;
+delete from t partition (px);
+ERROR HY000: Unknown partition 'px' in table 't'
+unlock tables;
+drop table t;
+#
+# MDEV-28978 Assertion failure in THD::binlog_query or unexpected
+# ER_ERROR_ON_WRITE with auto-partitioning
+#
+create table t (a int) with system versioning partition by system_time limit 6 auto;
+insert into t () values (),(),(),(),(),();
+update t set a = 1;
+update t set a = 2 limit 0;
+drop table t;
set global innodb_stats_persistent= @save_persistent;
diff --git a/mysql-test/suite/versioning/r/rpl.result b/mysql-test/suite/versioning/r/rpl.result
index 17372c63e99..a4b87724760 100644
--- a/mysql-test/suite/versioning/r/rpl.result
+++ b/mysql-test/suite/versioning/r/rpl.result
@@ -188,4 +188,224 @@ connection slave;
include/diff_tables.inc [master:test.t1,slave:test.t1]
connection master;
drop table t1;
+#
+# MDEV-17554 Auto-create new partition for system versioned tables
+# with history partitioned by INTERVAL/LIMIT
+#
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+insert t1 values ();
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+delete from t1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `x` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2000-01-01 00:00:00' AUTO
+PARTITIONS 3
+connection master;
+drop table t1;
+set timestamp= default;
+#
+# MDEV-25477 Auto-create breaks replication when triggering event was not replicated
+#
+set timestamp= unix_timestamp('2001-01-01 01:00:00');
+# ROLLBACK
+create table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+set @@timestamp= @@timestamp + 3601;
+start transaction;
+delete from t;
+rollback;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 01:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 01:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+# INSERT .. ODKU
+connection master;
+create or replace table t (a int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+set @@timestamp= @@timestamp + 3601;
+insert into t values (1) on duplicate key update a= a;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 02:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 02:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+# INSERT .. SELECT .. ODKU
+connection master;
+create or replace table t (a int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+set @@timestamp= @@timestamp + 3601;
+call mtr.add_suppression("Unsafe statement written to the binary log");
+insert t select a from t where a = 1 limit 0 on duplicate key update a= 1;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 03:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 03:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+# UPDATE
+connection master;
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+set @@timestamp= @@timestamp + 3601;
+update t set a= 3 limit 0;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 04:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 04:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+# DELETE
+connection master;
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+set @@timestamp= @@timestamp + 3601;
+delete from t limit 0;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 05:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 05:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+# Multi-update
+connection master;
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+create or replace table t2 (b int);
+insert into t values (0), (1);
+insert into t2 values (10), (20);
+set @@timestamp= @@timestamp + 3601;
+update t left join t2 on a > b set a= 4;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 06:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 06:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+# Multi-delete
+connection master;
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+create or replace table t2 (b int);
+insert into t values (0), (1);
+insert into t2 values (10), (20);
+set @@timestamp= @@timestamp + 3601;
+delete t, t2 from t join t2 where a > b;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 07:00:00' AUTO
+PARTITIONS 3
+connection slave;
+show create table t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR STARTS TIMESTAMP'2001-01-01 07:00:00' AUTO
+PARTITIONS 3
+connection master;
+alter table t drop partition p0;
+connection slave;
+connection master;
+drop tables t, t2;
+set timestamp= default;
include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/r/rpl_mix.result b/mysql-test/suite/versioning/r/rpl_mix.result
index 68eded0faf7..856678ae373 100644
--- a/mysql-test/suite/versioning/r/rpl_mix.result
+++ b/mysql-test/suite/versioning/r/rpl_mix.result
@@ -8,4 +8,59 @@ DELETE HISTORY FROM t1;
connection slave;
connection master;
drop table t1;
+#
+# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice
+#
+flush binary logs;
+create table t1 (a int) with system versioning
+partition by system_time limit 1 auto;
+insert into t1 values (1);
+update t1 set a= a + 1;
+update t1 set a= a + 2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 3
+select * from t1;
+a
+4
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t1 (a int) with system versioning
+partition by system_time limit 1 auto
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows # # insert into t1 values (1)
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows # # update t1 set a= a + 1
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Update_rows_v1 # # table_id: #
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows # # update t1 set a= a + 2
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Update_rows_v1 # # table_id: #
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+connection slave;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 3
+select * from t1;
+a
+4
+connection master;
+drop table t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/r/rpl_row.result b/mysql-test/suite/versioning/r/rpl_row.result
index 89c3ce21033..c161f68d0bd 100644
--- a/mysql-test/suite/versioning/r/rpl_row.result
+++ b/mysql-test/suite/versioning/r/rpl_row.result
@@ -49,4 +49,59 @@ x y
1 1
connection master;
drop table t1;
+#
+# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice
+#
+flush binary logs;
+create table t1 (a int) with system versioning
+partition by system_time limit 1 auto;
+insert into t1 values (1);
+update t1 set a= a + 1;
+update t1 set a= a + 2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 3
+select * from t1;
+a
+4
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t1 (a int) with system versioning
+partition by system_time limit 1 auto
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows # # insert into t1 values (1)
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows # # update t1 set a= a + 1
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Update_rows_v1 # # table_id: #
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Annotate_rows # # update t1 set a= a + 2
+master-bin.000002 # Table_map # # table_id: # (test.t1)
+master-bin.000002 # Update_rows_v1 # # table_id: #
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Query # # COMMIT
+connection slave;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 3
+select * from t1;
+a
+4
+connection master;
+drop table t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/r/rpl_stmt.result b/mysql-test/suite/versioning/r/rpl_stmt.result
new file mode 100644
index 00000000000..97ce2265ac0
--- /dev/null
+++ b/mysql-test/suite/versioning/r/rpl_stmt.result
@@ -0,0 +1,50 @@
+include/master-slave.inc
+[connection master]
+#
+# MDEV-25347 DML events for auto-partitioned tables are written into binary log twice
+#
+flush binary logs;
+create table t1 (a int) with system versioning
+partition by system_time limit 1 auto;
+insert into t1 values (1);
+update t1 set a= a + 1;
+update t1 set a= a + 2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 3
+select * from t1;
+a
+4
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t1 (a int) with system versioning
+partition by system_time limit 1 auto
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Query # # use `test`; insert into t1 values (1)
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Query # # use `test`; update t1 set a= a + 1
+master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Query # # use `test`; update t1 set a= a + 2
+master-bin.000002 # Query # # COMMIT
+connection slave;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ENGINE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+ PARTITION BY SYSTEM_TIME LIMIT 1 AUTO
+PARTITIONS 3
+select * from t1;
+a
+4
+connection master;
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/r/update-big.result b/mysql-test/suite/versioning/r/update-big.result
index 89297fe5d89..506d1d23c5d 100644
--- a/mysql-test/suite/versioning/r/update-big.result
+++ b/mysql-test/suite/versioning/r/update-big.result
@@ -22,4 +22,78 @@ update t1 set a= 1 where a = 5;
update t1 set a= 8 where a = 1;
update t1 set a= 4 where a = 8;
update t1 set a= 6;
+disconnect con1;
drop table t1;
+call mtr.add_suppression("need more HISTORY partitions");
+#
+# MDEV-23642 Locking timeout caused by auto-creation affects original DML
+#
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int primary key) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+insert into t1 values (1);
+start transaction;
+insert into t1 values (2);
+connect con1, localhost, root;
+set lock_wait_timeout= 1;
+set innodb_lock_wait_timeout= 1;
+set timestamp= unix_timestamp('2000-01-01 01:00:01');
+update t1 set x= x + 122 where x = 1;
+Warnings:
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+Warning 4114 Versioned table `test`.`t1`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
+disconnect con1;
+connection default;
+select * from t1;
+x
+2
+123
+drop table t1;
+set timestamp= default;
+#
+# MDEV-25339 Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt' failed
+#
+create or replace table t1 (x int) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+start transaction;
+insert into t1 values (1);
+select * from t1;
+x
+1
+connect con1, localhost, root;
+set lock_wait_timeout= 1;
+set innodb_lock_wait_timeout= 1;
+update t1 set x= x + 111;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1;
+x
+disconnect con1;
+connection default;
+drop table t1;
+#
+# MDEV-25482 Auto-create: Server hangs after a failed attempt to create partition
+#
+set timestamp= default;
+create table t (pk int primary key, a int) engine=InnoDB
+with system versioning partition by system_time interval 1 hour auto;
+insert into t values (1,1),(2,2),(3,3),(4,4),(5,5);
+start transaction;
+update t set a= 20 where pk = 2;
+connect con1,localhost,root,,;
+set lock_wait_timeout= 1;
+set @@timestamp= @@timestamp+3601;
+update t set a= 40 where pk = 4;
+Warnings:
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+Warning 4114 Versioned table `test`.`t`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
+update t set a= 400 where pk = 4;
+Warnings:
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+Warning 4114 Versioned table `test`.`t`: last HISTORY partition (`p0`) is out of INTERVAL, need more HISTORY partitions
+disconnect con1;
+connection default;
+select * from t where pk = 4;
+pk a
+4 400
+rollback;
+drop tables t;
diff --git a/mysql-test/suite/versioning/t/debug.test b/mysql-test/suite/versioning/t/debug.test
index be58b67546d..94917f01389 100644
--- a/mysql-test/suite/versioning/t/debug.test
+++ b/mysql-test/suite/versioning/t/debug.test
@@ -1,4 +1,5 @@
--source include/have_debug.inc
+--source include/have_partition.inc
--let $datadir=`select @@datadir`
@@ -33,7 +34,8 @@ show create table t3;
create table t4 (a int);
show create table t4;
drop table t1, t2, t3, t4;
-
+set debug_dbug= @old_dbug;
+set global debug_dbug= @old_dbug;
--echo #
--echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image()
@@ -46,4 +48,61 @@ show create table t1;
--replace_result $datadir ./
show warnings;
drop table t1;
-set global debug_dbug=@old_dbug;
+set debug_dbug= @old_dbug;
+
+
+--echo #
+--echo # MDEV-17554 Auto-create new partition for system versioned tables
+--echo # with history partitioned by INTERVAL/LIMIT
+--echo #
+call mtr.add_suppression("need more HISTORY partitions");
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 1 auto partitions 2;
+insert into t1 values (1);
+update t1 set x= x + 1;
+
+--connect con2, localhost, root
+--connect con1, localhost, root
+
+--disable_warnings
+--echo # Both threads create partition simultaneously
+--connection con1
+set debug_sync= 'add_history_partition signal s1 wait_for s2';
+send update t1 set x= x + 10;
+--connection con2
+set debug_sync= 'now wait_for s1';
+flush tables t1;
+set debug_sync= 'add_history_partition signal s2';
+update t1 set x= x + 20;
+--connection con1
+reap;
+--connection default
+# 1 or 2 history rows may be created depending on which UPDATE finishes first (MDEV-28459)
+# select partition_name, table_rows from information_schema.partitions
+# where table_name = 't1';
+
+# Fill empty partition for next UPDATE to trigger auto-create
+update t1 set x= x + 2;
+
+--echo # Second thread skips to reopen 3 times until first thread creates partition
+--connection con1
+set debug_sync= 'add_history_partition SIGNAL s1 WAIT_FOR s2';
+send update t1 set x= x + 30;
+--connection con2
+set debug_sync= 'now WAIT_FOR s1';
+set debug_sync= 'reopen_history_partition SIGNAL s2 EXECUTE 3';
+update t1 set x= x + 40;
+--connection con1
+reap;
+--connection default
+# Same here (MDEV-28459)
+# select partition_name, table_rows from information_schema.partitions
+# where table_name = 't1';
+--enable_warnings
+
+--disconnect con1
+--disconnect con2
+set @@timestamp= default;
+
+drop tables t1;
+set debug_sync= 'reset';
diff --git a/mysql-test/suite/versioning/t/delete_history.test b/mysql-test/suite/versioning/t/delete_history.test
index 042670bcfec..c653405a61a 100644
--- a/mysql-test/suite/versioning/t/delete_history.test
+++ b/mysql-test/suite/versioning/t/delete_history.test
@@ -232,4 +232,20 @@ DROP TABLE t1;
--echo # End of 10.4 tests
+--echo #
+--echo # MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT
+--echo #
+--echo # Don't auto-create new partition on DELETE HISTORY:
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+set timestamp= unix_timestamp('2000-01-01 10:00:00');
+delete history from t;
+set timestamp= default;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t;
+drop table t;
+
+--echo # End of 10.9 tests
+
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/load_data.test b/mysql-test/suite/versioning/t/load_data.test
index 3bac2942a81..d4a1fa1a736 100644
--- a/mysql-test/suite/versioning/t/load_data.test
+++ b/mysql-test/suite/versioning/t/load_data.test
@@ -1,6 +1,7 @@
#
# MDEV-15330 Server crash or assertion `table->insert_values' failure in write_record upon LOAD DATA
#
+--let $datadir= `select @@datadir`
CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING;
INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3);
@@ -12,3 +13,4 @@ LOAD DATA INFILE '15330.data' REPLACE INTO TABLE t1 (a,b,c);
# Cleanup
DROP TABLE t1;
+--remove_file $datadir/test/15330.data
diff --git a/mysql-test/suite/versioning/t/not_embedded.test b/mysql-test/suite/versioning/t/not_embedded.test
index 2afae013e70..80e936b02f3 100644
--- a/mysql-test/suite/versioning/t/not_embedded.test
+++ b/mysql-test/suite/versioning/t/not_embedded.test
@@ -1,5 +1,6 @@
--source include/not_embedded.inc
--source include/have_innodb.inc
+--source include/have_partition.inc
--echo #
--echo # SYSTEM_VERSIONING_ASOF sysvar
@@ -77,3 +78,30 @@ drop database mysqltest;
--disconnect user1
--disconnect root
--connection default
+
+--echo #
+--echo # MDEV-25559 Auto-create: infinite loop after interrupted lock wait
+--echo #
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create table t (pk int primary key, a int) engine innodb with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1, 0);
+begin;
+update t set a= a + 1;
+--connect (con1,localhost,root,,)
+set max_statement_time= 1;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+send update t set a= a + 2;
+--connection default
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+send update t set a= a + 3;
+--connection con1
+--error ER_STATEMENT_TIMEOUT
+reap;
+--disconnect con1
+--connection default
+reap;
+commit;
+drop table t;
+set timestamp= default;
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index 29de10e4738..e865ec3b9f6 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -11,6 +11,7 @@ call mtr.add_suppression("need more HISTORY partitions");
--enable_prepare_warnings
set system_versioning_alter_history=keep;
+--let $datadir= `select @@datadir`
--echo # Check conventional partitioning on temporal tables
--replace_result $sys_datatype_expl SYS_DATATYPE
@@ -231,7 +232,9 @@ prepare stmt from @str; execute stmt; drop prepare stmt;
select @ts0 = @ts1;
select @ts2 = @ts3;
---echo ## rotation by LIMIT
+--echo #
+--echo # Rotation by LIMIT
+--echo #
--error ER_PART_WRONG_VALUE
create or replace table t1 (x int)
with system versioning
@@ -261,8 +264,9 @@ delete from t1;
--echo # You see warning above ^
select * from t1 partition (p1) order by x;
-
---echo ## rotation by INTERVAL
+--echo #
+--echo # Rotation by INTERVAL
+--echo #
--error ER_PART_WRONG_VALUE
create or replace table t1 (x int)
with system versioning
@@ -306,7 +310,8 @@ insert t1 values (1); delete from t1;
set timestamp=unix_timestamp('2001-02-04 10:20:50');
insert t1 values (2); delete from t1;
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+select * from t1 partition (p1);
set timestamp=unix_timestamp('2001-02-04 10:20:55');
alter table t1 add partition (partition p0 history, partition p2 history);
@@ -315,7 +320,15 @@ insert t1 values (4),(5);
set timestamp=unix_timestamp('2001-02-04 10:30:10');
update t1 set i=6 where i=5;
-select subpartition_name,partition_description,table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+select subpartition_name, partition_description, table_rows from information_schema.partitions where table_schema='test' and table_name='t1';
+select * from t1 partition (p1);
+select * from t1 partition (p0);
+select * from t1 partition (p2);
+
+alter table t1 rebuild partition p0, p1, p2;
+select * from t1 partition (p1);
+select * from t1 partition (p0);
+select * from t1 partition (p2);
--echo ## pruning check
set @ts=(select partition_description from information_schema.partitions
@@ -446,7 +459,6 @@ create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day starts '2000-01-01 00:00:00'
partitions 3;
---echo # we are warned when we push to present:
insert into t1 values (0);
set timestamp= unix_timestamp('2001-01-01 00:00:01');
update t1 set i= i + 1;
@@ -475,8 +487,8 @@ update t1 set i= i + 1;
select *, row_end from t1 partition (p0);
select *, row_end from t1 partition (p1);
-set timestamp= unix_timestamp('2000-01-01 00:00:00');
--echo # and this is how it usually goes:
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
create or replace table t1 (i int) with system versioning
partition by system_time interval 1 day
partitions 3;
@@ -492,7 +504,6 @@ set timestamp= unix_timestamp('2000-01-04 00:00:01');
update t1 set i= i + 1;
alter table t1 add partition (partition p2 history, partition p3 history);
-
select *, row_end from t1 partition (p0);
select *, row_end from t1 partition (p1);
select *, row_end from t1 partition (p2);
@@ -511,7 +522,6 @@ insert into t1 (x) values (1), (2), (3), (4), (5);
select * from t1 partition (pnsp0);
select * from t1 partition (pnsp1);
---echo ### warn about full partition
delete from t1 where x < 3;
delete from t1;
--echo # You see warning above ^
@@ -1009,16 +1019,15 @@ create or replace table t1 (
insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
-select * into outfile 'load.data' from t1;
-load data infile 'load.data' replace into table t1;
+select * into outfile 'MDEV-17891.data' from t1;
+load data infile 'MDEV-17891.data' replace into table t1;
--error ER_RECORD_FILE_FULL
-load data infile 'load.data' replace into table t1;
+load data infile 'MDEV-17891.data' replace into table t1;
--error ER_RECORD_FILE_FULL
-load data infile 'load.data' replace into table t1;
+load data infile 'MDEV-17891.data' replace into table t1;
# Cleanup
---let $datadir= `select @@datadir`
---remove_file $datadir/test/load.data
+--remove_file $datadir/test/MDEV-17891.data
eval set @@max_heap_table_size= $max_heap_table_size_orig;
drop table t1;
@@ -1094,6 +1103,11 @@ insert t1 values (1);
delete from t1 partition (p0, pn);
--error ER_VERS_NOT_ALLOWED
delete from t1 partition (p0, p1, pn);
+lock tables t1 write;
+--error ER_VERS_NOT_ALLOWED
+delete from t1 partition (p0, pn);
+delete from t1;
+unlock tables;
drop table t1;
set timestamp= default;
@@ -1559,11 +1573,79 @@ show create table t1;
drop tables t1;
---disable_prepare_warnings
-
--echo #
---echo # End of 10.5 tests
+--echo # MDEV-27328 Change of SYSTEM_TIME partitioning options is not possible without data copy
--echo #
+create or replace table t1 (f int) with system versioning
+partition by hash(f);
+alter table t1 partition by system_time;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (f int) with system versioning
+partition by system_time;
+alter table t1 partition by hash(f);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (x int) with system versioning;
+alter table t1 partition by system_time;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 100 partitions 4;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+alter table t1 add partition partitions 2;
+alter table t1 partition by system_time;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+alter table t1 partition by system_time limit 33;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+insert t1 values (0);
+set timestamp= unix_timestamp('2000-01-01 00:10:00');
+update t1 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 01:30:00');
+update t1 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1;
+
+# When we switch to INTERVAL we must reorganize partitions.
+# Otherwise pruning won't work correctly.
+alter table t1 partition by system_time interval 1 hour
+starts '2000-01-01 00:00:00';
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (p2);
+select * from t1 partition (pn);
+set timestamp= default;
+
+# When we switch to LIMIT we probably don't want to reorganize old partitions.
+# Note: reorganize for LIMIT is broken, it pushes all history into first partition.
+# TODO: MDEV-27337
+alter table t1 partition by system_time limit 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+update t1 set x= x + 1;
+update t1 set x= x + 1;
+--echo # You see warning above ^
+select * from t1 partition (p0);
+select * from t1 partition (p1);
+select * from t1 partition (p2);
+select * from t1 partition (p3);
+select * from t1 partition (p4);
+select * from t1 partition (pn);
+
+drop table t1;
+
+--echo # End of 10.6 tests
--echo #
--echo # MDEV-22166 MIGRATE PARTITION: move out partition into a table
@@ -1778,6 +1860,751 @@ drop tables t, tp;
--echo # End of 10.7 tests
--echo #
-set global innodb_stats_persistent= @save_persistent;
+--echo #
+--echo # MDEV-17554 Auto-create new partition for system versioned tables
+--echo # with history partitioned by INTERVAL/LIMIT
+--echo #
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 1 auto;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--echo # Turn off AUTO
+alter table t1 partition by system_time limit 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--echo # Get AUTO back
+alter table t1 partition by system_time limit 1 auto;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+insert into t1 values (1);
+
+create or replace table t2 (y int);
+insert into t2 values (2);
+
+insert into t1 select * from t2;
+insert into t2 select * from t1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--echo # Too many partitions error
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+set timestamp= unix_timestamp('2001-01-01 00:01:00');
+--error ER_VERS_HIST_PART_FAILED
+update t1 set x= x + 1;
+show warnings;
+
+--echo # Auto-create failed error
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+
+insert into t1 values (1);
+
+call mtr.add_suppression("rror number .*(File exists|file operation)");
+call mtr.add_suppression("InnoDB: Cannot create file");
+
+--let $datadir= `select @@datadir`
+--let $dummy= $datadir/test/t1#P#p1.ibd
+--write_file $dummy
+EOF
+
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+--error ER_GET_ERRNO
+update t1 set x= x + 2;
+show warnings;
+--remove_file $dummy
+
+--echo # Partition overflow error and manual fix
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour;
+
+insert into t1 values (440);
+set timestamp= unix_timestamp('2000-01-01 00:10:00');
+update t1 set x= x + 1;
+
+--echo # Check how pruning boundaries work
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58';
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00';
+select * from t1 for system_time as of '2000-01-01 00:09:59';
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1;
+
+select * from t1 for system_time as of '2000-01-01 01:00:00';
+select * from t1 partition (p0) order by x;
+
+--echo # Here is how manual fix works: just add new partitions there
+alter table t1 add partition partitions 3;
+select * from t1 for system_time as of '2000-01-01 01:00:00';
+select * from t1 partition (p0) order by x;
+
+--echo # Check pruning after ALTER
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:58';
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time as of '2000-01-01 00:59:59';
+--replace_column 5 # 10 # 11 #
+explain partitions select * from t1 for system_time as of '2000-01-01 01:00:00';
+
+drop table t1;
+
+--enable_info
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 3600 second
+starts '2000-01-01 00:00:00' auto partitions 3;
+
+insert into t1 values (1);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+update t1 set x= x + 2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto (
+ partition p1 history,
+ partition p3 history,
+ partition pn current);
+
+insert into t1 values (1);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 3;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+update t1 set x= x + 4;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 04:00:00');
+lock tables t1 write;
+update t1 set x= x + 5;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+unlock tables;
+set timestamp= default;
+
+--echo # Couple of more LOCK TABLES cases
+create or replace table t1 (x int) with system versioning
+partition by system_time limit 1 auto;
+lock tables t1 write;
+insert into t1 values (1);
+update t1 set x= x + 1;
+update t1 set x= x + 2;
+update t1 set x= x + 3;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+unlock tables;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--echo # Overflow prevention under LOCK TABLES
+create or replace table t1 (x int)
+with system versioning partition by system_time
+limit 10 auto;
+
+insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9);
+update t1 set x= x + 10;
+
+lock tables t1 write;
+update t1 set x= 1 where x = 11;
+update t1 set x= 2 where x = 12;
+update t1 set x= 3 where x = 13;
+unlock tables;
+
+select count(x) from t1 partition (p0);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+drop tables t1;
+
+--echo # Test VIEW, LOCK TABLES
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+create or replace view v1 as select * from t1;
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update v1 set x= x + 2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+lock tables v1 write;
+update v1 set x= x + 3;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+unlock tables;
+
+drop view v1;
+drop tables t1;
+
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto partitions 3;
+
+create or replace table t2 (y int) with system versioning
+partition by system_time interval 1 hour auto;
+
+insert into t1 values (1);
+insert into t2 values (2);
+
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1, t2 set x= x + 1, y= y + 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t2;
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1, t2 set x= x + 1, y= y + 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t2;
+
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+update t1, t2 set t1.x= 0 where t1.x< t2.y;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+# Multiupdate_prelocking_strategy::handle_end() is processed after table open.
+# For PS it is possible to skip unneeded auto-creation because the above happens at
+# prepare stage and auto-creation is done at execute stage.
+--replace_result $default_engine DEFAULT_ENGINE 'PARTITIONS 4' 'PARTITIONS ok' 'PARTITIONS 5' 'PARTITIONS ok'
+show create table t2;
+
+drop tables t1, t2;
+
+--echo # PS, SP, LOCK TABLES
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+
+insert into t1 values (1);
+
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+execute immediate 'update t1 set x= x + 5';
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+prepare s from 'update t1 set x= x + 6';
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+execute s; execute s;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+lock tables t1 write;
+execute s; execute s;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+unlock tables;
+drop prepare s;
+
+create procedure sp() update t1 set x= x + 7;
+set timestamp= unix_timestamp('2000-01-01 04:00:00');
+call sp; call sp;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 05:00:00');
+lock tables t1 write;
+call sp; call sp;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+unlock tables;
+drop procedure sp;
+
+set timestamp= unix_timestamp('2001-01-01 00:00:00');
+create or replace table t1 (i int) with system versioning
+partition by system_time interval 1 day starts '2001-01-01 00:00:00';
+insert into t1 values (0);
+set timestamp= unix_timestamp('2001-01-01 00:00:01');
+prepare s from 'update t1 set i= i + 1';
+execute s;
+set timestamp= unix_timestamp('2001-01-02 00:00:01');
+execute s;
+drop prepare s;
+
+# Because of blobs:
+if (!$MTR_COMBINATION_HEAP)
+{
+--echo # Complex table
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+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,
+ 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 system_time interval 1 hour auto (
+ partition p2 history,
+ partition pn current);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+insert into t1 (x, c, u, i1, i2, i3, ps, pe)
+values (1, 'cc', 0, 1, 2, 3, '1999-01-01', '2000-01-01');
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+update t1 set x= x + 8;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x - 8;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+}
+--disable_info
+
+--echo # INSERT .. ON DUPLICATE KEY UPDATE (ODKU)
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+insert into t1 values (1) on duplicate key update x= x + 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--echo # LOAD DATA .. REPLACE
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+
+insert t1 values (1), (2), (3);
+select x into outfile 'MDEV-17554.data' from t1;
+
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+load data infile 'MDEV-17554.data' replace into table t1 (x);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--remove_file $datadir/test/MDEV-17554.data
+
+--echo # Concurrent DML
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto partitions 3;
+
+insert into t1 values (1);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+--connect con8, localhost, root
+--connect con7, localhost, root
+--connect con6, localhost, root
+--connect con5, localhost, root
+--connect con4, localhost, root
+--connect con3, localhost, root
+--connect con2, localhost, root
+--connect con1, localhost, root
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 10;
+--connection con2
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 20;
+--connection con3
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 30;
+--connection con4
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 40;
+--connection con5
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 50;
+--connection con6
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 60;
+--connection con7
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+send update t1 set x= x + 70;
+--connection con8
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+update t1 set x= x + 80;
+--connection con1
+reap;
+--disconnect con1
+--connection con2
+reap;
+--disconnect con2
+--connection con3
+reap;
+--disconnect con3
+--connection con4
+reap;
+--disconnect con4
+--connection con5
+reap;
+--disconnect con5
+--connection con6
+reap;
+--disconnect con6
+--connection con7
+reap;
+--disconnect con7
+--disconnect con8
+--connection default
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+drop tables t1;
+set timestamp= default;
+
+--echo # Concurrent DML (LIMIT)
+create or replace table t1 (x int) with system versioning engine heap
+partition by system_time limit 1 auto partitions 3;
+
+insert into t1 values (1);
+
+--let $max_loop= 3
+# For more intensity use
+# --let $max_loop= 30
+--echo update t1 set x= x + N; # (running multithreaded for $max_loop times)
+--disable_query_log
+--disable_result_log
+--connect con9, localhost, root
+--connect con10, localhost, root
+--connect con11, localhost, root
+--connect con12, localhost, root
+--connect con13, localhost, root
+--connect con14, localhost, root
+--connect con15, localhost, root
+--connect con16, localhost, root
+--connect con17, localhost, root
+--connect con18, localhost, root
+--connect con19, localhost, root
+--connect con20, localhost, root
+--connect con8, localhost, root
+--connect con7, localhost, root
+--connect con6, localhost, root
+--connect con5, localhost, root
+--connect con4, localhost, root
+--connect con3, localhost, root
+--connect con2, localhost, root
+--connect con1, localhost, root
+--let $i= 0
+while ($i < $max_loop)
+{
+ --connection con1
+ send update t1 set x= x + 100;
+ --connection con2
+ send update t1 set x= x + 200;
+ --connection con3
+ send update t1 set x= x + 300;
+ --connection con4
+ send update t1 set x= x + 400;
+ --connection con5
+ send update t1 set x= x + 500;
+ --connection con6
+ send update t1 set x= x + 600;
+ --connection con7
+ send update t1 set x= x + 700;
+ --connection con8
+ send update t1 set x= x + 800;
+ --connection con9
+ send update t1 set x= x + 900;
+ --connection con10
+ send update t1 set x= x + 1000;
+ --connection con11
+ send update t1 set x= x + 1100;
+ --connection con12
+ send update t1 set x= x + 1200;
+ --connection con13
+ send update t1 set x= x + 1300;
+ --connection con14
+ send update t1 set x= x + 1400;
+ --connection con15
+ send update t1 set x= x + 1500;
+ --connection con16
+ send update t1 set x= x + 1600;
+ --connection con17
+ send update t1 set x= x + 1700;
+ --connection con18
+ send update t1 set x= x + 1800;
+ --connection con19
+ send update t1 set x= x + 1900;
+ --connection con20
+ send update t1 set x= x + 2000;
+ --connection con1
+ reap;
+ --connection con2
+ reap;
+ --connection con3
+ reap;
+ --connection con4
+ reap;
+ --connection con5
+ reap;
+ --connection con6
+ reap;
+ --connection con7
+ reap;
+ --connection con8
+ reap;
+ --connection con9
+ reap;
+ --connection con10
+ reap;
+ --connection con11
+ reap;
+ --connection con12
+ reap;
+ --connection con13
+ reap;
+ --connection con14
+ reap;
+ --connection con15
+ reap;
+ --connection con16
+ reap;
+ --connection con17
+ reap;
+ --connection con18
+ reap;
+ --connection con19
+ reap;
+ --connection con20
+ reap;
+ --inc $i
+}
+
+--disconnect con1
+--disconnect con2
+--disconnect con3
+--disconnect con4
+--disconnect con5
+--disconnect con6
+--disconnect con7
+--disconnect con8
+--disconnect con9
+--disconnect con10
+--disconnect con11
+--disconnect con12
+--disconnect con13
+--disconnect con14
+--disconnect con15
+--disconnect con16
+--disconnect con17
+--disconnect con18
+--disconnect con19
+--disconnect con20
+
+--connection default
+# Result is undeterministic under LIMIT concurrency (MDEV-28459)
+# show create table t1;
+
+--enable_query_log
+--enable_result_log
+
+drop tables t1;
+
+--echo # Transaction
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+start transaction;
+update t1 set x= 0;
+--connect con1, localhost, root
+select * from t1;
+show create table t1;
+--connection default
+commit;
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+start transaction;
+update t1 set x= 1;
+--connection con1
+select * from t1;
+--connection default
+rollback;
+show create table t1;
+--disconnect con1
+--connection default
+drop table t1;
+
+--echo #
+--echo # MDEV-25479 Auto-create: 2nd and further executions of PS or SP fail to create partition
+--echo #
+create table t (a int) with system versioning
+ partition by system_time interval 1 hour auto;
+
+insert into t values (1), (2);
+prepare stmt from "update t set a= a + 1";
+set @@timestamp= @@timestamp + 3601;
+execute stmt;
+set @@timestamp= @@timestamp + 3601;
+execute stmt;
+drop prepare stmt;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t;
+
+create procedure sp() update t set a= a + 1;
+set @@timestamp= @@timestamp + 3601;
+call sp();
+set @@timestamp= @@timestamp + 3601;
+call sp();
+drop procedure sp;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t;
+
+# Cleanup
+drop table t;
+
+--echo #
+--echo # MDEV-23639 Auto-create does not work under LOCK TABLES or inside triggers
+--echo #
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto
+partitions 3;
+
+create table t2 (x int);
+create table t3 (x int);
+insert into t3 values (3);
+
+create trigger tr after insert on t2 for each row update t1 set x= x + 11;
+create or replace procedure sp() update t1 set x= x + 5;
+create or replace procedure sp2() insert into t2 values (5);
+prepare ps from 'update t1 set x= x + 6';
+prepare ps2 from 'insert into t2 values (6)';
+
+insert into t1 values (1);
+set timestamp= unix_timestamp('2000-01-01 02:00:00');
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+insert into t2 values (2);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 03:00:00');
+call sp; call sp;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 04:00:00');
+call sp2; call sp2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 05:00:00');
+execute ps; execute ps;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 06:00:00');
+execute ps2; execute ps2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 08:00:00');
+lock tables t1 write, t2 write;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 09:00:00');
+update t1 set x= x + 1;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 10:00:00');
+update t1 set x= x + 2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+update t2 set x= x + 1;
+set timestamp= unix_timestamp('2000-01-01 11:00:00');
+insert into t2 values (4);
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+--error ER_TABLE_NOT_LOCKED
+update t3 set x= x + 1;
+
+set timestamp= unix_timestamp('2000-01-01 12:00:00');
+call sp; call sp;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 13:00:00');
+call sp2; call sp2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+set timestamp= unix_timestamp('2000-01-01 14:00:00');
+execute ps; execute ps;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+set timestamp= unix_timestamp('2000-01-01 15:00:00');
+execute ps2; execute ps2;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+unlock tables;
+--replace_result $default_engine DEFAULT_ENGINE
+show create table t1;
+
+# Cleanup
+drop tables t1, t2, t3;
+drop procedure sp;
+drop procedure sp2;
+drop prepare ps;
+drop prepare ps2;
+
+--echo #
+--echo # MDEV-27456 Assertion `!thd->is_error()' fails in vers_create_partitions upon DML with ER_UNKNOWN_PARTITION
+--echo #
+create table t (a int) with system versioning
+partition by system_time interval 1 minute auto;
+set @@timestamp= @@timestamp + 61;
+select * from t;
+--error ER_UNKNOWN_PARTITION
+delete from t partition (px);
+lock tables t write;
+--error ER_UNKNOWN_PARTITION
+delete from t partition (px);
+unlock tables;
+# cleanup
+drop table t;
+
+--echo #
+--echo # MDEV-28978 Assertion failure in THD::binlog_query or unexpected
+--echo # ER_ERROR_ON_WRITE with auto-partitioning
+--echo #
+create table t (a int) with system versioning partition by system_time limit 6 auto;
+insert into t () values (),(),(),(),(),();
+update t set a = 1;
+update t set a = 2 limit 0;
+# cleanup
+drop table t;
+
+--disable_prepare_warnings
+set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc
diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test
index 7d78b60e6fa..622b68c80e4 100644
--- a/mysql-test/suite/versioning/t/rpl.test
+++ b/mysql-test/suite/versioning/t/rpl.test
@@ -167,4 +167,167 @@ sync_slave_with_master;
connection master;
drop table t1;
+--echo #
+--echo # MDEV-17554 Auto-create new partition for system versioned tables
+--echo # with history partitioned by INTERVAL/LIMIT
+--echo #
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int) with system versioning
+partition by system_time interval 1 hour auto;
+insert t1 values ();
+set timestamp= unix_timestamp('2000-01-01 01:00:00');
+delete from t1;
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t1;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t1;
+--connection master
+drop table t1;
+set timestamp= default;
+
+--echo #
+--echo # MDEV-25477 Auto-create breaks replication when triggering event was not replicated
+--echo #
+
+set timestamp= unix_timestamp('2001-01-01 01:00:00');
+--echo # ROLLBACK
+create table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+set @@timestamp= @@timestamp + 3601;
+
+start transaction;
+delete from t;
+--disable_warnings
+rollback;
+# Warning: Some non-transactional changed tables couldn't be rolled back
+--enable_warnings
+
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--echo # INSERT .. ODKU
+--connection master
+create or replace table t (a int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+
+set @@timestamp= @@timestamp + 3601;
+insert into t values (1) on duplicate key update a= a;
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--echo # INSERT .. SELECT .. ODKU
+--connection master
+create or replace table t (a int primary key) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+
+set @@timestamp= @@timestamp + 3601;
+--disable_warnings
+call mtr.add_suppression("Unsafe statement written to the binary log");
+insert t select a from t where a = 1 limit 0 on duplicate key update a= 1;
+--enable_warnings
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--echo # UPDATE
+--connection master
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+
+set @@timestamp= @@timestamp + 3601;
+update t set a= 3 limit 0;
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--echo # DELETE
+--connection master
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+insert into t values (1), (2);
+
+set @@timestamp= @@timestamp + 3601;
+delete from t limit 0;
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--echo # Multi-update
+--connection master
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+create or replace table t2 (b int);
+
+insert into t values (0), (1);
+insert into t2 values (10), (20);
+set @@timestamp= @@timestamp + 3601;
+# Note: limit 0 is not important for multi-update/delete because they work
+# via mysql_select(). OTOH limit 0 makes unwanted "unsafe" warning.
+update t left join t2 on a > b set a= 4;
+
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--echo # Multi-delete
+--connection master
+create or replace table t (a int) with system versioning
+partition by system_time interval 1 hour auto;
+create or replace table t2 (b int);
+
+insert into t values (0), (1);
+insert into t2 values (10), (20);
+set @@timestamp= @@timestamp + 3601;
+delete t, t2 from t join t2 where a > b;
+
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t;
+--connection master
+alter table t drop partition p0;
+--sync_slave_with_master
+
+--connection master
+drop tables t, t2;
+set timestamp= default;
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/t/rpl_common.inc b/mysql-test/suite/versioning/t/rpl_common.inc
new file mode 100644
index 00000000000..37e1d76cc09
--- /dev/null
+++ b/mysql-test/suite/versioning/t/rpl_common.inc
@@ -0,0 +1,30 @@
+--source include/have_partition.inc
+
+--echo #
+--echo # MDEV-25347 DML events for auto-partitioned tables are written into binary log twice
+--echo #
+flush binary logs;
+--source include/wait_for_binlog_checkpoint.inc
+create table t1 (a int) with system versioning
+partition by system_time limit 1 auto;
+
+insert into t1 values (1);
+update t1 set a= a + 1;
+update t1 set a= a + 2;
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t1;
+select * from t1;
+
+--let $binlog_file=master-bin.000002
+--source include/show_binlog_events.inc
+
+--sync_slave_with_master
+--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
+show create table t1;
+
+select * from t1;
+--connection master
+# cleanup
+drop table t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/versioning/t/rpl_mix.test b/mysql-test/suite/versioning/t/rpl_mix.test
index 64025c74625..bf4e0b93422 100644
--- a/mysql-test/suite/versioning/t/rpl_mix.test
+++ b/mysql-test/suite/versioning/t/rpl_mix.test
@@ -16,4 +16,4 @@ DELETE HISTORY FROM t1;
connection master;
drop table t1;
---source include/rpl_end.inc
+--source rpl_common.inc
diff --git a/mysql-test/suite/versioning/t/rpl_row.test b/mysql-test/suite/versioning/t/rpl_row.test
index 2e5d4c76f4a..e36d77fc023 100644
--- a/mysql-test/suite/versioning/t/rpl_row.test
+++ b/mysql-test/suite/versioning/t/rpl_row.test
@@ -56,4 +56,4 @@ drop table t1;
--remove_files_wildcard $TMP *.txt
--remove_files_wildcard $TMP *.sql
---source include/rpl_end.inc
+--source rpl_common.inc
diff --git a/mysql-test/suite/versioning/t/rpl_stmt.test b/mysql-test/suite/versioning/t/rpl_stmt.test
new file mode 100644
index 00000000000..dca4e8cb4a2
--- /dev/null
+++ b/mysql-test/suite/versioning/t/rpl_stmt.test
@@ -0,0 +1,4 @@
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+
+--source rpl_common.inc
diff --git a/mysql-test/suite/versioning/t/update-big.test b/mysql-test/suite/versioning/t/update-big.test
index 175bfc79a48..98767cefaad 100644
--- a/mysql-test/suite/versioning/t/update-big.test
+++ b/mysql-test/suite/versioning/t/update-big.test
@@ -1,6 +1,7 @@
source include/big_test.inc;
source suite/versioning/engines.inc;
source suite/versioning/common.inc;
+source include/have_partition.inc;
--echo #
--echo # MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
@@ -29,6 +30,79 @@ update t1 set a= 8 where a = 1;
update t1 set a= 4 where a = 8;
update t1 set a= 6;
+--disconnect con1
drop table t1;
+call mtr.add_suppression("need more HISTORY partitions");
+
+--echo #
+--echo # MDEV-23642 Locking timeout caused by auto-creation affects original DML
+--echo #
+set timestamp= unix_timestamp('2000-01-01 00:00:00');
+create or replace table t1 (x int primary key) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+
+insert into t1 values (1);
+start transaction;
+insert into t1 values (2);
+
+--connect con1, localhost, root
+set lock_wait_timeout= 1;
+set innodb_lock_wait_timeout= 1;
+set timestamp= unix_timestamp('2000-01-01 01:00:01');
+update t1 set x= x + 122 where x = 1;
+--disconnect con1
+--connection default
+select * from t1;
+
+# cleanup
+drop table t1;
+set timestamp= default;
+
+--echo #
+--echo # MDEV-25339 Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt' failed
+--echo #
+create or replace table t1 (x int) with system versioning engine innodb
+partition by system_time interval 1 hour auto;
+start transaction;
+insert into t1 values (1);
+select * from t1;
+
+--connect con1, localhost, root
+set lock_wait_timeout= 1;
+set innodb_lock_wait_timeout= 1;
+--error ER_LOCK_WAIT_TIMEOUT
+update t1 set x= x + 111;
+select * from t1;
+
+# cleanup
+--disconnect con1
+--connection default
+drop table t1;
+
+--echo #
+--echo # MDEV-25482 Auto-create: Server hangs after a failed attempt to create partition
+--echo #
+set timestamp= default;
+create table t (pk int primary key, a int) engine=InnoDB
+ with system versioning partition by system_time interval 1 hour auto;
+
+insert into t values (1,1),(2,2),(3,3),(4,4),(5,5);
+
+start transaction;
+update t set a= 20 where pk = 2;
+
+--connect (con1,localhost,root,,)
+set lock_wait_timeout= 1;
+set @@timestamp= @@timestamp+3601;
+update t set a= 40 where pk = 4;
+update t set a= 400 where pk = 4;
+
+# Cleanup
+--disconnect con1
+--connection default
+select * from t where pk = 4;
+rollback;
+drop tables t;
+
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 8e1af35fd62..8df0210b2d1 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -135,6 +135,7 @@ WSREP_SST_DONOR_REJECTS_QUERIES
WSREP_SST_METHOD
WSREP_SST_RECEIVE_ADDRESS
WSREP_START_POSITION
+WSREP_STATUS_FILE
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 0690f540a37..109b25cd898 100644
--- a/mysql-test/suite/wsrep/r/variables_debug.result
+++ b/mysql-test/suite/wsrep/r/variables_debug.result
@@ -136,6 +136,7 @@ WSREP_SST_DONOR_REJECTS_QUERIES
WSREP_SST_METHOD
WSREP_SST_RECEIVE_ADDRESS
WSREP_START_POSITION
+WSREP_STATUS_FILE
WSREP_SYNC_WAIT
WSREP_TRX_FRAGMENT_SIZE
WSREP_TRX_FRAGMENT_UNIT
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 25b492846e5..2bc1da52d66 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -291,6 +291,8 @@ static void make_ftype(register char * to, register int flag)
if (flag & FILE_BINARY)
*to++='b';
+ else if (flag & O_TEXT)
+ *to++= 't';
if (O_CLOEXEC)
*to++= 'e';
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 2f21bcb735f..44488e5848a 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -401,16 +401,15 @@ static void my_win_init(void)
_tzset();
- /*
- We do not want text translation (LF->CRLF)
- when stdout is console/terminal, it is buggy
- */
- if (fileno(stdout) >= 0 && isatty(fileno(stdout)))
- (void)setmode(fileno(stdout), O_BINARY);
-
- if (fileno(stderr) >= 0 && isatty(fileno(stderr)))
- (void) setmode(fileno(stderr), O_BINARY);
-
+ /* Disable automatic LF->CRLF translation. */
+ FILE* stdf[]= {stdin, stdout, stderr};
+ for (int i= 0; i < array_elements(stdf); i++)
+ {
+ int fd= fileno(stdf[i]);
+ if (fd >= 0)
+ (void) _setmode(fd, O_BINARY);
+ }
+ _set_fmode(O_BINARY);
setup_codepages();
DBUG_VOID_RETURN;
}
diff --git a/plugin/func_test/plugin.cc b/plugin/func_test/plugin.cc
index f59ee82388c..5cbf05f4f24 100644
--- a/plugin/func_test/plugin.cc
+++ b/plugin/func_test/plugin.cc
@@ -29,7 +29,7 @@ public:
null_value= str->copy(STRING_WITH_LEN("sysconst_test"), system_charset_info);
return null_value ? NULL : str;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
set_maybe_null();
diff --git a/plugin/hashicorp_key_management/CMakeLists.txt b/plugin/hashicorp_key_management/CMakeLists.txt
new file mode 100644
index 00000000000..bd1eee844ab
--- /dev/null
+++ b/plugin/hashicorp_key_management/CMakeLists.txt
@@ -0,0 +1,23 @@
+INCLUDE(FindCURL)
+IF(NOT CURL_FOUND)
+ # Can't build plugin
+ RETURN()
+ENDIF()
+
+INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
+
+set(CPACK_RPM_hashicorp-key-management_PACKAGE_SUMMARY "Hashicorp Key Management plugin for MariaDB" PARENT_SCOPE)
+set(CPACK_RPM_hashicorp-key-management_PACKAGE_DESCRIPTION "This encryption plugin uses Hashicorp Vault for storing encryption
+ keys for MariaDB Data-at-Rest encryption." PARENT_SCOPE)
+
+MYSQL_ADD_PLUGIN(HASHICORP_KEY_MANAGEMENT
+ hashicorp_key_management_plugin.cc
+ LINK_LIBRARIES ${CURL_LIBRARIES}
+ CONFIG hashicorp_key_management.cnf
+ COMPONENT hashicorp-key-management
+ MODULE_ONLY)
+
+ADD_FEATURE_INFO(HASHICORP_KEY_MANAGEMENT "ON" "Hashicorp Key Management Plugin")
+
+INSTALL_DOCUMENTATION(hashicorp_key_management.txt
+ COMPONENT plugin-hashicorp-key-management)
diff --git a/plugin/hashicorp_key_management/hashicorp_key_management.cnf b/plugin/hashicorp_key_management/hashicorp_key_management.cnf
new file mode 100644
index 00000000000..275626a9e7b
--- /dev/null
+++ b/plugin/hashicorp_key_management/hashicorp_key_management.cnf
@@ -0,0 +1,117 @@
+# Copyright (C) 2019-2022 MariaDB Corporation
+#
+# This is a default configuration for the Hashicorp Vault plugin.
+# You can read more about the parameters of this plugin in the
+# hashicorp_key_management.txt file.
+#
+# NOTE THAT YOU MUST MANUALLY UNCOMMENT THE "plugin-load-add"
+# LINE AND ALL THE NECESSARY PARAMETERS BELOW, SETTING THEM
+# TO APPROPRIATE VALUES!
+#
+[mariadb]
+
+#
+# To use Hashicorp Vault KMS, the plugin must be preloaded and
+# activated on the server:
+#
+#plugin-load-add=hashicorp_key_management.so
+
+# Most of its parameters should not be changed during plugin
+# operation and therefore must be preconfigured as part of
+# the server configuration:
+
+#
+# HTTP[s] URL that is used to connect to the Hashicorp Vault server.
+# It must include the name of the scheme ("https://" for a secure
+# connection) and, according to the API rules for storages of the
+# key-value type in Hashicorp Vault, after the server address, the
+# path must begin with the "/v1/" string (as prefix), for example:
+# "https://127.0.0.1:8200/v1/my_secrets"
+#
+#hashicorp-key-management-vault-url="<url>"
+
+#
+# Authentication token that passed to the Hashicorp Vault
+# in the request header:
+#
+#hashicorp-key-management-token="<token>"
+
+#
+# Optional path to the Certificate Authority (CA) bundle
+# (is a file that contains root and intermediate certificates):
+#
+#hashicorp-key-management-vault-ca="<path>"
+
+#
+# Set the duration (in seconds) for the Hashicorp Vault server
+# connection timeout. The allowed range is from 1 to 86400 seconds.
+# The user can also specify a zero value, which means the default
+# timeout value set by the libcurl library (currently 300 seconds):
+#
+#hashicorp-key-management-timeout=15
+
+#
+# Number of server request retries in case of timeout:
+#
+#hashicorp-key-management-retries=3
+
+#
+# Enable key caching (storing key values received from
+# the Hashicorp Vault server in the local memory):
+#
+#hashicorp-key-management-caching-enabled="on"
+
+#
+# This parameter instructs the plugin to use the key values
+# or version numbers taken from the cache in the event of a
+# timeout when accessing the vault server. By default this
+# option is disabled.
+#
+# Please note that key values or version numbers will be read
+# from the cache when the timeout expires only after the number
+# of attempts to read them from the storage server that specified
+# by the hashicorp-key-management-retries parameter has been
+# exhausted:
+#
+#hashicorp-key-management-use-cache-on-timeout="off"
+
+#
+# The time (in milliseconds) after which the value of the key
+# stored in the cache becomes invalid and an attempt to read this
+# data causes a new request send to the vault server. By default,
+# cache entries become invalid after 60,000 milliseconds (after
+# one minute).
+#
+# If the value of this parameter is zero, then the keys will always
+# be considered invalid, but they still can be used if the vault
+# server is unavailable and the corresponding cache operating mode
+# (--[loose-]hashicorp-key-management-use-cache-on-timeout="on")
+# is enabled.
+#
+#hashicorp-key-management-cache-timeout=0
+
+#
+# The time (in milliseconds) after which the information about
+# latest version number of the key (which stored in the cache)
+# becomes invalid and an attempt to read this information causes
+# a new request send to the vault server.
+#
+# If the value of this parameter is zero, then information abount
+# latest key version numbers always considered invalid, unless
+# there is no communication with the vault server and use of the
+# cache is allowed when the server is unavailable.
+#
+# By default, this parameter is zero, that is, the latest version
+# numbers for the keys stored in the cache are considered always
+# invalid, except when the vault server is unavailable and use
+# of the cache is allowed on server failures.
+#
+#hashicorp-key-management-cache-version-timeout=0
+
+#
+# This parameter enables ("on", this is the default value) or disables
+# ("off") checking the kv storage version during plugin initialization.
+# The plugin requires storage to be version 2 or older in order for it
+# to work properly.
+#
+#hashicorp-key-management-check-kv-version=on
diff --git a/plugin/hashicorp_key_management/hashicorp_key_management.txt b/plugin/hashicorp_key_management/hashicorp_key_management.txt
new file mode 100644
index 00000000000..1750154858e
--- /dev/null
+++ b/plugin/hashicorp_key_management/hashicorp_key_management.txt
@@ -0,0 +1,181 @@
+This file describes a hasicorp_key_management plugin that is used to
+implement encryption using keys stored in the Hashicorp Vault KMS.
+
+The current version of this plugin implements the following features:
+
+- Authentication is done using the Hashicorp Vault's token
+ authentication method;
+- If additional client authentication is required, then the
+ path to the CA authentication bundle file may be passed
+ as a plugin parameter;
+- The creation of the keys and their management is carried
+ out using the Hashicorp Vault KMS and their tools;
+- The plugin uses libcurl (https) as an interface to
+ the HashiCorp Vault server;
+- JSON parsing is performed through the JSON service
+ (through the include/mysql/service_json.h);
+- HashiCorp Vault 1.2.4 was used for development and testing.
+
+Since we require support for key versioning, then the key-value
+storage must be configured in Hashicorp Vault as a key-value storage
+that uses the interface of the second version. For example, you can
+create it as follows:
+
+~$ vault secrets enable -path /test -version=2 kv
+
+Key names must correspond to their numerical identifiers.
+Key identifiers itself, their possible values and rules of use
+are described in more detail in the MariaDB main documentation.
+
+From the point of view of the key-value storage (in terms
+of Hashicorp Vault), the key is a secret containing one key-value
+pair with the name "data" and a value representing a binary string
+containing the key value, for example:
+
+~$ vault kv get /test/1
+
+====== Metadata ======
+Key Value
+--- -----
+created_time 2019-12-14T14:19:19.42432951Z
+deletion_time n/a
+destroyed false
+version 1
+
+==== Data ====
+Key Value
+--- -----
+data 0123456789ABCDEF0123456789ABCDEF
+
+Keys values are strings containing binary data. MariaDB currently
+uses the AES algorithm with 256-bit keys as the default encryption
+method. In this case, the keys that will be stored in the Hashicorp
+Vault should be 32-byte strings. Most likely you will use some utilities
+for creating and administering keys designed to work with Hashicorp
+Vault. But in the simplest case, keys can be created from the command
+line through the vault utility, for example, as follows:
+
+~$ vault kv put /test/1 data="0123456789ABCDEF0123456789ABCDEF"
+
+If you use default encryption (AES), you should ensure that the
+key length is 32 bytes, otherwise it may fail to use InnoDB as
+a data storage.
+
+The plugin currently does not unseal Hashicorp Vault on its own,
+you must do this in advance and on your own.
+
+To use Hashicorp Vault KMS, the plugin must be preloaded and
+activated on the server. Most of its parameters should not be
+changed during plugin operation and therefore must be preconfigured
+as part of the server configuration through configuration file or
+command line options:
+
+--plugin-load-add=hashicorp_key_management.so
+--loose-hashicorp-key-management
+--loose-hashicorp-key-management-vault-url="$VAULT_ADDR/v1/test"
+--loose-hashicorp-key-management-token="$VAULT_TOKEN"
+
+Currently, the plugin supports the following parameters, which
+must be set in advance and cannot be changed during server
+operation:
+
+--[loose-]hashicorp-key-management-vault-url="<url>"
+
+ HTTP[s] URL that is used to connect to the Hashicorp Vault
+ server. It must include the name of the scheme (https://
+ for a secure connection) and, according to the API rules
+ for storages of the key-value type in Hashicorp Vault,
+ after the server address, the path must begin with the
+ "/v1/" string (as prefix), for example:
+
+ https://127.0.0.1:8200/v1/my_secrets
+
+ By default, the path is not set, therefore you must
+ replace with the correct path to your secrets.
+
+--[loose-]hashicorp-key-management-token="<token>"
+
+ Authentication token that passed to the Hashicorp Vault
+ in the request header.
+
+ By default, this parameter contains an empty string,
+ so you must specify the correct value for it, otherwise
+ the Hashicorp Vault server will refuse authorization.
+
+--[loose-]hashicorp-key-management-vault-ca="<path>"
+
+ Path to the Certificate Authority (CA) bundle (is a file
+ that contains root and intermediate certificates).
+
+ By default, this parameter contains an empty string,
+ which means no CA bundle.
+
+--[loose-]hashicorp-key-management-timeout=<timeout>
+
+ Set the duration (in seconds) for the Hashicorp Vault server
+ connection timeout. The default value is 15 seconds. The allowed
+ range is from 1 to 86400 seconds. The user can also specify a zero
+ value, which means the default timeout value set by the libcurl
+ library (currently 300 seconds).
+
+--[loose-]hashicorp-key-management-retries=<retries>
+
+ Number of server request retries in case of timeout.
+ Default is three retries.
+
+--[loose-]hashicorp-key-management-caching-enabled="on"|"off"
+
+ Enable key caching (storing key values received from
+ the Hashicorp Vault server in the local memory). By default
+ caching is enabled.
+
+--[loose-]hashicorp-key-management-use-cache-on-timeout="on"|"off"
+
+ This parameter instructs the plugin to use the key values
+ or version numbers taken from the cache in the event of a
+ timeout when accessing the vault server. By default this
+ option is disabled.
+
+ Please note that key values or version numbers will be read
+ from the cache when the timeout expires only after the number
+ of attempts to read them from the storage server that specified
+ by the --[loose-]hashicorp-key-management-retries parameter
+ has been exhausted.
+
+--[loose-]hashicorp-key-management-cache-timeout=<timeout>
+
+ The time (in milliseconds) after which the value of the key
+ stored in the cache becomes invalid and an attempt to read this
+ data causes a new request send to the vault server. By default,
+ cache entries become invalid after 60,000 milliseconds (after
+ one minute).
+
+ If the value of this parameter is zero, then the keys will always
+ be considered invalid, but they still can be used if the vault
+ server is unavailable and the corresponding cache operating mode
+ (--[loose-]hashicorp-key-management-use-cache-on-timeout="on")
+ is enabled.
+
+--[loose-]hashicorp-key-management-cache-version-timeout=<timeout>
+
+ The time (in milliseconds) after which the information about
+ latest version number of the key (which stored in the cache)
+ becomes invalid and an attempt to read this information causes
+ a new request send to the vault server.
+
+ If the value of this parameter is zero, then information abount
+ latest key version numbers always considered invalid, unless
+ there is no communication with the vault server and use of the
+ cache is allowed when the server is unavailable.
+
+ By default, this parameter is zero, that is, the latest version
+ numbers for the keys stored in the cache are considered always
+ invalid, except when the vault server is unavailable and use
+ of the cache is allowed on server failures.
+
+--[loose-]hashicorp-key-management-check-kv-version="on"|"off"
+
+ This parameter enables ("on", this is the default value) or disables
+ ("off") checking the kv storage version during plugin initialization.
+ The plugin requires storage to be version 2 or older in order for it
+ to work properly.
diff --git a/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc
new file mode 100644
index 00000000000..7c72af688e4
--- /dev/null
+++ b/plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc
@@ -0,0 +1,1385 @@
+/* Copyright (C) 2019-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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#include <my_global.h>
+#include <mysql/plugin_encryption.h>
+#include <mysqld_error.h>
+#include <string.h>
+#include <errno.h>
+#include <string>
+#include <sstream>
+#include <curl/curl.h>
+#ifdef _WIN32
+#include <malloc.h>
+#define alloca _alloca
+#endif
+#include <algorithm>
+#include <unordered_map>
+#include <mutex>
+
+#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
+#define HASHICORP_HAVE_EXCEPTIONS 1
+#else
+#define HASHICORP_HAVE_EXCEPTIONS 0
+#endif
+
+#define HASHICORP_DEBUG_LOGGING 0
+
+#define PLUGIN_ERROR_HEADER "hashicorp: "
+
+/* Key version information structure: */
+typedef struct VER_INFO
+{
+ unsigned int key_version;
+ clock_t timestamp;
+ VER_INFO() : key_version(0), timestamp(0) {};
+ VER_INFO(unsigned int key_version_, clock_t timestamp_) :
+ key_version(key_version_), timestamp(timestamp_) {};
+} VER_INFO;
+
+/* Key information structure: */
+typedef struct KEY_INFO
+{
+ unsigned int key_id;
+ unsigned int key_version;
+ clock_t timestamp;
+ unsigned int length;
+ unsigned char data [MY_AES_MAX_KEY_LENGTH];
+ KEY_INFO() : key_id(0), key_version(0), timestamp(0), length(0) {};
+ KEY_INFO(unsigned int key_id_,
+ unsigned int key_version_,
+ clock_t timestamp_,
+ unsigned int length_) :
+ key_id(key_id_), key_version(key_version_),
+ timestamp(timestamp_), length(length_) {};
+} KEY_INFO;
+
+/* Cache for the latest version, per key id: */
+typedef std::unordered_map<unsigned int, VER_INFO> VER_MAP;
+
+/* Cache for key information: */
+typedef std::unordered_map<unsigned long long, KEY_INFO> KEY_MAP;
+
+#define KEY_ID_AND_VERSION(key_id, version) \
+ ((unsigned long long)key_id << 32 | version)
+
+class HCData
+{
+private:
+ struct curl_slist *slist;
+ char *vault_url_data;
+ size_t vault_url_len;
+ char *local_token;
+ char *token_header;
+ bool curl_inited;
+public:
+ HCData()
+ :slist(NULL),
+ vault_url_data(NULL),
+ vault_url_len(0),
+ local_token(NULL),
+ token_header(NULL),
+ curl_inited(false)
+ {}
+ unsigned int get_latest_version (unsigned int key_id);
+ unsigned int get_key_from_vault (unsigned int key_id,
+ unsigned int key_version,
+ unsigned char *dstbuf,
+ unsigned int *buflen);
+ int init ();
+ void deinit ()
+ {
+ if (slist)
+ {
+ curl_slist_free_all(slist);
+ slist = NULL;
+ }
+ if (curl_inited)
+ {
+ curl_global_cleanup();
+ curl_inited = false;
+ }
+ vault_url_len = 0;
+ if (vault_url_data)
+ {
+ free(vault_url_data);
+ vault_url_data = NULL;
+ }
+ if (token_header)
+ {
+ free(token_header);
+ token_header = NULL;
+ }
+ if (local_token)
+ {
+ free(local_token);
+ local_token = NULL;
+ }
+ }
+ void cache_clean ()
+ {
+ latest_version_cache.clear();
+ key_info_cache.clear();
+ }
+private:
+ std::mutex mtx;
+ VER_MAP latest_version_cache;
+ KEY_MAP key_info_cache;
+private:
+ void cache_add (const KEY_INFO& info, bool update_version);
+ unsigned int cache_get (unsigned int key_id, unsigned int key_version,
+ unsigned char* data, unsigned int* buflen,
+ bool with_timeouts);
+ unsigned int cache_check_version (unsigned int key_id);
+ unsigned int cache_get_version (unsigned int key_id);
+ int curl_run (const char *url, std::string *response,
+ bool soft_timeout) const;
+ int check_version (const char *mount_url) const;
+ void *alloc (size_t nbytes) const
+ {
+ void *res = (char *) malloc(nbytes);
+ if (!res)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Memory allocation error", 0);
+ }
+ return res;
+ }
+};
+
+static HCData data;
+
+static clock_t cache_max_time;
+static clock_t cache_max_ver_time;
+
+/*
+ Convert milliseconds to timer ticks with rounding
+ to nearest integer:
+*/
+static clock_t ms_to_ticks (long ms)
+{
+ long long ticks_1000 = ms * (long long) CLOCKS_PER_SEC;
+ clock_t ticks = (clock_t) (ticks_1000 / 1000);
+ return ticks + ((clock_t) (ticks_1000 % 1000) >= 500);
+}
+
+void HCData::cache_add (const KEY_INFO& info, bool update_version)
+{
+ unsigned int key_id = info.key_id;
+ unsigned int key_version = info.key_version;
+ mtx.lock();
+ VER_INFO &ver_info = latest_version_cache[key_id];
+ if (update_version || ver_info.key_version < key_version)
+ {
+ ver_info.key_version = key_version;
+ ver_info.timestamp = info.timestamp;
+ }
+ key_info_cache[KEY_ID_AND_VERSION(key_id, key_version)] = info;
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "cache_add: key_id = %u, key_version = %u, "
+ "timestamp = %u, update_version = %u, new version = %u",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id, key_version,
+ ver_info.timestamp, (int) update_version,
+ ver_info.key_version);
+#endif
+ mtx.unlock();
+}
+
+unsigned int
+ HCData::cache_get (unsigned int key_id, unsigned int key_version,
+ unsigned char* data, unsigned int* buflen,
+ bool with_timeouts)
+{
+ unsigned int version = key_version;
+ clock_t current_time = clock();
+ mtx.lock();
+ if (key_version == ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ clock_t timestamp;
+#if HASHICORP_HAVE_EXCEPTIONS
+ try
+ {
+ VER_INFO &ver_info = latest_version_cache.at(key_id);
+ version = ver_info.key_version;
+ timestamp = ver_info.timestamp;
+ }
+ catch (const std::out_of_range &e)
+#else
+ VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id);
+ if (ver_iter != latest_version_cache.end())
+ {
+ version = ver_iter->second.key_version;
+ timestamp = ver_iter->second.timestamp;
+ }
+ else
+#endif
+ {
+ mtx.unlock();
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "cache_get: key_id = %u, key_version = %u, "
+ "last version = %u, version timestamp = %u, "
+ "current time = %u, diff = %u",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id, key_version,
+ version, timestamp, current_time,
+ current_time - timestamp);
+#endif
+ if (with_timeouts && current_time - timestamp > cache_max_ver_time)
+ {
+ mtx.unlock();
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ }
+ KEY_INFO info;
+#if HASHICORP_HAVE_EXCEPTIONS
+ try
+ {
+ info = key_info_cache.at(KEY_ID_AND_VERSION(key_id, version));
+ }
+ catch (const std::out_of_range &e)
+#else
+ KEY_MAP::const_iterator key_iter =
+ key_info_cache.find(KEY_ID_AND_VERSION(key_id, version));
+ if (key_iter != key_info_cache.end())
+ {
+ info = key_iter->second;
+ }
+ else
+#endif
+ {
+ mtx.unlock();
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ mtx.unlock();
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "cache_get: key_id = %u, key_version = %u, "
+ "effective version = %u, key data timestamp = %u, "
+ "current time = %u, diff = %u",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id, key_version,
+ version, info.timestamp, current_time,
+ current_time - info.timestamp);
+#endif
+ unsigned int length= info.length;
+ if (with_timeouts && current_time - info.timestamp > cache_max_time)
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ unsigned int max_length = *buflen;
+ *buflen = length;
+ if (max_length >= length)
+ {
+ memcpy(data, info.data, length);
+ }
+ else
+ {
+#ifndef NDEBUG
+ if (max_length)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Encryption key buffer is too small",
+ ME_ERROR_LOG_ONLY | ME_NOTE);
+ }
+#endif
+ return ENCRYPTION_KEY_BUFFER_TOO_SMALL;
+ }
+ return 0;
+}
+
+unsigned int HCData::cache_get_version (unsigned int key_id)
+{
+ unsigned int version;
+ mtx.lock();
+#if HASHICORP_HAVE_EXCEPTIONS
+ try
+ {
+ version = latest_version_cache.at(key_id).key_version;
+ }
+ catch (const std::out_of_range &e)
+#else
+ VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id);
+ if (ver_iter != latest_version_cache.end())
+ {
+ version = ver_iter->second.key_version;
+ }
+ else
+#endif
+ {
+ version = ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ mtx.unlock();
+ return version;
+}
+
+unsigned int HCData::cache_check_version (unsigned int key_id)
+{
+ unsigned int version;
+ clock_t timestamp;
+ mtx.lock();
+#if HASHICORP_HAVE_EXCEPTIONS
+ try
+ {
+ VER_INFO &ver_info = latest_version_cache.at(key_id);
+ version = ver_info.key_version;
+ timestamp = ver_info.timestamp;
+ }
+ catch (const std::out_of_range &e)
+#else
+ VER_MAP::const_iterator ver_iter = latest_version_cache.find(key_id);
+ if (ver_iter != latest_version_cache.end())
+ {
+ version = ver_iter->second.key_version;
+ timestamp = ver_iter->second.timestamp;
+ }
+ else
+#endif
+ {
+ mtx.unlock();
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "cache_check_version: key_id = %u (not in the cache)",
+ ME_ERROR_LOG_ONLY | ME_NOTE,
+ key_id);
+#endif
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ mtx.unlock();
+ clock_t current_time = clock();
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "cache_check_version: key_id = %u, "
+ "last version = %u, version timestamp = %u, "
+ "current time = %u, diff = %u",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id, version,
+ version, timestamp, current_time,
+ current_time - timestamp);
+#endif
+ if (current_time - timestamp <= cache_max_ver_time)
+ {
+ return version;
+ }
+ else
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+}
+
+static char* vault_url;
+static char* token;
+static char* vault_ca;
+static int timeout;
+static int max_retries;
+static char caching_enabled;
+static char check_kv_version;
+static long cache_timeout;
+static long cache_version_timeout;
+static char use_cache_on_timeout;
+
+static MYSQL_SYSVAR_STR(vault_ca, vault_ca,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "Path to the Certificate Authority (CA) bundle (is a file "
+ "that contains root and intermediate certificates)",
+ NULL, NULL, "");
+
+static MYSQL_SYSVAR_STR(vault_url, vault_url,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "HTTP[s] URL that is used to connect to the Hashicorp Vault server",
+ NULL, NULL, "");
+
+static MYSQL_SYSVAR_STR(token, token,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR,
+ "Authentication token that passed to the Hashicorp Vault "
+ "in the request header",
+ NULL, NULL, "");
+
+static MYSQL_SYSVAR_INT(timeout, timeout,
+ PLUGIN_VAR_RQCMDARG,
+ "Duration (in seconds) for the Hashicorp Vault server "
+ "connection timeout",
+ NULL, NULL, 15, 0, 86400, 1);
+
+static MYSQL_SYSVAR_INT(max_retries, max_retries,
+ PLUGIN_VAR_RQCMDARG,
+ "Number of server request retries in case of timeout",
+ NULL, NULL, 3, 0, INT_MAX, 1);
+
+static MYSQL_SYSVAR_BOOL(caching_enabled, caching_enabled,
+ PLUGIN_VAR_RQCMDARG,
+ "Enable key caching (storing key values received from "
+ "the Hashicorp Vault server in the local memory)",
+ NULL, NULL, 1);
+
+static MYSQL_SYSVAR_BOOL(check_kv_version, check_kv_version,
+ PLUGIN_VAR_RQCMDARG,
+ "Enable kv storage version check during plugin initialization",
+ NULL, NULL, 1);
+
+static void cache_timeout_update (MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr,
+ const void *save)
+{
+ long timeout = * (long *) save;
+ * (long *) var_ptr = timeout;
+ cache_max_time = ms_to_ticks(timeout);
+}
+
+static MYSQL_SYSVAR_LONG(cache_timeout, cache_timeout,
+ PLUGIN_VAR_RQCMDARG,
+ "Cache timeout for key data (in milliseconds)",
+ NULL, cache_timeout_update, 60000, 0, LONG_MAX, 1);
+
+static void
+ cache_version_timeout_update (MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr,
+ const void *save)
+{
+ long timeout = * (long *) save;
+ * (long *) var_ptr = timeout;
+ cache_max_ver_time = ms_to_ticks(timeout);
+}
+
+static MYSQL_SYSVAR_LONG(cache_version_timeout, cache_version_timeout,
+ PLUGIN_VAR_RQCMDARG,
+ "Cache timeout for key version (in milliseconds)",
+ NULL, cache_version_timeout_update, 0, 0, LONG_MAX, 1);
+
+static MYSQL_SYSVAR_BOOL(use_cache_on_timeout, use_cache_on_timeout,
+ PLUGIN_VAR_RQCMDARG,
+ "In case of timeout (when accessing the vault server) "
+ "use the value taken from the cache",
+ NULL, NULL, 0);
+
+static struct st_mysql_sys_var *settings[] = {
+ MYSQL_SYSVAR(vault_url),
+ MYSQL_SYSVAR(token),
+ MYSQL_SYSVAR(vault_ca),
+ MYSQL_SYSVAR(timeout),
+ MYSQL_SYSVAR(max_retries),
+ MYSQL_SYSVAR(caching_enabled),
+ MYSQL_SYSVAR(cache_timeout),
+ MYSQL_SYSVAR(cache_version_timeout),
+ MYSQL_SYSVAR(use_cache_on_timeout),
+ MYSQL_SYSVAR(check_kv_version),
+ NULL
+};
+
+/*
+ Reasonable length limit to protect against accidentally reading
+ the wrong key or from trying to overload the server with unnecessary
+ work to receive too long responses to requests:
+*/
+#define MAX_RESPONSE_SIZE 131072
+
+static size_t write_response_memory (void *contents, size_t size, size_t nmemb,
+ void *userp)
+{
+ size_t realsize = size * nmemb;
+ std::ostringstream *read_data = static_cast<std::ostringstream *>(userp);
+ size_t current_length = read_data->tellp();
+ if (current_length + realsize > MAX_RESPONSE_SIZE)
+ return 0; // response size limit exceeded
+ read_data->write(static_cast<char *>(contents), realsize);
+ if (!read_data->good())
+ return 0;
+ return realsize;
+}
+
+enum {
+ OPERATION_OK,
+ OPERATION_TIMEOUT,
+ OPERATION_ERROR
+};
+
+static CURLcode
+ perform_with_retries (CURL *curl, std::ostringstream *read_data_stream)
+{
+ int retries= max_retries;
+ CURLcode curl_res;
+ do {
+ curl_res= curl_easy_perform(curl);
+ if (curl_res != CURLE_OPERATION_TIMEDOUT)
+ {
+ break;
+ }
+ read_data_stream->clear();
+ read_data_stream->str("");
+ } while (retries--);
+ return curl_res;
+}
+
+int HCData::curl_run (const char *url, std::string *response,
+ bool soft_timeout) const
+{
+ char curl_errbuf[CURL_ERROR_SIZE];
+ std::ostringstream read_data_stream;
+ long http_code = 0;
+ CURLcode curl_res = CURLE_OK;
+ CURL *curl = curl_easy_init();
+ if (curl == NULL)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Cannot initialize curl session",
+ ME_ERROR_LOG_ONLY);
+ return OPERATION_ERROR;
+ }
+ curl_errbuf[0] = '\0';
+ if ((curl_res= curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf)) !=
+ CURLE_OK ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
+ write_response_memory)) != CURLE_OK ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_WRITEDATA,
+ &read_data_stream)) !=
+ CURLE_OK ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist)) !=
+ CURLE_OK ||
+ /*
+ The options CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST are
+ set explicitly to withstand possible future changes in curl defaults:
+ */
+ (curl_res= curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1)) !=
+ CURLE_OK ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L)) !=
+ CURLE_OK ||
+ (strlen(vault_ca) != 0 &&
+ (curl_res= curl_easy_setopt(curl, CURLOPT_CAINFO, vault_ca)) !=
+ CURLE_OK) ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL)) !=
+ CURLE_OK ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L)) !=
+ CURLE_OK ||
+ (timeout &&
+ ((curl_res= curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, timeout)) !=
+ CURLE_OK ||
+ (curl_res= curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout)) !=
+ CURLE_OK)) ||
+ (curl_res = curl_easy_setopt(curl, CURLOPT_URL, url)) != CURLE_OK ||
+ (curl_res = perform_with_retries(curl, &read_data_stream)) != CURLE_OK ||
+ (curl_res = curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE,
+ &http_code)) != CURLE_OK)
+ {
+ curl_easy_cleanup(curl);
+ if (soft_timeout && curl_res == CURLE_OPERATION_TIMEDOUT)
+ {
+ return OPERATION_TIMEOUT;
+ }
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "curl returned this error code: %u "
+ "with the following error message: %s", 0, curl_res,
+ curl_errbuf[0] ? curl_errbuf :
+ curl_easy_strerror(curl_res));
+ return OPERATION_ERROR;
+ }
+ curl_easy_cleanup(curl);
+ *response = read_data_stream.str();
+ bool is_error = http_code < 200 || http_code >= 300;
+ if (is_error)
+ {
+ const char *res = response->c_str();
+ /*
+ Error 404 requires special handling - in case the server
+ returned an empty array of error strings (the value of the
+ "error" object in JSON is equal to an empty array), we should
+ ignore this error at this level, since this means the missing
+ key (this problem is handled at a higher level), but if the
+ error object contains anything other than empty array, then
+ we need to print the error message to the log:
+ */
+ if (http_code == 404)
+ {
+ const char *err;
+ int err_len;
+ if (json_get_object_key(res, res + response->size(),
+ "errors", &err, &err_len) == JSV_ARRAY)
+ {
+ const char *ev;
+ int ev_len;
+ if (json_get_array_item(err, err + err_len, 0, &ev, &ev_len) ==
+ JSV_NOTHING)
+ {
+ *response = std::string("");
+ is_error = false;
+ }
+ }
+ }
+ if (is_error)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Hashicorp server error: %d, response: %s",
+ ME_ERROR_LOG_ONLY | ME_WARNING, http_code, res);
+ }
+ }
+ return is_error ? OPERATION_ERROR : OPERATION_OK;
+}
+
+static inline int c2xdigit (int c)
+{
+ if (c > 9)
+ {
+ c -= 'A' - '0' - 10;
+ if (c > 15)
+ {
+ c -= 'a' - 'A';
+ }
+ }
+ return c;
+}
+
+static int hex2buf (unsigned int max_length, unsigned char *dstbuf,
+ int key_len, const char *key)
+{
+ int length = 0;
+ while (key_len >= 2)
+ {
+ int c1 = key[0];
+ int c2 = key[1];
+ if (! isxdigit(c1) || ! isxdigit(c2))
+ {
+ break;
+ }
+ if (max_length)
+ {
+ c1 = c2xdigit(c1 - '0');
+ c2 = c2xdigit(c2 - '0');
+ dstbuf[length++] = (c1 << 4) + c2;
+ }
+ key += 2;
+ key_len -= 2;
+ }
+ if (key_len)
+ {
+ if (key_len != 1)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Syntax error - the key data should contain only "
+ "hexadecimal digits",
+ 0);
+ }
+ else
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Syntax error - extra character in the key data",
+ 0);
+ }
+ return -1;
+ }
+ return 0;
+}
+
+static int get_data (const std::string &response_str,
+ const char **js, int *js_len,
+ unsigned int key_id,
+ unsigned int key_version)
+{
+ const char *response = response_str.c_str();
+ size_t response_len = response_str.size();
+ /*
+ If the key is not found, this is not considered a fatal error,
+ but we need to add an informational message to the log:
+ */
+ if (response_len == 0)
+ {
+ if (key_version == ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Key not found (key id: %u)",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id);
+ }
+ else
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Key not found (key id: %u, key version: %u)",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id, key_version);
+ }
+ return 1;
+ }
+ if (json_get_object_key(response, response + response_len, "data",
+ js, js_len) != JSV_OBJECT)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get data object (http response is: %s)",
+ 0, response);
+ return 2;
+ }
+ return 0;
+}
+
+static unsigned int get_version (const char *js, int js_len,
+ const std::string &response_str,
+ int *rc)
+{
+ const char *ver;
+ int ver_len;
+ *rc = 1;
+ if (json_get_object_key(js, js + js_len, "metadata",
+ &ver, &ver_len) != JSV_OBJECT)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get metadata object (http response is: %s)",
+ 0, response_str.c_str());
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ if (json_get_object_key(ver, ver + ver_len, "version",
+ &ver, &ver_len) != JSV_NUMBER)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get version number (http response is: %s)",
+ 0, response_str.c_str());
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ errno = 0;
+ unsigned long version = strtoul(ver, NULL, 10);
+ if (version > UINT_MAX || (version == ULONG_MAX && errno))
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Integer conversion error (for version number) "
+ "(http response is: %s)",
+ 0, response_str.c_str());
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ *rc = 0;
+ return (unsigned int) version;
+}
+
+static int get_key_data (const char *js, int js_len,
+ const char **key, int *key_len,
+ const std::string &response_str)
+{
+ if (json_get_object_key(js, js + js_len, "data",
+ &js, &js_len) != JSV_OBJECT)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get second-level data object "
+ "(http response is: %s)",
+ 0, response_str.c_str());
+ return 1;
+ }
+ if (json_get_object_key(js, js + js_len, "data",
+ key, key_len) != JSV_STRING)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get data string (http response is: %s)",
+ 0, response_str.c_str());
+ return 1;
+ }
+ return 0;
+}
+
+unsigned int HCData::get_latest_version (unsigned int key_id)
+{
+ unsigned int version;
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "get_latest_version: key_id = %u",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id);
+#endif
+ if (caching_enabled)
+ {
+ version = cache_check_version(key_id);
+ if (version != ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ return version;
+ }
+ }
+ std::string response_str;
+ /*
+ Maximum buffer length = URL length plus 20 characters of
+ a 64-bit unsigned integer, plus a slash character, plus
+ a length of the "/data/" string and plus a zero byte:
+ */
+ size_t buf_len = vault_url_len + (20 + 6 + 1);
+ char *url = (char *) alloca(buf_len);
+ snprintf(url, buf_len, "%s%u", vault_url_data, key_id);
+ bool use_cache= caching_enabled && use_cache_on_timeout;
+ int rc;
+ if ((rc= curl_run(url, &response_str, use_cache)) != OPERATION_OK)
+ {
+ if (rc == OPERATION_TIMEOUT)
+ {
+ version = cache_get_version(key_id);
+ if (version != ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ return version;
+ }
+ }
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get key data", 0);
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ const char *js;
+ int js_len;
+ if (get_data(response_str, &js, &js_len, key_id,
+ ENCRYPTION_KEY_VERSION_INVALID))
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ version = get_version(js, js_len, response_str, &rc);
+ if (!caching_enabled || rc)
+ {
+ return version;
+ }
+ const char* key;
+ int key_len;
+ if (get_key_data(js, js_len, &key, &key_len, response_str))
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ unsigned int length = (unsigned int) key_len >> 1;
+ KEY_INFO info(key_id, version, clock(), length);
+ if (length > sizeof(info.data))
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Encryption key data is too long",
+ ME_ERROR_LOG_ONLY | ME_NOTE);
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ int ret = hex2buf(sizeof(info.data), info.data, key_len, key);
+ if (ret)
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ cache_add(info, true);
+ return version;
+}
+
+unsigned int HCData::get_key_from_vault (unsigned int key_id,
+ unsigned int key_version,
+ unsigned char *dstbuf,
+ unsigned int *buflen)
+{
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "get_latest_version: key_id = %u, key_version = %u",
+ ME_ERROR_LOG_ONLY | ME_NOTE, key_id, key_version);
+#endif
+ if (caching_enabled &&
+ cache_get(key_id, key_version, dstbuf, buflen, true) !=
+ ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ return 0;
+ }
+ std::string response_str;
+ /*
+ Maximum buffer length = URL length plus 40 characters of the
+ two 64-bit unsigned integers, plus a slash character, plus a
+ question mark, plus length of the "/data/" and the "?version="
+ strings and plus a zero byte:
+ */
+ size_t buf_len = vault_url_len + (40 + 6 + 9 + 1);
+ char *url = (char *) alloca(buf_len);
+ if (key_version != ENCRYPTION_KEY_VERSION_INVALID)
+ snprintf(url, buf_len, "%s%u?version=%u",
+ vault_url_data, key_id, key_version);
+ else
+ snprintf(url, buf_len, "%s%u", vault_url_data, key_id);
+ bool use_cache= caching_enabled && use_cache_on_timeout;
+ int rc;
+ if ((rc= curl_run(url, &response_str, use_cache)) != OPERATION_OK)
+ {
+ if (rc == OPERATION_TIMEOUT)
+ {
+ if (cache_get(key_id, key_version, dstbuf, buflen, false) !=
+ ENCRYPTION_KEY_VERSION_INVALID)
+ {
+ return 0;
+ }
+ }
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get key data", 0);
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ const char *js;
+ int js_len;
+ if (get_data(response_str, &js, &js_len, key_id, key_version))
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+#ifndef NDEBUG
+ unsigned long version;
+#else
+ unsigned long version= key_version;
+ if (caching_enabled &&
+ key_version == ENCRYPTION_KEY_VERSION_INVALID)
+#endif
+ {
+ int rc;
+ version = get_version(js, js_len, response_str, &rc);
+ if (rc)
+ {
+ return version;
+ }
+ }
+#ifndef NDEBUG
+ /*
+ An internal check that is needed only for debugging the plugin
+ operation - in order to ensure that we get from the Hashicorp Vault
+ server exactly the version of the key that is needed:
+ */
+ if (key_version != ENCRYPTION_KEY_VERSION_INVALID &&
+ key_version != version)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Key version mismatch", 0);
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+#endif
+ const char* key;
+ int key_len;
+ if (get_key_data(js, js_len, &key, &key_len, response_str))
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ unsigned int max_length = dstbuf ? *buflen : 0;
+ unsigned int length = (unsigned int) key_len >> 1;
+ *buflen = length;
+ if (length > max_length)
+ {
+#ifndef NDEBUG
+ if (max_length)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Encryption key buffer is too small",
+ ME_ERROR_LOG_ONLY | ME_NOTE);
+ }
+#endif
+ return ENCRYPTION_KEY_BUFFER_TOO_SMALL;
+ }
+ int ret = hex2buf(max_length, dstbuf, key_len, key);
+ if (ret)
+ {
+ return ENCRYPTION_KEY_VERSION_INVALID;
+ }
+ if (caching_enabled)
+ {
+ KEY_INFO info(key_id, (unsigned int) version, clock(), length);
+ memcpy(info.data, dstbuf, length);
+ cache_add(info, key_version == ENCRYPTION_KEY_VERSION_INVALID);
+ }
+ return 0;
+}
+
+static unsigned int get_latest_version (unsigned int key_id)
+{
+ return data.get_latest_version(key_id);
+}
+
+static unsigned int get_key_from_vault (unsigned int key_id,
+ unsigned int key_version,
+ unsigned char *dstbuf,
+ unsigned int *buflen)
+{
+ return data.get_key_from_vault(key_id, key_version, dstbuf, buflen);
+}
+
+struct st_mariadb_encryption hashicorp_key_management_plugin= {
+ MariaDB_ENCRYPTION_INTERFACE_VERSION,
+ get_latest_version,
+ get_key_from_vault,
+ 0, 0, 0, 0, 0
+};
+
+#ifdef _MSC_VER
+
+static int setenv (const char *name, const char *value, int overwrite)
+{
+ if (!overwrite)
+ {
+ size_t len= 0;
+ int rc= getenv_s(&len, NULL, 0, name);
+ if (rc)
+ {
+ return rc;
+ }
+ if (len)
+ {
+ errno = EINVAL;
+ return EINVAL;
+ }
+ }
+ return _putenv_s(name, value);
+}
+
+#endif
+
+#define MAX_URL_SIZE 32768
+
+int HCData::init ()
+{
+ const static char *x_vault_token = "X-Vault-Token:";
+ const static size_t x_vault_token_len = strlen(x_vault_token);
+ char *token_env= getenv("VAULT_TOKEN");
+ size_t token_len = strlen(token);
+ if (token_len == 0)
+ {
+ if (token_env)
+ {
+ token_len = strlen(token_env);
+ if (token_len != 0)
+ {
+ /*
+ The value of the token parameter obtained using the getenv()
+ system call, which does not guarantee that the memory pointed
+ to by the returned pointer can be read in the long term (for
+ example, after changing the values of the environment variables
+ of the current process). Therefore, we need to copy the token
+ value to the working buffer:
+ */
+ if (!(token = (char *) alloc(token_len + 1)))
+ {
+ return 1;
+ }
+ memcpy(token, token_env, token_len + 1);
+ local_token = token;
+ }
+ }
+ if (token_len == 0) {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "The --hashicorp-key-management-token option value "
+ "or the value of the corresponding parameter in the "
+ "configuration file must be specified, otherwise the "
+ "VAULT_TOKEN environment variable must be set",
+ 0);
+ return 1;
+ }
+ }
+ else
+ {
+ /*
+ If the VAULT_TOKEN environment variable is not set or
+ is not equal to the value of the token parameter, then
+ we must set (overwrite) it for correct operation of
+ the mariabackup:
+ */
+ bool not_equal= token_env != NULL && strcmp(token_env, token) != 0;
+ if (token_env == NULL || not_equal)
+ {
+ setenv("VAULT_TOKEN", token, 1);
+ if (not_equal)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "The --hashicorp-key-management-token option value "
+ "or the value of the corresponding parameter is not "
+ "equal to the value of the VAULT_TOKEN environment "
+ "variable",
+ ME_ERROR_LOG_ONLY | ME_WARNING);
+ }
+ }
+ }
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "plugin_init: token = %s, token_len = %d",
+ ME_ERROR_LOG_ONLY | ME_NOTE, token, (int) token_len);
+#endif
+ size_t buf_len = x_vault_token_len + token_len + 1;
+ if (!(token_header = (char *) alloc(buf_len)))
+ {
+ return 1;
+ }
+ snprintf(token_header, buf_len, "%s%s", x_vault_token, token);
+ /* We need to check that the path inside the URL starts with "/v1/": */
+ const char *suffix = strchr(vault_url, '/');
+ if (suffix == NULL)
+ {
+Bad_url:
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "According to the Hashicorp Vault API rules, "
+ "the path inside the URL must start with "
+ "the \"/v1/\" prefix, while the supplied "
+ "URL value is: \"%s\"", 0, vault_url);
+ return 1;
+ }
+ size_t prefix_len = (size_t) (suffix - vault_url);
+ if (prefix_len == 0)
+ {
+No_Host:
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Supplied URL does not contain a hostname: \"%s\"",
+ 0, vault_url);
+ return 1;
+ }
+ /* Check if the suffix consists only of the slash: */
+ size_t suffix_len = strlen(suffix + 1) + 1;
+ if (suffix_len == 1)
+ {
+ goto Bad_url;
+ }
+ vault_url_len = prefix_len + suffix_len;
+ /*
+ The scheme always ends with "://", while the "suffix"
+ points to the first of the slashes:
+ */
+ if (*(suffix - 1) == ':' && suffix[1] == '/')
+ {
+ /* Let's check that only the schema is present: */
+ if (suffix_len == 2)
+ {
+ goto No_Host;
+ }
+ /* Save the current position: */
+ const char *start = suffix + 2;
+ /* We need to find next slash: */
+ suffix = strchr(start, '/');
+ if (suffix == NULL)
+ {
+ goto Bad_url;
+ }
+ /* Update the prefix and suffix lengths: */
+ prefix_len = (size_t) (suffix - vault_url);
+ suffix_len = vault_url_len - prefix_len;
+ /*
+ The slash right after the scheme is the absence of a hostname,
+ this is invalid for all schemes, except for the "file://"
+ (this allowed for debugging purposes only):
+ */
+ if (suffix == start &&
+ (prefix_len != 7 || memcmp(vault_url, "file", 4) != 0))
+ {
+ goto No_Host;
+ }
+ /* Check if the suffix consists only of the slash: */
+ if (suffix_len == 1)
+ {
+ goto Bad_url;
+ }
+ }
+ /* Let's skip all leading slashes: */
+ while (suffix[1] == '/')
+ {
+ suffix++;
+ suffix_len--;
+ if (suffix_len == 1)
+ {
+ goto Bad_url;
+ }
+ }
+ /*
+ Checking for "/v1" sequence (the leading slash has
+ already been checked):
+ */
+ if (suffix_len < 3 || suffix[1] != 'v' || suffix[2] != '1')
+ {
+ goto Bad_url;
+ }
+ /* Let's skip the "/v1" sequence: */
+ suffix_len -= 3;
+ if (suffix_len == 0)
+ {
+No_Secret:
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Supplied URL does not contain a secret name: \"%s\"",
+ 0, vault_url);
+ return 1;
+ }
+ suffix += 3;
+ /* Checking for a slash at the end of the "/v1/" sequence: */
+ if (suffix[0] != '/')
+ {
+ goto Bad_url;
+ }
+ /* Skip slashes after the "/v1" sequence: */
+ do
+ {
+ suffix++;
+ suffix_len--;
+ if (suffix_len == 0)
+ {
+ goto No_Secret;
+ }
+ } while (suffix[0] == '/');
+ /* Remove trailing slashes at the end of the url: */
+ while (vault_url[vault_url_len - 1] == '/')
+ {
+ vault_url_len--;
+ suffix_len--;
+ }
+ /*
+ Checking the maximum allowable length to protect
+ against allocating too much memory on the stack:
+ */
+ if (vault_url_len > MAX_URL_SIZE)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Maximum allowed vault URL length exceeded", 0);
+ return 1;
+ }
+ /*
+ In advance, we create a buffer containing the URL for vault
+ + the "/data/" suffix (7 characters):
+ */
+ if (!(vault_url_data = (char *) alloc(vault_url_len + 7)))
+ {
+ return 1;
+ }
+ memcpy(vault_url_data, vault_url, vault_url_len);
+ memcpy(vault_url_data + vault_url_len, "/data/", 7);
+ cache_max_time = ms_to_ticks(cache_timeout);
+ cache_max_ver_time = ms_to_ticks(cache_version_timeout);
+ /* Initialize curl: */
+ CURLcode curl_res = curl_global_init(CURL_GLOBAL_ALL);
+ if (curl_res != CURLE_OK)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "unable to initialize curl library, "
+ "curl returned this error code: %u "
+ "with the following error message: %s",
+ 0, curl_res, curl_easy_strerror(curl_res));
+ return 1;
+ }
+ curl_inited = true;
+ slist = curl_slist_append(slist, token_header);
+ if (slist == NULL)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "curl: unable to construct slist", 0);
+ return 1;
+ }
+ /*
+ If we do not need to check the key-value storage version,
+ then we immediately return from this function:
+ */
+ if (check_kv_version == 0) {
+ return 0;
+ }
+ /*
+ Let's construct a URL to check the version of the key-value storage:
+ */
+ char *mount_url = (char *) alloc(vault_url_len + 11 + 6);
+ if (mount_url == NULL)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Memory allocation error", 0);
+ return 1;
+ }
+ /*
+ The prefix length must be recalculated, as it may have
+ changed in the process of discarding trailing slashes:
+ */
+ prefix_len = vault_url_len - suffix_len;
+ memcpy(mount_url, vault_url_data, prefix_len);
+ memcpy(mount_url + prefix_len, "sys/mounts/", 11);
+ memcpy(mount_url + prefix_len + 11, vault_url_data + prefix_len, suffix_len);
+ memcpy(mount_url + prefix_len + 11 + suffix_len, "/tune", 6);
+#if HASHICORP_DEBUG_LOGGING
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "storage mount url: [%s]",
+ ME_ERROR_LOG_ONLY | ME_NOTE, mount_url);
+#endif
+ int rc = check_version(mount_url);
+ free(mount_url);
+ return rc;
+}
+
+int HCData::check_version (const char *mount_url) const
+{
+ std::string response_str;
+ int rc = curl_run(mount_url, &response_str, false);
+ if (rc != OPERATION_OK)
+ {
+storage_error:
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get storage options for \"%s\"",
+ 0, mount_url);
+ return 1;
+ }
+ const char *response = response_str.c_str();
+ size_t response_len = response_str.size();
+ /*
+ If the key is not found, this is not considered a fatal error,
+ but we need to add an informational message to the log:
+ */
+ if (response_len == 0)
+ {
+ goto storage_error;
+ }
+ const char *js;
+ int js_len;
+ if (json_get_object_key(response, response + response_len, "options",
+ &js, &js_len) != JSV_OBJECT)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get storage options (http response is: %s)",
+ 0, response);
+ return 1;
+ }
+ const char *ver;
+ int ver_len;
+ enum json_types jst =
+ json_get_object_key(js, js + js_len, "version", &ver, &ver_len);
+ if (jst != JSV_STRING && jst != JSV_NUMBER)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Unable to get storage version (http response is: %s)",
+ 0, response);
+ return 1;
+ }
+ unsigned long version = strtoul(ver, NULL, 10);
+ if (version > UINT_MAX || (version == ULONG_MAX && errno))
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Integer conversion error (for version number) "
+ "(http response is: %s)", 0, response);
+ return 1;
+ }
+ if (version < 2)
+ {
+ my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
+ "Key-value storage must be version "
+ "number 2 or later", 0);
+ return 1;
+ }
+ return 0;
+}
+
+static int hashicorp_key_management_plugin_init(void *p)
+{
+ int rc = data.init();
+ if (rc)
+ {
+ data.deinit();
+ }
+ return rc;
+}
+
+static int hashicorp_key_management_plugin_deinit(void *p)
+{
+ data.cache_clean();
+ data.deinit();
+ return 0;
+}
+
+/*
+ Plugin library descriptor
+*/
+maria_declare_plugin(hashicorp_key_management)
+{
+ MariaDB_ENCRYPTION_PLUGIN,
+ &hashicorp_key_management_plugin,
+ "hashicorp_key_management",
+ "MariaDB Corporation",
+ "HashiCorp Vault key management plugin",
+ PLUGIN_LICENSE_GPL,
+ hashicorp_key_management_plugin_init,
+ hashicorp_key_management_plugin_deinit,
+ 0x0200 /* 2.0 */,
+ NULL, /* status variables */
+ settings,
+ "2.0",
+ MariaDB_PLUGIN_MATURITY_STABLE
+}
+maria_declare_plugin_end;
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.inc b/plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.inc
new file mode 100644
index 00000000000..dcfb8d1bb85
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.inc
@@ -0,0 +1,4 @@
+if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'hashicorp_key_management' AND PLUGIN_STATUS='ACTIVE'`)
+{
+ --skip Test requires active hashicorp_key_management plugin
+}
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.opt b/plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.opt
new file mode 100644
index 00000000000..1e677dad8b3
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/include/have_hashicorp_key_management_plugin.opt
@@ -0,0 +1,6 @@
+--plugin-load-add=$HASHICORP_KEY_MANAGEMENT_SO
+--loose-hashicorp-key-management
+--loose-hashicorp-key-management-vault-url="$VAULT_ADDR/v1/mariadbtest/"
+--loose-hashicorp-key-management-token="$VAULT_TOKEN"
+--loose-hashicorp-key-management-timeout=60
+--loose-hashicorp-key-management-check-kv-version=off
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/include/have_mariabackup.inc b/plugin/hashicorp_key_management/mysql-test/vault/include/have_mariabackup.inc
new file mode 100644
index 00000000000..7506317193f
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/include/have_mariabackup.inc
@@ -0,0 +1,3 @@
+if (!$XTRABACKUP) {
+ --skip Needs mariabackup;
+}
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_after_recreate.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_after_recreate.result
new file mode 100644
index 00000000000..a48c7873a09
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_after_recreate.result
@@ -0,0 +1,9 @@
+# restart: with restart_parameters
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES ('foo'),('bar');
+select @@hashicorp_key_management_caching_enabled, @@hashicorp_key_management_cache_timeout;
+@@hashicorp_key_management_caching_enabled @@hashicorp_key_management_cache_timeout
+1 180000
+CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+DROP TABLE IF EXISTS t1, t2;
+# restart
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_timeout_update.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_timeout_update.result
new file mode 100644
index 00000000000..a26b813a3e7
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_cache_timeout_update.result
@@ -0,0 +1,19 @@
+SELECT
+@@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT,
+@@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT;
+@@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT
+0 180000
+SET GLOBAL
+HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT= 1,
+HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT= 1;
+SELECT
+@@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT,
+@@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT;
+@@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT
+1 1
+SET GLOBAL HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT=0, HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT=180000;
+SELECT
+@@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT,
+@@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT;
+@@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT
+0 180000
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_check_kv_version.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_check_kv_version.result
new file mode 100644
index 00000000000..b7a1c07782e
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_check_kv_version.result
@@ -0,0 +1,9 @@
+[ERROR] mariadbd: hashicorp: Key-value storage must be version number 2 or later
+# restart: with restart_parameters
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t1 VALUES ('foo'),('bar');
+# restart: with restart_parameters
+CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
+INSERT INTO t2 VALUES ('foo'),('bar');
+DROP TABLE t1, t2;
+# restart
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_encode.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_encode.result
new file mode 100644
index 00000000000..04ac22b9626
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_encode.result
@@ -0,0 +1,49 @@
+SHOW GLOBAL variables LIKE "hashicorp%";
+Variable_name Value
+hashicorp_key_management_cache_timeout 60000
+hashicorp_key_management_cache_version_timeout 0
+hashicorp_key_management_caching_enabled ON
+hashicorp_key_management_check_kv_version OFF
+hashicorp_key_management_max_retries 3
+hashicorp_key_management_timeout 60
+hashicorp_key_management_use_cache_on_timeout OFF
+hashicorp_key_management_vault_ca
+hashicorp_key_management_vault_url VAULT_ADDR/v1/mariadbtest/
+create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=1
+insert t1 values (12345, repeat('1234567890', 20));
+alter table t1 encryption_key_id=2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=2
+alter table t1 encryption_key_id=33;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=2
+alter table t1 encryption_key_id=3;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=3
+alter table t1 encryption_key_id=4;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `b` char(200) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci `encrypted`=yes `encryption_key_id`=4
+drop table t1;
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_migration.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_migration.result
new file mode 100644
index 00000000000..e2cc0452958
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_migration.result
@@ -0,0 +1,39 @@
+# restart: with restart_parameters
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t1 VALUES ('foo'),('bar');
+SELECT * FROM t1;
+a
+foo
+bar
+# restart: with restart_parameters
+CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t2 VALUES ('baz'),('qux');
+SELECT * FROM t2;
+a
+baz
+qux
+#
+# This should not fail, but it does if the bug is not fixed
+#
+SELECT * FROM t1;
+a
+foo
+bar
+SHOW WARNINGS;
+Level Code Message
+# restart: with restart_parameters
+SELECT * FROM t1;
+a
+foo
+bar
+#
+# This should not fail, but it does if the bug is not fixed
+#
+SELECT * FROM t2;
+a
+baz
+qux
+SHOW WARNINGS;
+Level Code Message
+DROP TABLE t1, t2;
+# restart
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_rotation_age.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_rotation_age.result
new file mode 100644
index 00000000000..6e06e0f1d30
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_rotation_age.result
@@ -0,0 +1,97 @@
+SHOW GLOBAL variables LIKE "hashicorp%";
+Variable_name Value
+hashicorp_key_management_cache_timeout 60000
+hashicorp_key_management_cache_version_timeout 0
+hashicorp_key_management_caching_enabled ON
+hashicorp_key_management_check_kv_version OFF
+hashicorp_key_management_max_retries 3
+hashicorp_key_management_timeout 60
+hashicorp_key_management_use_cache_on_timeout OFF
+hashicorp_key_management_vault_ca
+hashicorp_key_management_vault_url VAULT_ADDR/v1/mariadbtest/
+# Restart the server with encryption
+# restart: with restart_parameters
+CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
+INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
+INSERT INTO t1 SELECT * FROM t1;
+CREATE TABLE t2(f1 INT, f2 VARCHAR(256))engine=innodb;
+INSERT INTO t2 SELECT * FROM t1;
+CREATE TABLE t3(f1 INT, f2 VARCHAR(256))engine=innodb encrypted=yes;
+INSERT INTO t3 SELECT * FROM t1;
+CREATE TABLE t33(f1 INT, f2 VARCHAR(256)) engine=innodb encrypted=yes encryption_key_id=2;
+INSERT INTO t33 VALUES (12345, '1234567890');
+# Restart the server with encryption and rotate key age
+# restart: with restart_parameters
+# Wait until encryption threads have encrypted all tablespaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+NAME
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+NAME CURRENT_KEY_VERSION
+test/t1 1
+test/t2 1
+test/t3 1
+test/t33 1
+# Restart the server with innodb_encryption_rotate_key_age= 0
+# restart: with restart_parameters
+create table t4 (f1 int not null)engine=innodb encrypted=NO;
+alter table t33 encryption_key_id=111;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+# Update key value to version 2
+alter table t33 encryption_key_id=222;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+# Wait until encryption threads have encrypted all tablespaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+NAME
+test/t4
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+NAME CURRENT_KEY_VERSION
+test/t1 2
+test/t2 2
+test/t3 2
+test/t33 1
+# Disable encryption when innodb_encryption_rotate_key_age is 0
+set global innodb_encrypt_tables = OFF;
+# Wait until encryption threads to decrypt all encrypted tablespaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+NAME
+test/t1
+test/t2
+test/t4
+# Display only encrypted create tables (t3)
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+NAME CURRENT_KEY_VERSION
+test/t3 2
+test/t33 1
+alter table t33 encryption_key_id=333;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+# Update key value to version 3
+alter table t33 encryption_key_id=444;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+# Enable encryption when innodb_encryption_rotate_key_age is 0
+set global innodb_encrypt_tables = ON;
+# Wait until encryption threads to encrypt all unencrypted tablespaces
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+NAME
+test/t4
+# Display only unencrypted create tables (t4)
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+NAME CURRENT_KEY_VERSION
+test/t1 3
+test/t2 3
+test/t3 3
+test/t33 1
+# restart: with restart_parameters
+alter table t33 encryption_key_id=555;
+ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+NAME
+test/t4
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+NAME CURRENT_KEY_VERSION
+test/t1 3
+test/t2 3
+test/t3 3
+test/t33 1
+DROP TABLE t4, t3, t2, t1;
+DROP TABLE t33;
+# restart
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_mariabackup.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_mariabackup.result
new file mode 100644
index 00000000000..6a4a03ff9b4
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_mariabackup.result
@@ -0,0 +1,13 @@
+CREATE TABLE t(i INT) ENGINE INNODB encrypted=yes encryption_key_id=1;
+INSERT INTO t VALUES(1);
+# mariabackup backup
+INSERT INTO t VALUES(2);
+# mariabackup prepare
+# shutdown server
+# remove datadir
+# mariabackup move back
+# restart
+SELECT * FROM t;
+i
+1
+DROP TABLE t;
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_url_prefix.result b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_url_prefix.result
new file mode 100644
index 00000000000..3dea0485166
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_url_prefix.result
@@ -0,0 +1,31 @@
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "/"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "abcd"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "abcd/"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "abcd//"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "/abcd"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "abcd/v"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "a/v1"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "a/v1b"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "a/v1/"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "a/v1///"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "a///v1/"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "///v1/a"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "http://"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "http:///"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "http://a"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "http://abcd"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "http://abcd/"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "http://abcd//"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "http:///abcd"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "http://abcd/v"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "http://a/v1"
+[ERROR] mariadbd: hashicorp: According to the Hashicorp Vault API rules, the path inside the URL must start with the "/v1/" prefix, while the supplied URL value is: "http://a/v1b"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "http://a/v1/"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "http://a/v1///"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a secret name: "http://a///v1/"
+[ERROR] mariadbd: hashicorp: Supplied URL does not contain a hostname: "http://///v1/a"
+# restart: with restart_parameters
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t1 VALUES ('foo'),('bar');
+DROP TABLE t1;
+# restart
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/suite.pm b/plugin/hashicorp_key_management/mysql-test/vault/suite.pm
new file mode 100644
index 00000000000..1d78985f363
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/suite.pm
@@ -0,0 +1,16 @@
+package My::Suite::Vault;
+
+@ISA = qw(My::Suite);
+
+use strict;
+
+return "Hashicorp Vault key management utility not found"
+ unless `sh -c "command -v vault"`;
+
+return "You need to set the value of the VAULT_ADDR variable"
+ unless $ENV{VAULT_ADDR};
+
+return "You need to set the value of the VAULT_TOKEN variable"
+ unless $ENV{VAULT_TOKEN};
+
+bless {};
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.opt b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.opt
new file mode 100644
index 00000000000..0a4ff1d5986
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.opt
@@ -0,0 +1,2 @@
+--loose-hashicorp-key-management-cache-timeout=180000
+--loose-hashicorp-key-management-cache-version-timeout=180000
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test
new file mode 100644
index 00000000000..9dee7376497
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_after_recreate.test
@@ -0,0 +1,35 @@
+# MDEV-28330: Key caching doesn't appear to be working
+
+# The test presumes that the local vault is running at $VAULT_ADDR,
+# and the token is configured in $VAULT_TOKEN.
+
+--source include/have_innodb.inc
+--source hashicorp_plugin.inc
+
+--exec vault secrets disable bug > /dev/null
+--exec vault secrets enable -path /bug -version=2 kv > /dev/null
+--exec vault kv put /bug/1 data=01234567890123456789012345678901 > /dev/null
+--exec vault kv put /bug/4 data=01234567890123456789012345678904 > /dev/null
+
+--let $restart_parameters=--plugin-load-add=hashicorp_key_management --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug/" --hashicorp-key-management-token="$VAULT_TOKEN"
+--let $restart_noprint=1
+--source include/restart_mysqld.inc
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+select @@hashicorp_key_management_caching_enabled, @@hashicorp_key_management_cache_timeout;
+
+--exec vault secrets disable bug > /dev/null
+--exec vault secrets enable -path /bug -version=2 kv > /dev/null
+--exec vault kv put /bug/1 data=01234567890123456789012345678901 > /dev/null
+
+CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
+
+# Cleanup
+DROP TABLE IF EXISTS t1, t2;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--exec vault secrets disable bug > /dev/null
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.opt b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.opt
new file mode 100644
index 00000000000..cdc590b33ed
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.opt
@@ -0,0 +1,2 @@
+--loose-hashicorp-key-management-cache-timeout=180000
+--loose-hashicorp-key-management-cache-version-timeout=0
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.test
new file mode 100644
index 00000000000..61c23d44548
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_cache_timeout_update.test
@@ -0,0 +1,23 @@
+# MDEV-28291: Cache variables claim to be dynamic but changes are ignored
+
+--source hashicorp_plugin.inc
+--source hashicorp_init.inc
+
+--let $ct=`SELECT @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT`
+--let $vt=`SELECT @@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT`
+
+SELECT
+ @@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT,
+ @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT;
+SET GLOBAL
+ HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT= 1,
+ HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT= 1;
+SELECT
+ @@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT,
+ @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT;
+--eval SET GLOBAL HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT=$vt, HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT=$ct
+SELECT
+ @@HASHICORP_KEY_MANAGEMENT_CACHE_VERSION_TIMEOUT,
+ @@HASHICORP_KEY_MANAGEMENT_CACHE_TIMEOUT;
+
+--source hashicorp_deinit.inc
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test
new file mode 100644
index 00000000000..c108781bbd2
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_check_kv_version.test
@@ -0,0 +1,54 @@
+# MDEV-28276: Checking for kv version=2 as mandatory
+
+# The test presumes that the local vault is running at $VAULT_ADDR,
+# and the token is configured in $VAULT_TOKEN.
+
+--source include/have_innodb.inc
+--source hashicorp_plugin.inc
+
+--exec vault secrets disable bug1 > /dev/null
+--exec vault secrets disable good > /dev/null
+--exec vault secrets enable -path /bug1 -version=1 kv > /dev/null
+--exec vault secrets enable -path /good -version=2 kv > /dev/null
+--exec vault kv put /bug1/1 data=01234567890123456789012345678901 > /dev/null
+--exec vault kv put /good/1 data=01234567890123456789012345678901 > /dev/null
+--exec vault kv put /good/2 data=012345678901234567890123456789ab > /dev/null
+
+--source include/shutdown_mysqld.inc
+
+--let $LOG_FILE=$MYSQLTEST_VARDIR/log/vault.err
+--error 0,1
+--remove_file $LOG_FILE
+
+--let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=on --hashicorp-key-management-token="$VAULT_TOKEN"
+--let $defaults=--defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf $vault_defaults --log-error=$LOG_FILE
+
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug1"
+
+--exec grep -oE "\[ERROR\] .*: hashicorp: .*" -- $LOG_FILE
+
+--remove_file $LOG_FILE
+
+--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/good"
+--let $restart_noprint=1
+--source include/start_mysqld.inc
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/good//"
+--source include/restart_mysqld.inc
+
+CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
+INSERT INTO t2 VALUES ('foo'),('bar');
+
+# Cleanup
+
+DROP TABLE t1, t2;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--exec vault secrets disable bug1 > /dev/null
+--exec vault secrets disable good > /dev/null
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_deinit.inc b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_deinit.inc
new file mode 100644
index 00000000000..b6551e0bc92
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_deinit.inc
@@ -0,0 +1 @@
+--exec vault secrets disable mariadbtest > /dev/null
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_encode.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_encode.test
new file mode 100644
index 00000000000..338b3413e77
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_encode.test
@@ -0,0 +1,25 @@
+--source include/have_innodb.inc
+--source hashicorp_plugin.inc
+
+--source hashicorp_init.inc
+
+replace_result $VAULT_ADDR VAULT_ADDR;
+SHOW GLOBAL variables LIKE "hashicorp%";
+
+create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1;
+show create table t1;
+insert t1 values (12345, repeat('1234567890', 20));
+
+alter table t1 encryption_key_id=2;
+show create table t1;
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t1 encryption_key_id=33;
+show create table t1;
+alter table t1 encryption_key_id=3;
+show create table t1;
+alter table t1 encryption_key_id=4;
+show create table t1;
+
+drop table t1;
+
+--source hashicorp_deinit.inc
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_init.inc b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_init.inc
new file mode 100644
index 00000000000..172c1d87935
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_init.inc
@@ -0,0 +1,7 @@
+--exec vault secrets disable mariadbtest > /dev/null
+--exec vault secrets enable -path /mariadbtest -version=2 kv > /dev/null
+--exec vault kv put /mariadbtest/1 data="123456789ABCDEF0123456789ABCDEF0" > /dev/null
+--exec vault kv put /mariadbtest/2 data="23456789ABCDEF0123456789ABCDef01" > /dev/null
+--exec vault kv put /mariadbtest/3 data="00000000000000000000000000000000" > /dev/null
+--exec vault kv put /mariadbtest/3 data="00000000000000000000000000000001" > /dev/null
+--exec vault kv put /mariadbtest/4 data="456789ABCDEF0123456789ABCDEF0123" > /dev/null
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test
new file mode 100644
index 00000000000..2e67c2cc639
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_migration.test
@@ -0,0 +1,57 @@
+# MDEV-28279: Cannot migrate hexadecimal keys from file key management
+
+# The test presumes that the local vault is running at $VAULT_ADDR,
+# and the token is configured in $VAULT_TOKEN.
+
+--source include/have_innodb.inc
+--source hashicorp_plugin.inc
+
+--let $my_key=012345678901234567890123456789aB
+--exec echo "1;$my_key" > $MYSQL_TMP_DIR/mykeys.txt
+--let $restart_parameters=--plugin-load-add=file_key_management --loose-file-key-management-filename=$MYSQL_TMP_DIR/mykeys.txt --hashicorp-key-management=off
+--let $restart_noprint=1
+--source include/restart_mysqld.inc
+
+if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'file_key_management' AND PLUGIN_STATUS='ACTIVE'`)
+{
+ --skip Test requires file_key_management plugin
+}
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t1 VALUES ('foo'),('bar');
+SELECT * FROM t1;
+
+--exec vault secrets disable bug > /dev/null
+--exec vault secrets enable -path /bug -version=2 kv > /dev/null
+--exec vault kv put /bug/1 data=$my_key > /dev/null
+--let $restart_parameters=--plugin-load-add=hashicorp_key_management --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug/" --hashicorp-key-management-token="$VAULT_TOKEN"
+--source include/restart_mysqld.inc
+
+CREATE TABLE t2 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t2 VALUES ('baz'),('qux');
+SELECT * FROM t2;
+--echo #
+--echo # This should not fail, but it does if the bug is not fixed
+--echo #
+--error 0,1932,1877
+SELECT * FROM t1;
+SHOW WARNINGS;
+
+--let $restart_parameters=--plugin-load-add=file_key_management --file-key-management-filename=$MYSQL_TMP_DIR/mykeys.txt --hashicorp-key-management=off
+--source include/restart_mysqld.inc
+
+SELECT * FROM t1;
+--echo #
+--echo # This should not fail, but it does if the bug is not fixed
+--echo #
+--error 0,1932,1877
+SELECT * FROM t2;
+SHOW WARNINGS;
+
+# Cleanup
+DROP TABLE t1, t2;
+
+--exec vault secrets disable bug > /dev/null
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.opt b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.opt
new file mode 100644
index 00000000000..42a86275483
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.opt
@@ -0,0 +1 @@
+--loose-hashicorp-key-management-cache-version-timeout=0
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test
new file mode 100644
index 00000000000..ce99406ab06
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_key_rotation_age.test
@@ -0,0 +1,135 @@
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--source hashicorp_plugin.inc
+
+--source hashicorp_init.inc
+
+replace_result $VAULT_ADDR VAULT_ADDR;
+SHOW GLOBAL variables LIKE "hashicorp%";
+
+--echo # Restart the server with encryption
+let $default_parameters="--innodb-tablespaces-encryption --innodb_encrypt_tables=ON";
+let $restart_noprint=1;
+let $restart_parameters=$default_parameters;
+--source include/restart_mysqld.inc
+
+CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
+INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
+INSERT INTO t1 SELECT * FROM t1;
+
+CREATE TABLE t2(f1 INT, f2 VARCHAR(256))engine=innodb;
+INSERT INTO t2 SELECT * FROM t1;
+
+CREATE TABLE t3(f1 INT, f2 VARCHAR(256))engine=innodb encrypted=yes;
+INSERT INTO t3 SELECT * FROM t1;
+
+CREATE TABLE t33(f1 INT, f2 VARCHAR(256)) engine=innodb encrypted=yes encryption_key_id=2;
+INSERT INTO t33 VALUES (12345, '1234567890');
+
+--echo # Restart the server with encryption and rotate key age
+
+let $restart_parameters=$default_parameters --innodb_encryption_threads=5 --innodb_encryption_rotate_key_age=16384;
+--source include/restart_mysqld.inc
+
+--echo # Wait until encryption threads have encrypted all tablespaces
+
+--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+--sorted_result
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+
+--echo # Restart the server with innodb_encryption_rotate_key_age= 0
+
+let $restart_parameters=$default_parameters --innodb_encryption_threads=1 --innodb_encryption_rotate_key_age=0;
+--source include/restart_mysqld.inc
+
+create table t4 (f1 int not null)engine=innodb encrypted=NO;
+
+# artificial error useful for debugging a plugin
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t33 encryption_key_id=111;
+
+--echo # Update key value to version 2
+--exec vault kv put /mariadbtest/1 data="11112222333344445555666677778888" > /dev/null
+--sleep 2
+
+# artificial error useful for debugging a plugin
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t33 encryption_key_id=222;
+
+--echo # Wait until encryption threads have encrypted all tablespaces
+
+--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+--sorted_result
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+
+--echo # Disable encryption when innodb_encryption_rotate_key_age is 0
+set global innodb_encrypt_tables = OFF;
+
+--echo # Wait until encryption threads to decrypt all encrypted tablespaces
+
+--let $tables_count= `select count(*) - 1 from information_schema.tables where engine = 'InnoDB'`
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0;
+--source include/wait_condition.inc
+
+--sorted_result
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+--echo # Display only encrypted create tables (t3)
+--sorted_result
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+
+# artificial error useful for debugging a plugin
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t33 encryption_key_id=333;
+
+--echo # Update key value to version 3
+--exec vault kv put /mariadbtest/1 data="5555222233334444555566667777AAAA" > /dev/null
+--sleep 2
+
+# artificial error useful for debugging a plugin
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t33 encryption_key_id=444;
+
+--echo # Enable encryption when innodb_encryption_rotate_key_age is 0
+set global innodb_encrypt_tables = ON;
+
+--echo # Wait until encryption threads to encrypt all unencrypted tablespaces
+
+--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
+--let $wait_timeout= 600
+--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
+--source include/wait_condition.inc
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+--echo # Display only unencrypted create tables (t4)
+--sorted_result
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+
+--let $restart_parameters=$default_parameters
+--source include/restart_mysqld.inc
+
+# artificial error useful for debugging a plugin
+--error ER_ILLEGAL_HA_CREATE_OPTION
+alter table t33 encryption_key_id=555;
+
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE "test/%";
+--sorted_result
+SELECT NAME, CURRENT_KEY_VERSION FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0 AND NAME LIKE "test/%";
+
+DROP TABLE t4, t3, t2, t1;
+DROP TABLE t33;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--source hashicorp_deinit.inc
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test
new file mode 100644
index 00000000000..6ade4e115a1
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_mariabackup.test
@@ -0,0 +1,39 @@
+--source include/big_test.inc
+--source include/have_innodb.inc
+--source include/have_mariabackup.inc
+--source hashicorp_plugin.inc
+
+--source hashicorp_init.inc
+
+CREATE TABLE t(i INT) ENGINE INNODB encrypted=yes encryption_key_id=1;
+INSERT INTO t VALUES(1);
+
+echo # mariabackup 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
+
+INSERT INTO t VALUES(2);
+
+echo # mariabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+
+let $_datadir= `SELECT @@datadir`;
+echo # shutdown server;
+--source include/shutdown_mysqld.inc
+echo # remove datadir;
+rmdir $_datadir;
+echo # mariabackup move back;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2 --throttle=1;
+--source include/start_mysqld.inc
+--enable_result_log
+
+SELECT * FROM t;
+DROP TABLE t;
+
+rmdir $targetdir;
+
+--source hashicorp_deinit.inc
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_plugin.inc b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_plugin.inc
new file mode 100644
index 00000000000..4d505fb30e3
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_plugin.inc
@@ -0,0 +1,2 @@
+--source include/have_hashicorp_key_management_plugin.inc
+--source include/not_windows.inc
diff --git a/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test
new file mode 100644
index 00000000000..4d26affb467
--- /dev/null
+++ b/plugin/hashicorp_key_management/mysql-test/vault/t/hashicorp_url_prefix.test
@@ -0,0 +1,93 @@
+# MDEV-28277: Checking for mandatory "/v1/" prefix in the URL
+
+# The test presumes that the local vault is running at $VAULT_ADDR,
+# and the token is configured in $VAULT_TOKEN.
+
+--source include/have_innodb.inc
+--source hashicorp_plugin.inc
+
+--exec vault secrets disable bug > /dev/null
+--exec vault secrets enable -path /bug -version=2 kv > /dev/null
+--exec vault kv put /bug/1 data=01234567890123456789012345678901 > /dev/null
+
+--source include/shutdown_mysqld.inc
+
+--let $LOG_FILE=$MYSQLTEST_VARDIR/log/vault.err
+--error 0,1
+--remove_file $LOG_FILE
+
+--let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=off --hashicorp-key-management-token="$VAULT_TOKEN"
+--let $defaults=--defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf $vault_defaults --log-error=$LOG_FILE
+
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd//"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="/abcd"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd/v"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1b"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1///"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a///v1/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="///v1/a"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http:///"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd//"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http:///abcd"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd/v"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1b"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1///"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a///v1/"
+--error 1
+--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://///v1/a"
+
+--exec grep -oE "\[ERROR\] .*: hashicorp: .*" -- $LOG_FILE
+
+--remove_file $LOG_FILE
+
+--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url="$VAULT_ADDR/v1/bug///"
+--let $restart_noprint=1
+--source include/start_mysqld.inc
+
+CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+# Cleanup
+
+DROP TABLE t1;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--exec vault secrets disable bug > /dev/null
diff --git a/plugin/type_inet/item_inetfunc.h b/plugin/type_inet/item_inetfunc.h
index 4acb42d2175..da87c7b3309 100644
--- a/plugin/type_inet/item_inetfunc.h
+++ b/plugin/type_inet/item_inetfunc.h
@@ -37,7 +37,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet_aton") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
max_length= 21;
@@ -65,7 +65,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet_ntoa") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
fix_length_and_charset(3 * 8 + 7, default_charset());
@@ -111,7 +111,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
fix_length_and_charset(16, &my_charset_bin);
@@ -143,7 +143,7 @@ public:
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
diff --git a/plugin/type_uuid/item_uuidfunc.h b/plugin/type_uuid/item_uuidfunc.h
index 296b6592f10..aa6ff999b99 100644
--- a/plugin/type_uuid/item_uuidfunc.h
+++ b/plugin/type_uuid/item_uuidfunc.h
@@ -27,7 +27,7 @@ protected:
{ 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
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(DTCollation_numeric());
fix_char_length(uuid_len());
diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc
index fe87e17f4ee..df2ab4af1f8 100644
--- a/plugin/user_variables/user_variables.cc
+++ b/plugin/user_variables/user_variables.cc
@@ -11,7 +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 Street, Fifth Floor, Boston, MA 02111-1335 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER
#include <my_global.h>
diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql
index 0454f4d2f05..48931ac6ea6 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 23 January 2023.','','');
-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.8 from the MariaDB Knowledge Base on 23 January 2023.','','');
+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.9 from the MariaDB Knowledge Base on 23 January 2023.','','');
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/');
@@ -874,74 +874,75 @@ 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 (763,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 (764,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 (765,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 (766,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 (767,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 (768,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 (769,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 (770,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 (771,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 (772,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 (773,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 (774,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 (775,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 (776,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 (777,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 (778,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 (779,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 (780,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 (781,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 (782,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 (783,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 (784,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 (785,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 (786,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 (787,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 (788,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 (789,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 (790,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 (791,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 (792,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 = 792;
-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 = 792;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (793,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 (794,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 (795,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 (796,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 (797,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 (798,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 (799,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 (800,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 (801,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 (802,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 (803,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 (804,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 (805,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 (806,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 (807,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 (808,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 (809,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\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\nInserting Data\n--------------\n\nWhen data is inserted into a system-versioned table, it is given a row_start\nvalue of the current timestamp, and a row_end value of\nFROM_UNIXTIME(2147483647.999999). The current timestamp can be adjusted by\nsetting the timestamp system variable, for example:\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2022-10-24 23:09:38 |\n+---------------------+\n\nINSERT INTO t VALUES(1);\n\nSET @@timestamp = UNIX_TIMESTAMP(\'2033-10-24\');\n\nINSERT INTO t VALUES(2);\n\nSET @@timestamp = default;\n\nINSERT INTO t VALUES(3);\n\nSELECT a,row_start,row_end FROM t;\n+------+----------------------------+----------------------------+\n| a | row_start | row_end |\n+------+----------------------------+----------------------------+\n| 1 | 2022-10-24 23:09:38.951347 | 2038-01-19 05:14:07.999999 |\n| 2 | 2033-10-24 00:00:00.000000 | 2038-01-19 05:14:07.999999 |\n| 3 | 2022-10-24 23:09:38.961857 | 2038-01-19 05:14:07.999999 |\n+------+----------------------------+----------------------------+\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. This is usually the same as if one had specified FOR SYSTEM_TIME AS OF\nCURRENT_TIMESTAMP, unless one has adjusted the row_start value (until MariaDB\n10.11, only possible by setting the secure_timestamp variable). For example:\n\nCREATE OR REPLACE TABLE t (a int) WITH SYSTEM VERSIONING;\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2022-10-24 23:43:37 |\n+---------------------+\n\nINSERT INTO t VALUES (1);\n\nSET @@timestamp = UNIX_TIMESTAMP(\'2033-03-03\');\n\nINSERT INTO t VALUES (2);\n\nDELETE FROM t;\n\nSET @@timestamp = default;\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME ALL;\n+------+----------------------------+----------------------------+\n| a | row_start | row_end |\n+------+----------------------------+----------------------------+\n| 1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n| 2 | 2033-03-03 00:00:00.000000 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n2 rows in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP;\n+------+----------------------------+----------------------------+\n| a | row_start | row_end |\n+------+----------------------------+----------------------------+\n| 1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n1 row in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t;\nEmpty set (0.001 sec)\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','','https://mariadb.com/kb/en/system-versioned-tables/');
-update help_topic set description = CONCAT(description, '\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\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\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\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* Before MariaDB 10.11, mariadb-dump did not read historical rows from\nversioned tables, and so historical data would not be backed up. Also, a\nrestore of the timestamps would not be possible as they cannot be defined by\nan insert/a user. From MariaDB 10.11, use the -H or --dump-history options to\ninclude the history.\n\nURL: https://mariadb.com/kb/en/system-versioned-tables/') WHERE help_topic_id = 809;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (810,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 (811,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 (812,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 (813,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 (814,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 (815,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 (816,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 (817,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 (818,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 (819,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 (820,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. The\neffective maximum length of the string depends on how many bytes are used per\ncharacter and can be up to 96 characters.\n\nDue to MDEV-29994, the password can be silently truncated to 41 characters\nwhen MariaDB is restarted. For this reason it is recommended to use a password\nthat is shorter than this.\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;','','https://mariadb.com/kb/en/change-master-to/');
-update help_topic set description = CONCAT(description, '\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\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') WHERE help_topic_id = 820;
-update help_topic set description = CONCAT(description, '\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\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 = 820;
-insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (821,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 (822,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 (823,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 (824,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 (825,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 (826,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 (827,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 (828,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 (766,40,'JSON_OVERLAPS','MariaDB starting with 10.9\n--------------------------\nJSON_OVERLAPS was added in MariaDB 10.9.\n\nSyntax\n------\n\nJSON_OVERLAPS(json_doc1, json_doc2)\n\nDescription\n-----------\n\nJSON_OVERLAPS() compares two json documents and returns true if they have at\nleast one common key-value pair between two objects, array element common\nbetween two arrays, or array element common with scalar if one of the\narguments is a scalar and other is an array. If two json documents are\nscalars, it returns true if they have same type and value.\n\nIf none of the above conditions are satisfied then it returns false.\n\nExamples\n--------\n\nSELECT JSON_OVERLAPS(\'false\', \'false\');\n+---------------------------------+\n| JSON_OVERLAPS(\'false\', \'false\') |\n+---------------------------------+\n| 1 |\n+---------------------------------+\n\nSELECT JSON_OVERLAPS(\'true\', \'[\"abc\", 1, 2, true, false]\');\n+----------------------------------------------------+\n| JSON_OVERLAPS(\'true\',\'[\"abc\", 1, 2, true, false]\') |\n+----------------------------------------------------+\n| 1 |\n+----------------------------------------------------+\n\nSELECT JSON_OVERLAPS(\'{\"A\": 1, \"B\": {\"C\":2}}\', \'{\"A\": 2, \"B\": {\"C\":2}}\') AS\nis_overlap;\n+---------------------+\n| is_overlap |\n+---------------------+\n| 1 |\n+---------------------+\n\nPartial match is considered as no-match.\n\nExamples\n--------\n\nSELECT JSON_OVERLAPS(\'[1, 2, true, false, null]\', \'[3, 4, [1]]\') AS is_overlap;\n+--------------------- +\n| is_overlap |\n+----------------------+\n| 0 |\n+----------------------+\n\nURL: https://mariadb.com/kb/en/json_overlaps/','','https://mariadb.com/kb/en/json_overlaps/');
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (767,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 (768,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 (769,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 (770,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 (771,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 (772,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 (773,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 (774,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 (775,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 (776,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 (777,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 (778,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 (779,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 (780,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 (781,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 (782,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 (783,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 (784,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 (785,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 (786,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 (787,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 (788,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 (789,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 (790,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 (791,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 (792,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 (793,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 = 793;
+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 = 793;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (794,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 (795,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 (796,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 (797,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 (798,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 (799,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 (800,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 (801,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 (802,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 (803,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 (804,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 (805,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 (806,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 (807,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 (808,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 (809,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 (810,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\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\nInserting Data\n--------------\n\nWhen data is inserted into a system-versioned table, it is given a row_start\nvalue of the current timestamp, and a row_end value of\nFROM_UNIXTIME(2147483647.999999). The current timestamp can be adjusted by\nsetting the timestamp system variable, for example:\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2022-10-24 23:09:38 |\n+---------------------+\n\nINSERT INTO t VALUES(1);\n\nSET @@timestamp = UNIX_TIMESTAMP(\'2033-10-24\');\n\nINSERT INTO t VALUES(2);\n\nSET @@timestamp = default;\n\nINSERT INTO t VALUES(3);\n\nSELECT a,row_start,row_end FROM t;\n+------+----------------------------+----------------------------+\n| a | row_start | row_end |\n+------+----------------------------+----------------------------+\n| 1 | 2022-10-24 23:09:38.951347 | 2038-01-19 05:14:07.999999 |\n| 2 | 2033-10-24 00:00:00.000000 | 2038-01-19 05:14:07.999999 |\n| 3 | 2022-10-24 23:09:38.961857 | 2038-01-19 05:14:07.999999 |\n+------+----------------------------+----------------------------+\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. This is usually the same as if one had specified FOR SYSTEM_TIME AS OF\nCURRENT_TIMESTAMP, unless one has adjusted the row_start value (until MariaDB\n10.11, only possible by setting the secure_timestamp variable). For example:\n\nCREATE OR REPLACE TABLE t (a int) WITH SYSTEM VERSIONING;\n\nSELECT NOW();\n+---------------------+\n| NOW() |\n+---------------------+\n| 2022-10-24 23:43:37 |\n+---------------------+\n\nINSERT INTO t VALUES (1);\n\nSET @@timestamp = UNIX_TIMESTAMP(\'2033-03-03\');\n\nINSERT INTO t VALUES (2);\n\nDELETE FROM t;\n\nSET @@timestamp = default;\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME ALL;\n+------+----------------------------+----------------------------+\n| a | row_start | row_end |\n+------+----------------------------+----------------------------+\n| 1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n| 2 | 2033-03-03 00:00:00.000000 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n2 rows in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP;\n+------+----------------------------+----------------------------+\n| a | row_start | row_end |\n+------+----------------------------+----------------------------+\n| 1 | 2022-10-24 23:43:37.192725 | 2033-03-03 00:00:00.000000 |\n+------+----------------------------+----------------------------+\n1 row in set (0.000 sec)\n\nSELECT a, row_start, row_end FROM t;\nEmpty set (0.001 sec)\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','','https://mariadb.com/kb/en/system-versioned-tables/');
+update help_topic set description = CONCAT(description, '\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\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\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\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* Before MariaDB 10.11, mariadb-dump did not read historical rows from\nversioned tables, and so historical data would not be backed up. Also, a\nrestore of the timestamps would not be possible as they cannot be defined by\nan insert/a user. From MariaDB 10.11, use the -H or --dump-history options to\ninclude the history.\n\nURL: https://mariadb.com/kb/en/system-versioned-tables/') WHERE help_topic_id = 810;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (811,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 (812,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 (813,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 (814,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 (815,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 (816,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 (817,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 (818,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 (819,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 (820,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 (821,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. The\neffective maximum length of the string depends on how many bytes are used per\ncharacter and can be up to 96 characters.\n\nDue to MDEV-29994, the password can be silently truncated to 41 characters\nwhen MariaDB is restarted. For this reason it is recommended to use a password\nthat is shorter than this.\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;','','https://mariadb.com/kb/en/change-master-to/');
+update help_topic set description = CONCAT(description, '\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\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') WHERE help_topic_id = 821;
+update help_topic set description = CONCAT(description, '\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\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 = 821;
+insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (822,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 (823,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 (824,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 (825,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 (826,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 (827,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 (828,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 (829,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');
@@ -1232,21 +1233,21 @@ insert into help_relation values (731, 4);
insert into help_relation values (739, 4);
insert into help_relation values (740, 88);
insert into help_relation values (741, 89);
-insert into help_relation values (815, 90);
-insert into help_relation values (815, 91);
-insert into help_relation values (816, 92);
-insert into help_relation values (816, 93);
-insert into help_relation values (817, 94);
-insert into help_relation values (817, 95);
-insert into help_relation values (818, 96);
-insert into help_relation values (818, 97);
-insert into help_relation values (819, 98);
-insert into help_relation values (819, 99);
-insert into help_relation values (820, 100);
-insert into help_relation values (821, 101);
-insert into help_relation values (822, 102);
-insert into help_relation values (823, 103);
-insert into help_relation values (823, 104);
-insert into help_relation values (827, 105);
-insert into help_relation values (827, 106);
+insert into help_relation values (816, 90);
+insert into help_relation values (816, 91);
+insert into help_relation values (817, 92);
+insert into help_relation values (817, 93);
+insert into help_relation values (818, 94);
+insert into help_relation values (818, 95);
+insert into help_relation values (819, 96);
+insert into help_relation values (819, 97);
+insert into help_relation values (820, 98);
+insert into help_relation values (820, 99);
+insert into help_relation values (821, 100);
+insert into help_relation values (822, 101);
+insert into help_relation values (823, 102);
+insert into help_relation values (824, 103);
+insert into help_relation values (824, 104);
+insert into help_relation values (828, 105);
+insert into help_relation values (828, 106);
unlock tables;
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index dfbe568ac0b..8ed62f0ae45 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -22,6 +22,7 @@ IF(WITH_WSREP AND NOT EMBEDDED_LIBRARY)
wsrep_server_service.cc
wsrep_storage_service.cc
wsrep_server_state.cc
+ wsrep_status.cc
wsrep_utils.cc
wsrep_xid.cc
wsrep_check_opts.cc
@@ -161,6 +162,7 @@ SET (SQL_SOURCE
semisync.cc semisync_master.cc semisync_slave.cc
semisync_master_ack_receiver.cc
sql_schema.cc
+ lex_charset.cc
sql_type.cc sql_mode.cc sql_type_json.cc
sql_type_string.cc
sql_type_geom.cc
diff --git a/sql/field.cc b/sql/field.cc
index 65b04135af6..e7719264ffd 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -10460,17 +10460,15 @@ bool Column_definition::prepare_interval_field(MEM_ROOT *mem_root,
bool Column_definition::set_attributes(THD *thd,
const Lex_field_type_st &def,
- CHARSET_INFO *cs,
column_definition_type_t type)
{
DBUG_ASSERT(type_handler() == &type_handler_null);
- DBUG_ASSERT(charset == &my_charset_bin || charset == NULL);
DBUG_ASSERT(length == 0);
DBUG_ASSERT(decimals == 0);
set_handler(def.type_handler());
return type_handler()->Column_definition_set_attributes(thd, this,
- def, cs, type);
+ def, type);
}
@@ -10478,16 +10476,12 @@ void
Column_definition_attributes::set_length_and_dec(const Lex_length_and_dec_st
&type)
{
- if (type.length())
- {
- int err;
- length= my_strtoll10(type.length(), NULL, &err);
- if (err)
- length= ~0ULL; // safety
- }
+ if (type.has_explicit_length())
+ length= type.length_overflowed() ? (ulonglong) UINT_MAX32 + 1 :
+ (ulonglong) type.length();
- if (type.dec())
- decimals= (uint) atoi(type.dec());
+ if (type.has_explicit_dec())
+ decimals= type.dec();
}
@@ -10586,7 +10580,7 @@ bool Column_definition::fix_attributes_real(uint default_length)
}
if (decimals != NOT_FIXED_DEC && decimals >= FLOATING_POINT_DECIMALS)
{
- my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals),
+ my_error(ER_TOO_BIG_SCALE, MYF(0),
field_name.str, static_cast<uint>(FLOATING_POINT_DECIMALS-1));
return true;
}
@@ -10598,14 +10592,14 @@ bool Column_definition::fix_attributes_decimal()
{
if (decimals >= NOT_FIXED_DEC)
{
- my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals),
+ my_error(ER_TOO_BIG_SCALE, MYF(0),
field_name.str, static_cast<uint>(NOT_FIXED_DEC - 1));
return true;
}
my_decimal_trim(&length, &decimals);
if (length > DECIMAL_MAX_PRECISION)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), length, field_name.str,
+ my_error(ER_TOO_BIG_PRECISION, MYF(0), field_name.str,
DECIMAL_MAX_PRECISION);
return true;
}
@@ -10634,7 +10628,7 @@ bool Column_definition::fix_attributes_temporal_with_time(uint int_part_length)
{
if (length > MAX_DATETIME_PRECISION)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), length, field_name.str,
+ my_error(ER_TOO_BIG_PRECISION, MYF(0), field_name.str,
MAX_DATETIME_PRECISION);
return true;
}
diff --git a/sql/field.h b/sql/field.h
index c14a1fc4e7f..642456b9774 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -5303,7 +5303,6 @@ public:
Column_definition(THD *thd, Field *field, Field *orig_field);
bool set_attributes(THD *thd,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type);
void create_length_to_internal_length_null()
{
@@ -5378,7 +5377,7 @@ public:
bool sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root);
bool prepare_stage1(THD *thd, MEM_ROOT *mem_root,
- handler *file, ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes *derived_attr);
void prepare_stage1_simple(CHARSET_INFO *cs)
{
@@ -5386,11 +5385,9 @@ public:
create_length_to_internal_length_simple();
}
bool prepare_stage1_typelib(THD *thd, MEM_ROOT *mem_root,
- handler *file, ulonglong table_flags);
- bool prepare_stage1_string(THD *thd, MEM_ROOT *mem_root,
- handler *file, ulonglong table_flags);
- bool prepare_stage1_bit(THD *thd, MEM_ROOT *mem_root,
- handler *file, ulonglong table_flags);
+ column_definition_type_t deftype);
+ bool prepare_stage1_string(THD *thd, MEM_ROOT *mem_root);
+ bool prepare_stage1_bit(THD *thd, MEM_ROOT *mem_root);
bool bulk_alter(const Column_derived_attributes *derived_attr,
const Column_bulk_alter_attributes *bulk_attr)
@@ -5497,6 +5494,24 @@ public:
{ return compression_method_ptr; }
bool check_vcol_for_key(THD *thd) const;
+
+ void set_charset_collation_attrs(const
+ Lex_column_charset_collation_attrs_st &lc)
+ {
+ charset= lc.charset_info();
+ if (lc.is_contextually_typed_collation())
+ flags|= CONTEXT_COLLATION_FLAG;
+ else
+ flags&= ~CONTEXT_COLLATION_FLAG;
+ }
+ Lex_column_charset_collation_attrs charset_collation_attrs() const
+ {
+ if (!charset)
+ return Lex_column_charset_collation_attrs();
+ if (flags & CONTEXT_COLLATION_FLAG)
+ return Lex_column_charset_collation_attrs(Lex_context_collation(charset));
+ return Lex_column_charset_collation_attrs(Lex_exact_collation(charset));
+ }
};
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index acdadb61df5..c5c683b6666 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4212,13 +4212,9 @@ int ha_partition::external_lock(THD *thd, int lock_type)
(void) (*file)->ha_external_lock(thd, lock_type);
} while (*(++file));
}
- if (lock_type == F_WRLCK)
- {
- if (m_part_info->part_expr)
- m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
- if ((error= m_part_info->vers_set_hist_part(thd)))
- goto err_handler;
- }
+ if (lock_type == F_WRLCK && m_part_info->part_expr)
+ m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
+
DBUG_RETURN(0);
err_handler:
@@ -4362,7 +4358,6 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type)
{
if (m_part_info->part_expr)
m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0);
- error= m_part_info->vers_set_hist_part(thd);
}
DBUG_RETURN(error);
}
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index f95fcb88989..cfa281da4ef 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1619,6 +1619,10 @@ public:
}
bool partition_engine() override { return 1;}
+
+ /**
+ Get the number of records in part_elem and its subpartitions, if any.
+ */
ha_rows part_records(partition_element *part_elem)
{
DBUG_ASSERT(m_part_info);
diff --git a/sql/handler.cc b/sql/handler.cc
index 3081d4b0d3c..a12e9ea18f5 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1668,9 +1668,10 @@ int ha_commit_trans(THD *thd, bool all)
DBUG_ASSERT(thd->transaction->stmt.ha_list == NULL ||
trans == &thd->transaction->stmt);
+ DBUG_ASSERT(!thd->in_sub_stmt);
+
if (thd->in_sub_stmt)
{
- DBUG_ASSERT(0);
/*
Since we don't support nested statement transactions in 5.0,
we can't commit or rollback stmt transactions while we are inside
@@ -5867,7 +5868,8 @@ int handler::calculate_checksum()
continue;
- if (! thd->variables.old_mode && f->is_real_null(0))
+ if (! (thd->variables.old_behavior & OLD_MODE_COMPAT_5_1_CHECKSUM) &&
+ f->is_real_null(0))
{
flush_checksum(&row_crc, &checksum_start, &checksum_length);
continue;
@@ -8001,24 +8003,6 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal)
#endif /* WITH_WSREP */
-bool HA_CREATE_INFO::check_conflicting_charset_declarations(CHARSET_INFO *cs)
-{
- if ((used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
- /* DEFAULT vs explicit, or explicit vs DEFAULT */
- (((default_table_charset == NULL) != (cs == NULL)) ||
- /* Two different explicit character sets */
- (default_table_charset && cs &&
- !my_charset_same(default_table_charset, cs))))
- {
- my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
- "CHARACTER SET ", default_table_charset ?
- default_table_charset->cs_name.str : "DEFAULT",
- "CHARACTER SET ", cs ? cs->cs_name.str : "DEFAULT");
- return true;
- }
- return false;
-}
-
/* Remove all indexes for a given table from global index statistics */
static
diff --git a/sql/handler.h b/sql/handler.h
index 36f66b78de0..523c8472784 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -841,6 +841,8 @@ typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*);
#define ALTER_PARTITION_TABLE_REORG (1ULL << 12)
#define ALTER_PARTITION_CONVERT_IN (1ULL << 13)
#define ALTER_PARTITION_CONVERT_OUT (1ULL << 14)
+// Set for vers_add_auto_hist_parts() operation
+#define ALTER_PARTITION_AUTO_HIST (1ULL << 15)
/*
This is master database for most of system tables. However there
@@ -1032,7 +1034,10 @@ enum enum_schema_tables
SCH_ENABLED_ROLES,
SCH_ENGINES,
SCH_EVENTS,
- SCH_EXPLAIN,
+ SCH_EXPLAIN_TABULAR,
+ SCH_EXPLAIN_JSON,
+ SCH_ANALYZE_TABULAR,
+ SCH_ANALYZE_JSON,
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
@@ -2097,7 +2102,6 @@ struct Vers_parse_info: public Table_period_info
Table_period_info::start_end_t as_row;
-protected:
friend struct Table_scope_and_contents_source_st;
void set_start(const LEX_CSTRING field_name)
{
@@ -2109,6 +2113,8 @@ protected:
as_row.end= field_name;
period.end= field_name;
}
+
+protected:
bool is_start(const char *name) const;
bool is_end(const char *name) const;
bool is_start(const Create_field &f) const;
@@ -2288,33 +2294,6 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
Schema_specification_st::init();
alter_info= NULL;
}
- bool check_conflicting_charset_declarations(CHARSET_INFO *cs);
- bool add_table_option_default_charset(CHARSET_INFO *cs)
- {
- // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
- if (check_conflicting_charset_declarations(cs))
- return true;
- default_table_charset= cs;
- used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
- return false;
- }
- bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs)
- {
- /*
- cs cannot be NULL, as sql_yacc.yy translates
- CONVERT TO CHARACTER SET DEFAULT
- to
- CONVERT TO CHARACTER SET <character-set-of-the-current-database>
- TODO: Shouldn't we postpone resolution of DEFAULT until the
- character set of the table owner database is loaded from its db.opt?
- */
- DBUG_ASSERT(cs);
- if (check_conflicting_charset_declarations(cs))
- return true;
- alter_table_convert_to_charset= default_table_charset= cs;
- used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
- return false;
- }
ulong table_options_with_row_type()
{
if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
@@ -2322,6 +2301,10 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
else
return table_options;
}
+ bool resolve_to_charset_collation_context(THD *thd,
+ const Lex_table_charset_collation_attrs_st &default_cscl,
+ const Lex_table_charset_collation_attrs_st &convert_cscl,
+ const Charset_collation_context &ctx);
};
@@ -2332,16 +2315,23 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
struct Table_specification_st: public HA_CREATE_INFO,
public DDL_options_st
{
+ Lex_table_charset_collation_attrs_st default_charset_collation;
+ Lex_table_charset_collation_attrs_st convert_charset_collation;
+
// Deep initialization
void init()
{
HA_CREATE_INFO::init();
DDL_options_st::init();
+ default_charset_collation.init();
+ convert_charset_collation.init();
}
void init(DDL_options_st::Options options_arg)
{
HA_CREATE_INFO::init();
DDL_options_st::init(options_arg);
+ default_charset_collation.init();
+ convert_charset_collation.init();
}
/*
Quick initialization, for parser.
@@ -2353,6 +2343,46 @@ struct Table_specification_st: public HA_CREATE_INFO,
{
HA_CREATE_INFO::options= 0;
DDL_options_st::init();
+ default_charset_collation.init();
+ convert_charset_collation.init();
+ }
+
+ bool add_table_option_convert_charset(CHARSET_INFO *cs)
+ {
+ // cs can be NULL, e.g.: ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT;
+ used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
+ return cs ?
+ convert_charset_collation.merge_exact_charset(Lex_exact_charset(cs)) :
+ convert_charset_collation.merge_charset_default();
+ }
+ bool add_table_option_convert_collation(const Lex_extended_collation_st &cl)
+ {
+ used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
+ return convert_charset_collation.merge_collation(cl);
+ }
+
+ bool add_table_option_default_charset(CHARSET_INFO *cs)
+ {
+ // cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
+ used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
+ return cs ?
+ default_charset_collation.merge_exact_charset(Lex_exact_charset(cs)) :
+ default_charset_collation.merge_charset_default();
+ }
+ bool add_table_option_default_collation(const Lex_extended_collation_st &cl)
+ {
+ used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
+ return default_charset_collation.merge_collation(cl);
+ }
+
+ bool resolve_to_charset_collation_context(THD *thd,
+ const Charset_collation_context &ctx)
+ {
+ return HA_CREATE_INFO::
+ resolve_to_charset_collation_context(thd,
+ default_charset_collation,
+ convert_charset_collation,
+ ctx);
}
};
@@ -4214,6 +4244,8 @@ public:
*/
virtual uint lock_count(void) const { return 1; }
/**
+ Get the lock(s) for the table and perform conversion of locks if needed.
+
Is not invoked for non-transactional temporary tables.
@note store_lock() can return more than one lock if the table is MERGE
diff --git a/sql/item.cc b/sql/item.cc
index 764c7a3f530..e1a1dff3dde 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3067,8 +3067,7 @@ Item_field::Item_field(THD *thd, Name_resolution_context *context_arg,
Field *f)
:Item_ident(thd, context_arg, f->table->s->db,
Lex_cstring_strlen(*f->table_name), f->field_name),
- item_equal(0),
- have_privileges(NO_ACL), any_privileges(0)
+ item_equal(0), have_privileges(NO_ACL), any_privileges(0)
{
/*
We always need to provide Item_field with a fully qualified field
@@ -3141,7 +3140,7 @@ void Item_field::set_field(Field *field_par)
{
field=result_field=field_par; // for easy coding with fields
set_maybe_null(field->maybe_null());
- Type_std_attributes::set(field_par->type_std_attributes());
+ Type_std_attributes::set(field_par->type_std_attributes());
table_name= Lex_cstring_strlen(*field_par->table_name);
field_name= field_par->field_name;
db_name= field_par->table->s->db;
@@ -3150,6 +3149,10 @@ void Item_field::set_field(Field *field_par)
base_flags|= item_base_t::FIXED;
if (field->table->s->tmp_table == SYSTEM_TMP_TABLE)
any_privileges= 0;
+
+ if (field->table->s->tmp_table == SYSTEM_TMP_TABLE ||
+ field->table->s->tmp_table == INTERNAL_TMP_TABLE)
+ set_refers_to_temp_table(true);
}
@@ -3622,9 +3625,12 @@ void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref,
Item *Item_field::get_tmp_table_item(THD *thd)
{
- Item_field *new_item= new (thd->mem_root) Item_temptable_field(thd, this);
+ Item_field *new_item= new (thd->mem_root) Item_field(thd, this);
if (new_item)
+ {
new_item->field= new_item->result_field;
+ new_item->set_refers_to_temp_table(true);
+ }
return new_item;
}
@@ -3634,6 +3640,11 @@ longlong Item_field::val_int_endpoint(bool left_endp, bool *incl_endp)
return null_value? LONGLONG_MIN : res;
}
+void Item_field::set_refers_to_temp_table(bool value)
+{
+ refers_to_temp_table= value;
+}
+
bool Item_basic_value::eq(const Item *item, bool binary_cmp) const
{
@@ -6294,6 +6305,7 @@ void Item_field::cleanup()
field= 0;
item_equal= NULL;
null_value= FALSE;
+ refers_to_temp_table= FALSE;
DBUG_VOID_RETURN;
}
@@ -7859,21 +7871,24 @@ Item_direct_view_ref::grouping_field_transformer_for_where(THD *thd,
void Item_field::print(String *str, enum_query_type query_type)
{
- if (field && field->table->const_table &&
+ /*
+ If the field refers to a constant table, print the value.
+ (1): But don't attempt to do that if
+ * the field refers to a temporary (work) table, and
+ * temp. tables might already have been dropped.
+ */
+ if (!(refers_to_temp_table && // (1)
+ (query_type & QT_DONT_ACCESS_TMP_TABLES)) && // (1)
+ field && field->table->const_table &&
!(query_type & (QT_NO_DATA_EXPANSION | QT_VIEW_INTERNAL)))
{
print_value(str);
return;
}
- Item_ident::print(str, query_type);
-}
-
-
-void Item_temptable_field::print(String *str, enum_query_type query_type)
-{
/*
Item_ident doesn't have references to the underlying Field/TABLE objects,
- so it's ok to use the following:
+ so it's safe to make the following call even when the table is not
+ available already:
*/
Item_ident::print(str, query_type);
}
@@ -9140,7 +9155,12 @@ int Item_cache_wrapper::save_in_field(Field *to, bool no_conversions)
Item* Item_cache_wrapper::get_tmp_table_item(THD *thd)
{
if (!orig_item->with_sum_func() && !orig_item->const_item())
- return new (thd->mem_root) Item_temptable_field(thd, result_field);
+ {
+ auto item_field= new (thd->mem_root) Item_field(thd, result_field);
+ if (item_field)
+ item_field->set_refers_to_temp_table(true);
+ return item_field;
+ }
return copy_or_same(thd);
}
diff --git a/sql/item.h b/sql/item.h
index 07a3d476699..f31811bef18 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3580,6 +3580,32 @@ public:
privilege_t have_privileges;
/* field need any privileges (for VIEW creation) */
bool any_privileges;
+
+private:
+ /*
+ Setting this member to TRUE (via set_refers_to_temp_table())
+ ensures print() function continues to work even if the table
+ has been dropped.
+
+ We need this for "ANALYZE statement" feature. Query execution has
+ these steps:
+ 1. Run the query.
+ 2. Cleanup starts. Temporary tables are destroyed
+ 3. print "ANALYZE statement" output, if needed
+ 4. Call close_thread_table() for regular tables.
+
+ Step #4 is done after step #3, so "ANALYZE stmt" has no problem printing
+ Item_field objects that refer to regular tables.
+
+ However, Step #3 is done after Step #2. Attempt to print Item_field objects
+ that refer to temporary tables will cause access to freed memory.
+
+ To resolve this, we use refers_to_temp_table member to refer to items
+ in temporary (work) tables.
+ */
+ bool refers_to_temp_table= false;
+
+public:
Item_field(THD *thd, Name_resolution_context *context_arg,
const LEX_CSTRING &db_arg, const LEX_CSTRING &table_name_arg,
const LEX_CSTRING &field_name_arg);
@@ -3811,6 +3837,7 @@ public:
return field->table->pos_in_table_list->outer_join;
}
bool check_index_dependence(void *arg) override;
+ void set_refers_to_temp_table(bool value);
friend class Item_default_value;
friend class Item_insert_value;
friend class st_select_lex_unit;
@@ -3849,46 +3876,6 @@ public:
};
-/*
- @brief
- Item_temptable_field is the same as Item_field, except that print()
- continues to work even if the table has been dropped.
-
- @detail
-
- We need this item for "ANALYZE statement" feature. Query execution has
- these steps:
-
- 1. Run the query.
- 2. Cleanup starts. Temporary tables are destroyed
- 3. print "ANALYZE statement" output, if needed
- 4. Call close_thread_table() for regular tables.
-
- Step #4 is done after step #3, so "ANALYZE stmt" has no problem printing
- Item_field objects that refer to regular tables.
-
- However, Step #3 is done after Step #2. Attempt to print Item_field objects
- that refer to temporary tables will cause access to freed memory.
-
- To resolve this, we use Item_temptable_field to refer to items in temporary
- (work) tables.
-*/
-
-class Item_temptable_field :public Item_field
-{
-public:
- Item_temptable_field(THD *thd, Name_resolution_context *context_arg, Field *field)
- : Item_field(thd, context_arg, field) {}
-
- Item_temptable_field(THD *thd, Field *field)
- : Item_field(thd, field) {}
-
- Item_temptable_field(THD *thd, Item_field *item) : Item_field(thd, item) {};
-
- void print(String *str, enum_query_type query_type) override;
-};
-
-
class Item_null :public Item_basic_constant
{
public:
@@ -5522,7 +5509,7 @@ public:
inline const char *func_name() const
{ return (char*) func_name_cstring().str; }
virtual LEX_CSTRING func_name_cstring() const= 0;
- virtual bool fix_length_and_dec()= 0;
+ virtual bool fix_length_and_dec(THD *thd)= 0;
bool const_item() const override { return const_item_cache; }
table_map used_tables() const override { return used_tables_cache; }
Item* build_clone(THD *thd) override;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 79c6eed930d..b8b02093278 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -448,7 +448,7 @@ Item_bool_rowready_func2::value_depends_on_sql_mode() const
}
-bool Item_bool_rowready_func2::fix_length_and_dec()
+bool Item_bool_rowready_func2::fix_length_and_dec(THD *thd)
{
max_length= 1; // Function returns 0 or 1
@@ -1151,7 +1151,7 @@ int Arg_comparator::compare_e_str_json()
}
-bool Item_func_truth::fix_length_and_dec()
+bool Item_func_truth::fix_length_and_dec(THD *thd)
{
base_flags&= ~item_base_t::MAYBE_NULL;
null_value= 0;
@@ -1784,9 +1784,9 @@ longlong Item_func_eq::val_int()
/** Same as Item_func_eq, but NULL = NULL. */
-bool Item_func_equal::fix_length_and_dec()
+bool Item_func_equal::fix_length_and_dec(THD *thd)
{
- bool rc= Item_bool_rowready_func2::fix_length_and_dec();
+ bool rc= Item_bool_rowready_func2::fix_length_and_dec(thd);
base_flags&= ~item_base_t::MAYBE_NULL;
null_value=0;
return rc;
@@ -1883,7 +1883,7 @@ bool Item_func_interval::fix_fields(THD *thd, Item **ref)
}
-bool Item_func_interval::fix_length_and_dec()
+bool Item_func_interval::fix_length_and_dec(THD *thd)
{
uint rows= row->cols();
@@ -2117,7 +2117,7 @@ void Item_func_between::fix_after_pullout(st_select_lex *new_parent,
eval_not_null_tables(NULL);
}
-bool Item_func_between::fix_length_and_dec()
+bool Item_func_between::fix_length_and_dec(THD *thd)
{
max_length= 1;
@@ -2131,7 +2131,7 @@ bool Item_func_between::fix_length_and_dec()
func_name_cstring(),
args, 3, false))
{
- DBUG_ASSERT(current_thd->is_error());
+ DBUG_ASSERT(thd->is_error());
return TRUE;
}
@@ -2573,7 +2573,7 @@ void Item_func_nullif::update_used_tables()
bool
-Item_func_nullif::fix_length_and_dec()
+Item_func_nullif::fix_length_and_dec(THD *thd)
{
/*
If this is the first invocation of fix_length_and_dec(), create the
@@ -2585,7 +2585,6 @@ Item_func_nullif::fix_length_and_dec()
if (arg_count == 2)
args[arg_count++]= m_arg0 ? m_arg0 : args[0];
- THD *thd= current_thd;
/*
At prepared statement EXECUTE time, args[0] can already
point to a different Item, created during PREPARE time fix_length_and_dec().
@@ -3195,24 +3194,21 @@ bool Item_func_case_simple::prepare_predicant_and_values(THD *thd,
}
-bool Item_func_case_searched::fix_length_and_dec()
+bool Item_func_case_searched::fix_length_and_dec(THD *thd)
{
- THD *thd= current_thd;
return aggregate_then_and_else_arguments(thd, when_count());
}
-bool Item_func_case_simple::fix_length_and_dec()
+bool Item_func_case_simple::fix_length_and_dec(THD *thd)
{
- THD *thd= current_thd;
return (aggregate_then_and_else_arguments(thd, when_count() + 1) ||
aggregate_switch_and_when_arguments(thd, false));
}
-bool Item_func_decode_oracle::fix_length_and_dec()
+bool Item_func_decode_oracle::fix_length_and_dec(THD *thd)
{
- THD *thd= current_thd;
return (aggregate_then_and_else_arguments(thd, when_count() + 1) ||
aggregate_switch_and_when_arguments(thd, true));
}
@@ -4462,9 +4458,8 @@ bool Item_func_in::prepare_predicant_and_values(THD *thd, uint *found_types)
}
-bool Item_func_in::fix_length_and_dec()
+bool Item_func_in::fix_length_and_dec(THD *thd)
{
- THD *thd= current_thd;
uint found_types;
m_comparator.set_handler(type_handler_varchar.type_handler_for_comparison());
max_length= 1;
@@ -4820,7 +4815,7 @@ public:
};
-bool Item_func_bit_or::fix_length_and_dec()
+bool Item_func_bit_or::fix_length_and_dec(THD *thd)
{
static Func_handler_bit_or_int_to_ulonglong ha_int_to_ull;
static Func_handler_bit_or_dec_to_ulonglong ha_dec_to_ull;
@@ -4855,7 +4850,7 @@ public:
};
-bool Item_func_bit_and::fix_length_and_dec()
+bool Item_func_bit_and::fix_length_and_dec(THD *thd)
{
static Func_handler_bit_and_int_to_ulonglong ha_int_to_ull;
static Func_handler_bit_and_dec_to_ulonglong ha_dec_to_ull;
@@ -4988,7 +4983,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
base_flags|= item->base_flags & item_base_t::MAYBE_NULL;
with_flags|= item->with_flags;
}
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
return TRUE;
base_flags|= item_base_t::FIXED;
return FALSE;
@@ -6205,9 +6200,9 @@ void Regexp_processor_pcre::fix_owner(Item_func *owner,
bool
-Item_func_regex::fix_length_and_dec()
+Item_func_regex::fix_length_and_dec(THD *thd)
{
- if (Item_bool_func::fix_length_and_dec() ||
+ if (Item_bool_func::fix_length_and_dec(thd) ||
agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE;
@@ -6231,7 +6226,7 @@ longlong Item_func_regex::val_int()
bool
-Item_func_regexp_instr::fix_length_and_dec()
+Item_func_regexp_instr::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE;
@@ -7174,7 +7169,7 @@ bool Item_equal::fix_fields(THD *thd, Item **ref)
}
if (prev_equal_field && last_equal_field != first_equal_field)
last_equal_field->next_equal_field= first_equal_field;
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
return TRUE;
base_flags|= item_base_t::FIXED;
return FALSE;
@@ -7303,11 +7298,11 @@ longlong Item_equal::val_int()
}
-bool Item_equal::fix_length_and_dec()
+bool Item_equal::fix_length_and_dec(THD *thd)
{
Item *item= get_first(NO_PARTICULAR_TAB, NULL);
const Type_handler *handler= item->type_handler();
- eval_item= handler->make_cmp_item(current_thd, item->collation.collation);
+ eval_item= handler->make_cmp_item(thd, item->collation.collation);
return eval_item == NULL;
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index c0cbcdcc081..99656e910ba 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -227,7 +227,7 @@ public:
const Type_handler *fixed_type_handler() const override
{ return &type_handler_bool; }
CHARSET_INFO *compare_collation() const override { return NULL; }
- bool fix_length_and_dec() override { decimals=0; max_length=1; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=1; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
bool need_parentheses_in_default() override { return true; }
};
@@ -243,7 +243,7 @@ class Item_func_truth : public Item_bool_func
public:
bool val_bool() override;
longlong val_int() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return CMP_PRECEDENCE; }
@@ -559,7 +559,7 @@ public:
cond);
return this;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
int set_cmp_func(THD *thd)
{
return cmp.set_cmp_func(thd, this, tmp_arg, tmp_arg + 1, true);
@@ -795,7 +795,7 @@ public:
Item_func_equal(THD *thd, Item *a, Item *b):
Item_bool_rowready_func2(thd, a, b) {}
longlong val_int() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
table_map not_null_tables() const override { return 0; }
bool find_not_null_fields(table_map allowed) override { return false; }
enum Functype functype() const override { return EQUAL_FUNC; }
@@ -990,7 +990,7 @@ public:
return name;
}
enum precedence precedence() const override { return BETWEEN_PRECEDENCE; }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool fix_length_and_dec_string(THD *)
{
return agg_arg_charsets_for_comparison(cmp_collation, args, 3);
@@ -1046,7 +1046,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("strcmp") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE;
@@ -1080,7 +1080,7 @@ public:
{ }
bool fix_fields(THD *, Item **) override;
longlong val_int() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("interval") };
@@ -1111,7 +1111,7 @@ public:
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool time_op(THD *thd, MYSQL_TIME *ltime) override;
bool native_op(THD *thd, Native *to) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
if (aggregate_for_result(func_name_cstring(), args, arg_count, true))
return TRUE;
@@ -1195,7 +1195,7 @@ public:
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool time_op(THD *thd, MYSQL_TIME *ltime) override;
bool native_op(THD *thd, Native *to) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
/*
Set nullability from args[1] by default.
@@ -1286,7 +1286,7 @@ public:
Item_func_case_abbreviation2_switch(thd, a, b, c)
{}
bool fix_fields(THD *, Item **) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return fix_length_and_dec2_eliminate_null(args + 1);
}
@@ -1320,7 +1320,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("nvl2") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return fix_length_and_dec2_eliminate_null(args + 1);
}
@@ -1383,7 +1383,7 @@ public:
String *str_op(String *str) override;
my_decimal *decimal_op(my_decimal *) override;
bool native_op(THD *thd, Native *to) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool walk(Item_processor processor, bool walk_subquery, void *arg) override;
LEX_CSTRING func_name_cstring() const override
{
@@ -2343,7 +2343,7 @@ public:
}
enum Functype functype() const override { return CASE_SEARCHED_FUNC; }
void print(String *str, enum_query_type query_type) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
override
{
@@ -2398,7 +2398,7 @@ public:
}
enum Functype functype() const override { return CASE_SIMPLE_FUNC; }
void print(String *str, enum_query_type query_type) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
override;
Item *find_item() override;
@@ -2428,7 +2428,7 @@ public:
return name;
}
void print(String *str, enum_query_type query_type) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *find_item() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_decode_oracle>(thd, this); }
@@ -2518,7 +2518,7 @@ public:
{ }
longlong val_int() override;
bool fix_fields(THD *, Item **) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool compatible_types_scalar_bisection_possible()
{
DBUG_ASSERT(m_comparator.cmp_type() != ROW_RESULT);
@@ -2695,7 +2695,7 @@ public:
}
CHARSET_INFO *compare_collation() const override
{ return args[0]->collation.collation; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=1;
@@ -2944,7 +2944,7 @@ public:
}
enum precedence precedence() const override { return IN_PRECEDENCE; }
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= 1;
return agg_arg_charsets_for_comparison(cmp_collation, args, 2);
@@ -3056,7 +3056,7 @@ public:
DBUG_VOID_RETURN;
}
longlong val_int() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("regexp") };
@@ -3101,7 +3101,7 @@ public:
DBUG_VOID_RETURN;
}
longlong val_int() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_instr") };
@@ -3370,7 +3370,7 @@ public:
return name;
}
void sort(Item_field_cmpfunc compare, void *arg);
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool fix_fields(THD *thd, Item **ref) override;
void cleanup() override
{
@@ -3473,7 +3473,7 @@ protected:
Item_equal *item_equal;
Item *curr_item;
public:
- Item_equal_iterator<LI,T>(Item_equal &item_eq)
+ Item_equal_iterator(Item_equal &item_eq)
:LI<T> (item_eq.equal_items)
{
curr_item= NULL;
diff --git a/sql/item_create.cc b/sql/item_create.cc
index a8ca7d5cff8..5d28cfca111 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -1327,6 +1327,19 @@ protected:
};
+class Create_func_json_overlaps: public Create_func_arg2
+{
+public:
+ virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2);
+
+ static Create_func_json_overlaps s_singleton;
+
+protected:
+ Create_func_json_overlaps() {}
+ virtual ~Create_func_json_overlaps() {}
+};
+
+
class Create_func_last_day : public Create_func_arg1
{
public:
@@ -4319,6 +4332,16 @@ Create_func_json_search::create_native(THD *thd, const LEX_CSTRING *name,
}
+Create_func_json_overlaps Create_func_json_overlaps::s_singleton;
+
+Item*
+Create_func_json_overlaps::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_overlaps(thd, arg1, arg2);
+}
+
+
Create_func_last_insert_id Create_func_last_insert_id::s_singleton;
Item*
@@ -5752,6 +5775,7 @@ Native_func_registry func_array[] =
{ { 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)},
+ { { STRING_WITH_LEN("JSON_OVERLAPS") }, BUILDER(Create_func_json_overlaps)},
{ { STRING_WITH_LEN("JSON_REMOVE") }, BUILDER(Create_func_json_remove)},
{ { STRING_WITH_LEN("JSON_REPLACE") }, BUILDER(Create_func_json_replace)},
{ { STRING_WITH_LEN("JSON_SET") }, BUILDER(Create_func_json_set)},
@@ -6080,7 +6104,7 @@ Item *create_func_dyncol_delete(THD *thd, Item *str, List<Item> &nums)
Item *create_func_dyncol_get(THD *thd, Item *str, Item *num,
const Type_handler *handler,
- const char *c_len, const char *c_dec,
+ const Lex_length_and_dec_st &length_dec,
CHARSET_INFO *cs)
{
Item *res;
@@ -6088,5 +6112,5 @@ Item *create_func_dyncol_get(THD *thd, Item *str, Item *num,
if (likely(!(res= new (thd->mem_root) Item_dyncol_get(thd, str, num))))
return res; // Return NULL
return handler->create_typecast_item(thd, res,
- Type_cast_attributes(c_len, c_dec, cs));
+ Type_cast_attributes(length_dec, cs));
}
diff --git a/sql/item_create.h b/sql/item_create.h
index 90546ddc5b7..7c248e81711 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -319,7 +319,7 @@ Item *create_func_dyncol_add(THD *thd, Item *str,
Item *create_func_dyncol_delete(THD *thd, Item *str, List<Item> &nums);
Item *create_func_dyncol_get(THD *thd, Item *num, Item *str,
const Type_handler *handler,
- const char *c_len, const char *c_dec,
+ const Lex_length_and_dec_st &length_and_dec,
CHARSET_INFO *cs);
Item *create_func_dyncol_json(THD *thd, Item *str);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 0f7b26a678d..6c0c785e901 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -359,7 +359,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
}
if (check_arguments())
return true;
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
return TRUE;
base_flags|= item_base_t::FIXED;
return FALSE;
@@ -737,7 +737,12 @@ void Item_func::signal_divide_by_null()
Item *Item_func::get_tmp_table_item(THD *thd)
{
if (!with_sum_func() && !const_item())
- return new (thd->mem_root) Item_temptable_field(thd, result_field);
+ {
+ auto item_field= new (thd->mem_root) Item_field(thd, result_field);
+ if (item_field)
+ item_field->set_refers_to_temp_table(true);
+ return item_field;
+ }
return copy_or_same(thd);
}
@@ -760,9 +765,9 @@ String *Item_int_func::val_str(String *str)
}
-bool Item_func_connection_id::fix_length_and_dec()
+bool Item_func_connection_id::fix_length_and_dec(THD *thd)
{
- if (Item_long_func::fix_length_and_dec())
+ if (Item_long_func::fix_length_and_dec(thd))
return TRUE;
max_length= 10;
return FALSE;
@@ -792,7 +797,7 @@ bool Item_num_op::fix_type_handler(const Type_aggregator *aggregator)
}
-bool Item_func_plus::fix_length_and_dec(void)
+bool Item_func_plus::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_plus::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -1232,7 +1237,7 @@ void Item_func_minus::fix_unsigned_flag()
}
-bool Item_func_minus::fix_length_and_dec()
+bool Item_func_minus::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_minus::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -1475,7 +1480,7 @@ void Item_func_mul::result_precision()
}
-bool Item_func_mul::fix_length_and_dec(void)
+bool Item_func_mul::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_mul::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -1576,11 +1581,11 @@ void Item_func_div::fix_length_and_dec_int(void)
}
-bool Item_func_div::fix_length_and_dec()
+bool Item_func_div::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_div::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
- prec_increment= current_thd->variables.div_precincrement;
+ prec_increment= thd->variables.div_precincrement;
set_maybe_null(); // division by zero
const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_div;
@@ -1654,7 +1659,7 @@ longlong Item_func_int_div::val_int()
}
-bool Item_func_int_div::fix_length_and_dec()
+bool Item_func_int_div::fix_length_and_dec(THD *thd)
{
uint32 prec= args[0]->decimal_int_part();
set_if_smaller(prec, MY_INT64_NUM_DECIMAL_DIGITS);
@@ -1735,7 +1740,7 @@ void Item_func_mod::result_precision()
}
-bool Item_func_mod::fix_length_and_dec()
+bool Item_func_mod::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_mod::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -1801,7 +1806,7 @@ longlong Item_func_hash::val_int()
}
-bool Item_func_hash::fix_length_and_dec()
+bool Item_func_hash::fix_length_and_dec(THD *thd)
{
decimals= 0;
max_length= 8;
@@ -1904,7 +1909,7 @@ void Item_func_neg::fix_length_and_dec_decimal()
}
-bool Item_func_neg::fix_length_and_dec()
+bool Item_func_neg::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_neg::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -1977,7 +1982,7 @@ void Item_func_abs::fix_length_and_dec_decimal()
}
-bool Item_func_abs::fix_length_and_dec()
+bool Item_func_abs::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_abs::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -2200,7 +2205,7 @@ public:
};
-bool Item_func_shift_left::fix_length_and_dec()
+bool Item_func_shift_left::fix_length_and_dec(THD *thd)
{
static Func_handler_shift_left_int_to_ulonglong ha_int_to_ull;
static Func_handler_shift_left_decimal_to_ulonglong ha_dec_to_ull;
@@ -2234,7 +2239,7 @@ public:
};
-bool Item_func_shift_right::fix_length_and_dec()
+bool Item_func_shift_right::fix_length_and_dec(THD *thd)
{
static Func_handler_shift_right_int_to_ulonglong ha_int_to_ull;
static Func_handler_shift_right_decimal_to_ulonglong ha_dec_to_ull;
@@ -2266,7 +2271,7 @@ public:
};
-bool Item_func_bit_neg::fix_length_and_dec()
+bool Item_func_bit_neg::fix_length_and_dec(THD *thd)
{
static Func_handler_bit_neg_int_to_ulonglong ha_int_to_ull;
static Func_handler_bit_neg_decimal_to_ulonglong ha_dec_to_ull;
@@ -2338,7 +2343,7 @@ void Item_func_int_val::fix_length_and_dec_double()
}
-bool Item_func_int_val::fix_length_and_dec()
+bool Item_func_int_val::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_int_val::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name()));
@@ -3246,7 +3251,7 @@ longlong Item_func_field::val_int()
}
-bool Item_func_field::fix_length_and_dec()
+bool Item_func_field::fix_length_and_dec(THD *thd)
{
base_flags&= ~item_base_t::MAYBE_NULL;
max_length=3;
@@ -3302,7 +3307,7 @@ longlong Item_func_ord::val_int()
/* Returns number of found type >= 1 or 0 if not found */
/* This optimizes searching in enums to bit testing! */
-bool Item_func_find_in_set::fix_length_and_dec()
+bool Item_func_find_in_set::fix_length_and_dec(THD *thd)
{
decimals=0;
max_length=3; // 1-999
@@ -3431,7 +3436,7 @@ public:
};
-bool Item_func_bit_count::fix_length_and_dec()
+bool Item_func_bit_count::fix_length_and_dec(THD *thd)
{
static Func_handler_bit_count_int_to_slong ha_int_to_slong;
static Func_handler_bit_count_decimal_to_slong ha_dec_to_slong;
@@ -3545,7 +3550,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
NullS))
goto err_exit;
}
- if (func->fix_length_and_dec())
+ if (func->fix_length_and_dec(thd))
DBUG_RETURN(TRUE);
initid.max_length=func->max_length;
initid.maybe_null=func->maybe_null();
@@ -3844,7 +3849,7 @@ my_decimal *Item_func_udf_decimal::val_decimal(my_decimal *dec_buf)
/* Default max_length is max argument length */
-bool Item_func_udf_str::fix_length_and_dec()
+bool Item_func_udf_str::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_udf_str::fix_length_and_dec");
max_length=0;
@@ -4796,7 +4801,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
bool
-Item_func_set_user_var::fix_length_and_dec()
+Item_func_set_user_var::fix_length_and_dec(THD *thd)
{
base_flags|= (args[0]->base_flags & item_base_t::MAYBE_NULL);
decimals=args[0]->decimals;
@@ -5651,9 +5656,8 @@ err:
return 1;
}
-bool Item_func_get_user_var::fix_length_and_dec()
+bool Item_func_get_user_var::fix_length_and_dec(THD *thd)
{
- THD *thd=current_thd;
int error;
set_maybe_null();
decimals=NOT_FIXED_DEC;
@@ -5862,7 +5866,7 @@ void Item_func_get_system_var::update_null_value()
}
-bool Item_func_get_system_var::fix_length_and_dec()
+bool Item_func_get_system_var::fix_length_and_dec(THD *thd)
{
const char *cptr;
set_maybe_null();
@@ -5899,9 +5903,9 @@ bool Item_func_get_system_var::fix_length_and_dec()
case SHOW_CHAR_PTR:
mysql_mutex_lock(&LOCK_global_system_variables);
cptr= var->show_type() == SHOW_CHAR ?
- reinterpret_cast<const char*>(var->value_ptr(current_thd, var_type,
+ reinterpret_cast<const char*>(var->value_ptr(thd, var_type,
&component)) :
- *reinterpret_cast<const char* const*>(var->value_ptr(current_thd,
+ *reinterpret_cast<const char* const*>(var->value_ptr(thd,
var_type,
&component));
if (cptr)
@@ -6490,7 +6494,7 @@ public:
};
-bool Item_func_bit_xor::fix_length_and_dec()
+bool Item_func_bit_xor::fix_length_and_dec(THD *thd)
{
static const Func_handler_bit_xor_int_to_ulonglong ha_int_to_ull;
static const Func_handler_bit_xor_dec_to_ulonglong ha_dec_to_ull;
@@ -6629,7 +6633,7 @@ bool Item_func_sp::is_expensive()
@note called from Item::fix_fields.
*/
-bool Item_func_sp::fix_length_and_dec()
+bool Item_func_sp::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_func_sp::fix_length_and_dec");
@@ -6965,7 +6969,7 @@ bool Item_func_last_value::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuz
}
-bool Item_func_last_value::fix_length_and_dec()
+bool Item_func_last_value::fix_length_and_dec(THD *thd)
{
last_value= args[arg_count -1];
Type_std_attributes::set(last_value);
diff --git a/sql/item_func.h b/sql/item_func.h
index 2a4df525814..6e714814526 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -413,7 +413,7 @@ public:
{ return get_date_from_real(thd, ltime, fuzzydate); }
const Type_handler *type_handler() const override
{ return &type_handler_double; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= NOT_FIXED_DEC;
max_length= float_length(decimals);
@@ -1168,7 +1168,7 @@ public:
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return get_date_from_int(thd, ltime, fuzzydate); }
const Type_handler *type_handler() const override= 0;
- bool fix_length_and_dec() override { return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { return FALSE; }
};
@@ -1187,7 +1187,7 @@ public:
return &type_handler_ulong;
return &type_handler_slong;
}
- bool fix_length_and_dec() override { max_length= 11; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length= 11; return FALSE; }
};
@@ -1197,7 +1197,7 @@ public:
Item_func_hash(THD *thd, List<Item> &item): Item_int_func(thd, item)
{}
longlong val_int() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
const Type_handler *type_handler() const override
{ return &type_handler_slong; }
Item *get_copy(THD *thd) override
@@ -1295,7 +1295,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("connection_id") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool fix_fields(THD *thd, Item **ref) override;
longlong val_int() override { DBUG_ASSERT(fixed()); return value; }
bool check_vcol_func_processor(void *arg) override
@@ -1360,7 +1360,7 @@ public:
set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1));
fix_char_length(char_length);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return args[0]->type_handler()->Item_func_signed_fix_length_and_dec(this);
}
@@ -1397,7 +1397,7 @@ public:
null_value= args[0]->null_value;
return value;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this);
}
@@ -1432,7 +1432,7 @@ public:
const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; }
void fix_length_and_dec_generic() {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return
args[0]->type_handler()->Item_decimal_typecast_fix_length_and_dec(this);
@@ -1477,7 +1477,7 @@ public:
{ }
const Type_handler *type_handler() const override
{ return &type_handler_float; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return
args[0]->type_handler()->Item_float_typecast_fix_length_and_dec(this);
@@ -1510,7 +1510,7 @@ public:
Item_double_typecast(THD *thd, Item *a, uint len, uint dec):
Item_real_typecast(thd, a, len, dec)
{ }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return
args[0]->type_handler()->Item_double_typecast_fix_length_and_dec(this);
@@ -1547,7 +1547,7 @@ public:
return name;
}
enum precedence precedence() const override { return ADD_PRECEDENCE; }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
longlong int_op() override;
double real_op() override;
my_decimal *decimal_op(my_decimal *) override;
@@ -1573,7 +1573,7 @@ public:
longlong int_op() override;
double real_op() override;
my_decimal *decimal_op(my_decimal *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void fix_unsigned_flag();
void fix_length_and_dec_double()
{
@@ -1610,7 +1610,7 @@ public:
double real_op() override;
my_decimal *decimal_op(my_decimal *) override;
void result_precision() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool check_partition_func_processor(void *int_arg) override {return FALSE;}
bool check_vcol_func_processor(void *arg) override { return FALSE;}
Item *get_copy(THD *thd) override
@@ -1632,7 +1632,7 @@ public:
return name;
}
enum precedence precedence() const override { return MUL_PRECEDENCE; }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void fix_length_and_dec_double();
void fix_length_and_dec_int();
void result_precision() override;
@@ -1655,7 +1655,7 @@ public:
enum precedence precedence() const override { return MUL_PRECEDENCE; }
const Type_handler *type_handler() const override
{ return type_handler_long_or_longlong(); }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override
{
print_op(str, query_type);
@@ -1683,7 +1683,7 @@ public:
}
enum precedence precedence() const override { return MUL_PRECEDENCE; }
void result_precision() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void fix_length_and_dec_double()
{
Item_num_op::fix_length_and_dec_double();
@@ -1729,7 +1729,7 @@ public:
void fix_length_and_dec_int();
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
decimal_digits_t decimal_precision() const override
{ return args[0]->decimal_precision(); }
bool need_parentheses_in_default() override { return true; }
@@ -1753,7 +1753,7 @@ public:
void fix_length_and_dec_int();
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_abs>(thd, this); }
};
@@ -1767,7 +1767,7 @@ class Item_dec_func :public Item_real_func
public:
Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {}
Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= NOT_FIXED_DEC;
max_length= float_length(decimals);
@@ -2003,7 +2003,7 @@ public:
// Thinks like CEILING(TIMESTAMP'0000-01-01 23:59:59.9') returns NULL
set_maybe_null();
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *str_op(String *str) override { DBUG_ASSERT(0); return 0; }
bool native_op(THD *thd, Native *to) override
{
@@ -2093,7 +2093,7 @@ public:
void fix_arg_time();
void fix_arg_datetime();
void fix_arg_temporal(const Type_handler *h, uint int_part_length);
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
/*
We don't want to translate ENUM/SET to CHAR here.
@@ -2156,7 +2156,7 @@ public:
void update_used_tables() override {}
bool const_item() const override { return 0; }
void fix_after_optimize(THD *thd) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
unsigned_flag= 1;
used_tables_cache= RAND_TABLE_BIT;
@@ -2203,7 +2203,7 @@ public:
return name;
}
decimal_digits_t decimal_precision() const override { return 1; }
- bool fix_length_and_dec() override { fix_char_length(2); return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { fix_char_length(2); return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_sign>(thd, this); }
@@ -2226,7 +2226,7 @@ public:
}
double val_real() override;
LEX_CSTRING func_name_cstring() const override { return name; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= NOT_FIXED_DEC;
max_length= float_length(decimals);
@@ -2320,7 +2320,7 @@ public:
Item_func::aggregate_attributes_real(items, nitems);
max_length= float_length(decimals);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
if (aggregate_for_min_max(func_name_cstring(), args, arg_count))
return true;
@@ -2386,7 +2386,7 @@ public:
bool const_item() const override { return 0; }
const Type_handler *type_handler() const override
{ return args[0]->type_handler(); }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
Type_std_attributes::set(*args[0]);
return FALSE;
@@ -2402,7 +2402,7 @@ class Item_long_func_length: public Item_long_func
{ return args[0]->check_type_can_return_str(func_name_cstring()); }
public:
Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {}
- bool fix_length_and_dec() override { max_length=10; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
};
@@ -2426,7 +2426,7 @@ class Item_func_bit_length :public Item_longlong_func
String value;
public:
Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= 11; // 0x100000000*8 = 34,359,738,368
return FALSE;
@@ -2468,7 +2468,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("coercibility") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length=10;
base_flags&= ~item_base_t::MAYBE_NULL;
@@ -2518,7 +2518,7 @@ public:
return name;
}
longlong val_int() override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
return agg_arg_charsets_for_comparison(cmp_collation, args, 2);
@@ -2542,7 +2542,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("field") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_field>(thd, this); }
};
@@ -2561,7 +2561,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ascii") };
return name;
}
- bool fix_length_and_dec() override { max_length=3; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length=3; return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_ascii>(thd, this); }
};
@@ -2573,7 +2573,7 @@ class Item_func_ord :public Item_long_func
String value;
public:
Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {}
- bool fix_length_and_dec() override { fix_char_length(7); return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { fix_char_length(7); return FALSE; }
longlong val_int() override;
LEX_CSTRING func_name_cstring() const override
{
@@ -2601,7 +2601,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("find_in_set") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_find_in_set>(thd, this); }
};
@@ -2641,7 +2641,7 @@ class Item_func_bit_or :public Item_func_bit_operator
public:
Item_func_bit_or(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("|") };
@@ -2657,7 +2657,7 @@ class Item_func_bit_and :public Item_func_bit_operator
public:
Item_func_bit_and(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("&") };
@@ -2679,7 +2679,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("bit_count") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_bit_count>(thd, this); }
};
@@ -2689,7 +2689,7 @@ class Item_func_shift_left :public Item_func_bit_operator
public:
Item_func_shift_left(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("<<") };
@@ -2705,7 +2705,7 @@ class Item_func_shift_right :public Item_func_bit_operator
public:
Item_func_shift_right(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN(">>") };
@@ -2720,7 +2720,7 @@ class Item_func_bit_neg :public Item_func_bit_operator
{
public:
Item_func_bit_neg(THD *thd, Item *a): Item_func_bit_operator(thd, a) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("~") };
@@ -2750,7 +2750,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("last_insert_id") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
unsigned_flag= true;
if (arg_count)
@@ -2784,7 +2784,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("benchmark") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length=1;
base_flags&= ~item_base_t::MAYBE_NULL;
@@ -2809,7 +2809,7 @@ class Item_func_sleep :public Item_long_func
{ return args[0]->check_type_can_return_real(func_name_cstring()); }
public:
Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {}
- bool fix_length_and_dec() override { fix_char_length(1); return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { fix_char_length(1); return FALSE; }
bool const_item() const override { return 0; }
LEX_CSTRING func_name_cstring() const override
{
@@ -2982,7 +2982,7 @@ class Item_func_udf_float :public Item_udf_func
String *val_str(String *str) override;
const Type_handler *type_handler() const override
{ return &type_handler_double; }
- bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { fix_num_length_and_dec(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_float>(thd, this); }
};
@@ -3009,7 +3009,7 @@ public:
return &type_handler_ulonglong;
return &type_handler_slonglong;
}
- bool fix_length_and_dec() override { decimals= 0; max_length= 21; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { decimals= 0; max_length= 21; return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_int>(thd, this); }
};
@@ -3037,7 +3037,7 @@ public:
}
const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; }
- bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { fix_num_length_and_dec(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_decimal>(thd, this); }
};
@@ -3077,7 +3077,7 @@ public:
}
const Type_handler *type_handler() const override
{ return string_type_handler(); }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_str>(thd, this); }
};
@@ -3132,7 +3132,7 @@ public:
{ DBUG_ASSERT(fixed()); null_value=1; return 0; }
double val_real() { DBUG_ASSERT(fixed()); null_value= 1; return 0.0; }
longlong val_int() { DBUG_ASSERT(fixed()); null_value=1; return 0; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ base_flags|= item_base_t::MAYBE_NULL; max_length=0; return FALSE; }
};
@@ -3177,7 +3177,7 @@ class Item_func_get_lock final :public Item_func_lock
static LEX_CSTRING name= {STRING_WITH_LEN("get_lock") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= 1;
set_maybe_null();
@@ -3217,7 +3217,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("release_lock") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= 1;
set_maybe_null();
@@ -3254,7 +3254,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("master_pos_wait") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length=21;
set_maybe_null();
@@ -3288,7 +3288,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("master_gtid_wait") };
return name;
}
- bool fix_length_and_dec() override { max_length=2; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length=2; return FALSE; }
bool check_vcol_func_processor(void *arg) override
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
@@ -3391,7 +3391,7 @@ public:
void save_item_result(Item *item);
bool update();
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return ASSIGN_PRECEDENCE; }
void print_as_stmt(String *str, enum_query_type query_type);
@@ -3432,7 +3432,7 @@ public:
longlong val_int() override;
my_decimal *val_decimal(my_decimal*) override;
String *val_str(String* str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
/*
We must always return variables as strings to guard against selects of type
@@ -3560,7 +3560,7 @@ public:
size_t name_len_arg);
enum Functype functype() const override { return GSYSVAR_FUNC; }
void update_null_value() override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override;
bool const_item() const override { return true; }
table_map used_tables() const override { return 0; }
@@ -3701,7 +3701,7 @@ class Item_func_bit_xor : public Item_func_bit_operator
public:
Item_func_bit_xor(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("^") };
@@ -3725,7 +3725,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_free_lock") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=1;
@@ -3753,7 +3753,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_used_lock") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0; max_length=10;
set_maybe_null();
@@ -3772,35 +3772,41 @@ struct Lex_cast_type_st: public Lex_length_and_dec_st
{
private:
const Type_handler *m_type_handler;
+ CHARSET_INFO *m_charset;
public:
- void set(const Type_handler *handler, const char *length, const char *dec)
- {
- m_type_handler= handler;
- Lex_length_and_dec_st::set(length, dec);
- }
- void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec)
+ void set(const Type_handler *handler,
+ Lex_length_and_dec_st length_and_dec,
+ CHARSET_INFO *cs= NULL)
{
m_type_handler= handler;
+ m_charset= cs;
Lex_length_and_dec_st::operator=(length_and_dec);
}
- void set(const Type_handler *handler, const char *length)
+ bool set(const Type_handler *handler,
+ const Lex_length_and_dec_st & length_and_dec,
+ const Lex_column_charset_collation_attrs_st &cscl,
+ CHARSET_INFO *defcs)
{
- set(handler, length, 0);
+ CHARSET_INFO *tmp= cscl.resolved_to_character_set(defcs);
+ if (!tmp)
+ return true;
+ set(handler, length_and_dec, tmp);
+ return false;
}
void set(const Type_handler *handler)
{
- set(handler, 0, 0);
+ m_type_handler= handler;
+ m_charset= NULL;
+ Lex_length_and_dec_st::reset();
}
const Type_handler *type_handler() const { return m_type_handler; }
- Item *create_typecast_item(THD *thd, Item *item,
- CHARSET_INFO *cs= NULL) const
+ CHARSET_INFO *charset() const { return m_charset; }
+ Item *create_typecast_item(THD *thd, Item *item) const
{
return m_type_handler->
- create_typecast_item(thd, item,
- Type_cast_attributes(length(), dec(), cs));
+ create_typecast_item(thd, item, Type_cast_attributes(*this, m_charset));
}
- Item *create_typecast_item_or_error(THD *thd, Item *item,
- CHARSET_INFO *cs= NULL) const;
+ Item *create_typecast_item_or_error(THD *thd, Item *item) const;
};
@@ -3814,7 +3820,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("row_count") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
base_flags&= ~item_base_t::MAYBE_NULL;
@@ -3945,7 +3951,7 @@ public:
enum Functype functype() const override { return FUNC_SP; }
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec(void) override;
+ bool fix_length_and_dec(THD *thd) override;
bool is_expensive() override;
inline Field *get_sp_result_field()
@@ -3987,7 +3993,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("found_rows") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
base_flags&= ~item_base_t::MAYBE_NULL;
@@ -4043,7 +4049,7 @@ public:
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
base_flags&= ~item_base_t::MAYBE_NULL;
null_value= false;
@@ -4069,7 +4075,7 @@ public:
}
longlong val_int() override;
bool const_item() const override { return false; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= 21; unsigned_flag=1; return FALSE; }
table_map used_tables() const override { return RAND_TABLE_BIT; }
bool check_vcol_func_processor(void *arg) override
@@ -4094,7 +4100,7 @@ public:
my_decimal *val_decimal(my_decimal *) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool val_native(THD *thd, Native *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("last_value") };
@@ -4139,7 +4145,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("nextval") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
unsigned_flag= 0;
max_length= MAX_BIGINT_WIDTH;
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 7e331e287f2..8714417a77d 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -42,7 +42,7 @@
#include "item_create.h"
-bool Item_geometry_func::fix_length_and_dec()
+bool Item_geometry_func::fix_length_and_dec(THD *thd)
{
collation.set(&my_charset_bin);
decimals=0;
@@ -214,7 +214,7 @@ String *Item_func_as_wkt::val_str_ascii(String *str)
}
-bool Item_func_as_wkt::fix_length_and_dec()
+bool Item_func_as_wkt::fix_length_and_dec(THD *thd)
{
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
max_length= (uint32) UINT_MAX32;
@@ -241,7 +241,7 @@ String *Item_func_as_wkb::val_str(String *str)
}
-bool Item_func_as_geojson::fix_length_and_dec()
+bool Item_func_as_geojson::fix_length_and_dec(THD *thd)
{
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
max_length=MAX_BLOB_WIDTH;
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index e7f465170ab..40f4b924d09 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -42,7 +42,7 @@ public:
Item_geometry_func(THD *thd, Item *a, Item *b, Item *c):
Item_str_func(thd, a, b, c) {}
Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
const Type_handler *type_handler() const override
{ return &type_handler_geometry; }
};
@@ -283,7 +283,7 @@ public:
return name;
}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_as_wkt>(thd, this); }
};
@@ -301,7 +301,7 @@ public:
String *val_str(String *) override;
const Type_handler *type_handler() const override
{ return &type_handler_long_blob; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(&my_charset_bin);
decimals=0;
@@ -334,7 +334,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_asgeojson") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str_ascii(String *) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_as_geojson>(thd, this); }
@@ -352,7 +352,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometrytype") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
// "GeometryCollection" is the longest
fix_length_and_charset(20, default_charset());
@@ -586,9 +586,9 @@ public:
item_type=it;
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- if (Item_geometry_func::fix_length_and_dec())
+ if (Item_geometry_func::fix_length_and_dec(thd))
return TRUE;
for (unsigned int i= 0; i < arg_count; ++i)
{
@@ -951,7 +951,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_isempty") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ set_maybe_null(); return FALSE; }
bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) override
@@ -973,7 +973,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_issimple") };
return name;
}
- bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_issimple>(thd, this); }
@@ -990,7 +990,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_isclosed") };
return name;
}
- bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_isclosed>(thd, this); }
@@ -1021,7 +1021,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_dimension") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_dimension>(thd, this); }
@@ -1038,9 +1038,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_x") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- if (Item_real_func::fix_length_and_dec())
+ if (Item_real_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
return FALSE;
@@ -1060,9 +1060,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_y") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- if (Item_real_func::fix_length_and_dec())
+ if (Item_real_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
return FALSE;
@@ -1083,7 +1083,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_numgeometries") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_numgeometries>(thd, this); }
@@ -1101,7 +1101,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_numinteriorrings") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_numinteriorring>(thd, this); }
@@ -1119,7 +1119,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_numpoints") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_numpoints>(thd, this); }
@@ -1136,9 +1136,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_area") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- if (Item_real_func::fix_length_and_dec())
+ if (Item_real_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
return FALSE;
@@ -1160,9 +1160,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_length") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- if (Item_real_func::fix_length_and_dec())
+ if (Item_real_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
return FALSE;
@@ -1183,7 +1183,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("srid") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_srid>(thd, this); }
@@ -1259,7 +1259,7 @@ class Item_func_gis_debug: public Item_long_func
public:
Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a)
{ null_value= false; }
- bool fix_length_and_dec() override { fix_char_length(10); return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { fix_char_length(10); return FALSE; }
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("st_gis_debug") };
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index d32d2d30d4a..590fde88a52 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -146,9 +146,10 @@ static int append_tab(String *js, int depth, int tab_size)
int json_path_parts_compare(
const json_path_step_t *a, const json_path_step_t *a_end,
const json_path_step_t *b, const json_path_step_t *b_end,
- enum json_value_types vt)
+ enum json_value_types vt, const int *array_sizes)
{
int res, res2;
+ const json_path_step_t *temp_b= b;
DBUG_EXECUTE_IF("json_check_min_stack_requirement",
{
@@ -175,12 +176,28 @@ int json_path_parts_compare(
DBUG_ASSERT((b->type & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD)) == 0);
-
if (a->type & JSON_PATH_ARRAY)
{
if (b->type & JSON_PATH_ARRAY)
{
- if ((a->type & JSON_PATH_WILD) || a->n_item == b->n_item)
+ int res= 0, corrected_n_item_a= 0;
+ if (array_sizes)
+ corrected_n_item_a= a->n_item < 0 ?
+ array_sizes[b-temp_b] + a->n_item : a->n_item;
+ if (a->type & JSON_PATH_ARRAY_RANGE)
+ {
+ int corrected_n_item_end_a= 0;
+ if (array_sizes)
+ corrected_n_item_end_a= a->n_item_end < 0 ?
+ array_sizes[b-temp_b] + a->n_item_end :
+ a->n_item_end;
+ res= b->n_item >= corrected_n_item_a &&
+ b->n_item <= corrected_n_item_end_a;
+ }
+ else
+ res= corrected_n_item_a == b->n_item;
+
+ if ((a->type & JSON_PATH_WILD) || res)
goto step_fits;
goto step_failed;
}
@@ -215,11 +232,15 @@ step_fits:
}
/* Double wild handling needs recursions. */
- res= json_path_parts_compare(a+1, a_end, b, b_end, vt);
+ res= json_path_parts_compare(a+1, a_end, b, b_end, vt,
+ array_sizes ? array_sizes + (b - temp_b) :
+ NULL);
if (res == 0)
return 0;
- res2= json_path_parts_compare(a, a_end, b, b_end, vt);
+ res2= json_path_parts_compare(a, a_end, b, b_end, vt,
+ array_sizes ? array_sizes + (b - temp_b) :
+ NULL);
return (res2 >= 0) ? res2 : res;
@@ -231,11 +252,15 @@ step_fits_autowrap:
}
/* Double wild handling needs recursions. */
- res= json_path_parts_compare(a+1, a_end, b+1, b_end, vt);
+ res= json_path_parts_compare(a+1, a_end, b+1, b_end, vt,
+ array_sizes ? array_sizes + (b - temp_b) :
+ NULL);
if (res == 0)
return 0;
- res2= json_path_parts_compare(a, a_end, b+1, b_end, vt);
+ res2= json_path_parts_compare(a, a_end, b+1, b_end, vt,
+ array_sizes ? array_sizes + (b - temp_b) :
+ NULL);
return (res2 >= 0) ? res2 : res;
@@ -246,10 +271,10 @@ step_fits_autowrap:
int json_path_compare(const json_path_t *a, const json_path_t *b,
- enum json_value_types vt)
+ enum json_value_types vt, const int *array_size)
{
return json_path_parts_compare(a->steps+1, a->last_step,
- b->steps+1, b->last_step, vt);
+ b->steps+1, b->last_step, vt, array_size);
}
@@ -525,7 +550,8 @@ static int path_setup_nwc(json_path_t *p, CHARSET_INFO *i_cs,
{
if (!json_path_setup(p, i_cs, str, end))
{
- if ((p->types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD)) == 0)
+ if ((p->types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD |
+ JSON_PATH_ARRAY_RANGE)) == 0)
return 0;
p->s.error= NO_WILDCARD_ALLOWED;
}
@@ -545,9 +571,9 @@ longlong Item_func_json_valid::val_int()
}
-bool Item_func_json_equals::fix_length_and_dec()
+bool Item_func_json_equals::fix_length_and_dec(THD *thd)
{
- if (Item_bool_func::fix_length_and_dec())
+ if (Item_bool_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
return FALSE;
@@ -605,9 +631,9 @@ end:
}
-bool Item_func_json_exists::fix_length_and_dec()
+bool Item_func_json_exists::fix_length_and_dec(THD *thd)
{
- if (Item_bool_func::fix_length_and_dec())
+ if (Item_bool_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
path.set_constant_flag(args[1]->const_item());
@@ -618,7 +644,7 @@ bool Item_func_json_exists::fix_length_and_dec()
longlong Item_func_json_exists::val_int()
{
json_engine_t je;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
String *js= args[0]->val_json(&tmp_js);
@@ -658,7 +684,7 @@ err_return:
}
-bool Item_func_json_value::fix_length_and_dec()
+bool Item_func_json_value::fix_length_and_dec(THD *thd)
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
@@ -668,7 +694,7 @@ bool Item_func_json_value::fix_length_and_dec()
}
-bool Item_func_json_query::fix_length_and_dec()
+bool Item_func_json_query::fix_length_and_dec(THD *thd)
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
@@ -683,7 +709,7 @@ bool Json_path_extractor::extract(String *str, Item *item_js, Item *item_jp,
{
String *js= item_js->val_json(&tmp_js);
int error= 0;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
if (!parsed)
{
@@ -779,7 +805,7 @@ bool Json_engine_scan::check_and_get_value_complex(String *res, int *error)
}
-bool Item_func_json_quote::fix_length_and_dec()
+bool Item_func_json_quote::fix_length_and_dec(THD *thd)
{
collation.set(&my_charset_utf8mb4_bin);
/*
@@ -815,7 +841,7 @@ String *Item_func_json_quote::val_str(String *str)
}
-bool Item_func_json_unquote::fix_length_and_dec()
+bool Item_func_json_unquote::fix_length_and_dec(THD *thd)
{
collation.set(&my_charset_utf8mb3_general_ci,
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
@@ -935,7 +961,7 @@ void Item_json_str_multipath::cleanup()
}
-bool Item_func_json_extract::fix_length_and_dec()
+bool Item_func_json_extract::fix_length_and_dec(THD *thd)
{
collation.set(args[0]->collation);
max_length= args[0]->max_length * (arg_count - 1);
@@ -947,11 +973,12 @@ bool Item_func_json_extract::fix_length_and_dec()
static bool path_exact(const json_path_with_flags *paths_list, int n_paths,
- const json_path_t *p, json_value_types vt)
+ const json_path_t *p, json_value_types vt,
+ const int *array_size_counter)
{
for (; n_paths > 0; n_paths--, paths_list++)
{
- if (json_path_compare(&paths_list->p, p, vt) == 0)
+ if (json_path_compare(&paths_list->p, p, vt, array_size_counter) == 0)
return TRUE;
}
return FALSE;
@@ -959,11 +986,12 @@ static bool path_exact(const json_path_with_flags *paths_list, int n_paths,
static bool path_ok(const json_path_with_flags *paths_list, int n_paths,
- const json_path_t *p, json_value_types vt)
+ const json_path_t *p, json_value_types vt,
+ const int *array_size_counter)
{
for (; n_paths > 0; n_paths--, paths_list++)
{
- if (json_path_compare(&paths_list->p, p, vt) >= 0)
+ if (json_path_compare(&paths_list->p, p, vt, array_size_counter) >= 0)
return TRUE;
}
return FALSE;
@@ -982,6 +1010,8 @@ String *Item_func_json_extract::read_json(String *str,
uint n_arg;
size_t v_len;
int possible_multiple_values;
+ int array_size_counter[JSON_DEPTH_LIMIT];
+ uint has_negative_path= 0;
if ((null_value= args[0]->null_value))
return 0;
@@ -991,15 +1021,19 @@ String *Item_func_json_extract::read_json(String *str,
json_path_with_flags *c_path= paths + n_arg - 1;
if (!c_path->parsed)
{
+ c_path->p.types_used= JSON_PATH_KEY_NULL;
String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-1));
- if (s_p &&
- json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
- (const uchar *) s_p->ptr() + s_p->length()))
+ if (s_p)
{
- report_path_error(s_p, &c_path->p, n_arg);
- goto return_null;
+ if (json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
+ (const uchar *) s_p->ptr() + s_p->length()))
+ {
+ report_path_error(s_p, &c_path->p, n_arg);
+ goto return_null;
+ }
+ c_path->parsed= c_path->constant;
+ has_negative_path|= c_path->p.types_used & JSON_PATH_NEGATIVE_INDEX;
}
- c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
@@ -1007,7 +1041,8 @@ String *Item_func_json_extract::read_json(String *str,
}
possible_multiple_values= arg_count > 2 ||
- (paths[0].p.types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD));
+ (paths[0].p.types_used & (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD |
+ JSON_PATH_ARRAY_RANGE));
*type= possible_multiple_values ? JSON_VALUE_ARRAY : JSON_VALUE_NULL;
@@ -1025,7 +1060,12 @@ String *Item_func_json_extract::read_json(String *str,
while (json_get_path_next(&je, &p) == 0)
{
- if (!path_exact(paths, arg_count-1, &p, je.value_type))
+ if (has_negative_path && je.value_type == JSON_VALUE_ARRAY &&
+ json_skip_array_and_count(&je,
+ array_size_counter + (p.last_step - p.steps)))
+ goto error;
+
+ if (!path_exact(paths, arg_count-1, &p, je.value_type, array_size_counter))
continue;
value= je.value_begin;
@@ -1206,14 +1246,14 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
-bool Item_func_json_contains::fix_length_and_dec()
+bool Item_func_json_contains::fix_length_and_dec(THD *thd)
{
a2_constant= args[1]->const_item();
a2_parsed= FALSE;
set_maybe_null();
if (arg_count > 2)
path.set_constant_flag(args[2]->const_item());
- return Item_bool_func::fix_length_and_dec();
+ return Item_bool_func::fix_length_and_dec(thd);
}
@@ -1404,7 +1444,7 @@ longlong Item_func_json_contains::val_int()
if (arg_count>2) /* Path specified. */
{
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
if (!path.parsed)
{
String *s_p= args[2]->val_str(&tmp_path);
@@ -1465,13 +1505,13 @@ bool Item_func_json_contains_path::fix_fields(THD *thd, Item **ref)
}
-bool Item_func_json_contains_path::fix_length_and_dec()
+bool Item_func_json_contains_path::fix_length_and_dec(THD *thd)
{
ooa_constant= args[1]->const_item();
ooa_parsed= FALSE;
set_maybe_null();
mark_constant_paths(paths, args+2, arg_count-2);
- return Item_bool_func::fix_length_and_dec();
+ return Item_bool_func::fix_length_and_dec(thd);
}
@@ -1534,19 +1574,22 @@ longlong Item_func_json_contains_path::val_int()
result= !mode_one;
for (n_arg=2; n_arg < arg_count; n_arg++)
{
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
json_path_with_flags *c_path= paths + n_arg - 2;
if (!c_path->parsed)
{
- String *s_p= args[n_arg]->val_str(tmp_paths+(n_arg-2));
- if (s_p &&
- json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
- (const uchar *) s_p->ptr() + s_p->length()))
+ String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-2));
+ if (s_p)
{
- report_path_error(s_p, &c_path->p, n_arg-2);
- goto return_null;
+ if (json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
+ (const uchar *) s_p->ptr() + s_p->length()))
+ {
+ report_path_error(s_p, &c_path->p, n_arg);
+ goto null_return;
+ }
+ c_path->parsed= c_path->constant;
+ has_negative_path|= c_path->p.types_used & JSON_PATH_NEGATIVE_INDEX;
}
- c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
@@ -1595,6 +1638,8 @@ longlong Item_func_json_contains_path::val_int()
json_path_t p;
int n_found;
LINT_INIT(n_found);
+ int array_sizes[JSON_DEPTH_LIMIT];
+ uint has_negative_path= 0;
if ((null_value= args[0]->null_value))
return 0;
@@ -1605,17 +1650,21 @@ longlong Item_func_json_contains_path::val_int()
for (n_arg=2; n_arg < arg_count; n_arg++)
{
json_path_with_flags *c_path= paths + n_arg - 2;
+ c_path->p.types_used= JSON_PATH_KEY_NULL;
if (!c_path->parsed)
{
String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-2));
- if (s_p &&
- json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
- (const uchar *) s_p->ptr() + s_p->length()))
+ if (s_p)
{
- report_path_error(s_p, &c_path->p, n_arg);
- goto null_return;
+ if (json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
+ (const uchar *) s_p->ptr() + s_p->length()))
+ {
+ report_path_error(s_p, &c_path->p, n_arg);
+ goto null_return;
+ }
+ c_path->parsed= c_path->constant;
+ has_negative_path|= c_path->p.types_used & JSON_PATH_NEGATIVE_INDEX;
}
- c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto null_return;
@@ -1637,10 +1686,17 @@ longlong Item_func_json_contains_path::val_int()
while (json_get_path_next(&je, &p) == 0)
{
int n_path= arg_count - 2;
+ if (has_negative_path && je.value_type == JSON_VALUE_ARRAY &&
+ json_skip_array_and_count(&je, array_sizes + (p.last_step - p.steps)))
+ {
+ result= 1;
+ break;
+ }
+
json_path_with_flags *c_path= paths;
for (; n_path > 0; n_path--, c_path++)
{
- if (json_path_compare(&c_path->p, &p, je.value_type) >= 0)
+ if (json_path_compare(&c_path->p, &p, je.value_type, array_sizes) >= 0)
{
if (mode_one)
{
@@ -1802,7 +1858,7 @@ append_null:
}
-bool Item_func_json_array::fix_length_and_dec()
+bool Item_func_json_array::fix_length_and_dec(THD *thd)
{
ulonglong char_length= 2;
uint n_arg;
@@ -1871,7 +1927,7 @@ err_return:
}
-bool Item_func_json_array_append::fix_length_and_dec()
+bool Item_func_json_array_append::fix_length_and_dec(THD *thd)
{
uint n_arg;
ulonglong char_length;
@@ -1908,7 +1964,7 @@ String *Item_func_json_array_append::val_str(String *str)
for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++)
{
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
json_path_with_flags *c_path= paths + n_path;
if (!c_path->parsed)
{
@@ -2038,10 +2094,10 @@ String *Item_func_json_array_insert::val_str(String *str)
for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++)
{
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
json_path_with_flags *c_path= paths + n_path;
const char *item_pos;
- uint n_item;
+ int n_item, corrected_n_item;
if (!c_path->parsed)
{
@@ -2091,11 +2147,20 @@ String *Item_func_json_array_insert::val_str(String *str)
item_pos= 0;
n_item= 0;
+ corrected_n_item= c_path->p.last_step[1].n_item;
+ if (corrected_n_item < 0)
+ {
+ int array_size;
+ if (json_skip_array_and_count(&je, &array_size))
+ goto js_error;
+ corrected_n_item+= array_size + 1;
+ }
while (json_scan_next(&je) == 0 && je.state != JST_ARRAY_END)
{
DBUG_ASSERT(je.state == JST_VALUE);
- if (n_item == c_path->p.last_step[1].n_item)
+
+ if (n_item == corrected_n_item)
{
item_pos= (const char *) je.s.c_str;
break;
@@ -2828,7 +2893,7 @@ null_return:
}
-bool Item_func_json_length::fix_length_and_dec()
+bool Item_func_json_length::fix_length_and_dec(THD *thd)
{
if (arg_count > 1)
path.set_constant_flag(args[1]->const_item());
@@ -2843,7 +2908,7 @@ longlong Item_func_json_length::val_int()
String *js= args[0]->val_json(&tmp_js);
json_engine_t je;
uint length= 0;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
int err;
if ((null_value= args[0]->null_value))
@@ -2974,7 +3039,7 @@ longlong Item_func_json_depth::val_int()
}
-bool Item_func_json_type::fix_length_and_dec()
+bool Item_func_json_type::fix_length_and_dec(THD *thd)
{
collation.set(&my_charset_utf8mb3_general_ci);
max_length= 12 * collation.collation->mbmaxlen;
@@ -3032,7 +3097,7 @@ error:
}
-bool Item_func_json_insert::fix_length_and_dec()
+bool Item_func_json_insert::fix_length_and_dec(THD *thd)
{
uint n_arg;
ulonglong char_length;
@@ -3072,10 +3137,11 @@ String *Item_func_json_insert::val_str(String *str)
for (n_arg=1, n_path=0; n_arg < arg_count; n_arg+=2, n_path++)
{
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
json_path_with_flags *c_path= paths + n_path;
const char *v_to;
- const json_path_step_t *lp;
+ json_path_step_t *lp;
+ int corrected_n_item;
if (!c_path->parsed)
{
@@ -3121,7 +3187,7 @@ String *Item_func_json_insert::val_str(String *str)
lp= c_path->p.last_step+1;
if (lp->type & JSON_PATH_ARRAY)
{
- uint n_item= 0;
+ int n_item= 0;
if (je.value_type != JSON_VALUE_ARRAY)
{
@@ -3169,13 +3235,21 @@ String *Item_func_json_insert::val_str(String *str)
goto continue_point;
}
+ corrected_n_item= lp->n_item;
+ if (corrected_n_item < 0)
+ {
+ int array_size;
+ if (json_skip_array_and_count(&je, &array_size))
+ goto js_error;
+ corrected_n_item+= array_size;
+ }
while (json_scan_next(&je) == 0 && je.state != JST_ARRAY_END)
{
switch (je.state)
{
case JST_VALUE:
- if (n_item == lp->n_item)
+ if (n_item == corrected_n_item)
goto v_found;
n_item++;
if (json_skip_array_item(&je))
@@ -3297,7 +3371,7 @@ return_null:
}
-bool Item_func_json_remove::fix_length_and_dec()
+bool Item_func_json_remove::fix_length_and_dec(THD *thd)
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
@@ -3326,11 +3400,11 @@ String *Item_func_json_remove::val_str(String *str)
for (n_arg=1, n_path=0; n_arg < arg_count; n_arg++, n_path++)
{
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
json_path_with_flags *c_path= paths + n_path;
const char *rem_start= 0, *rem_end;
- const json_path_step_t *lp;
- uint n_item= 0;
+ json_path_step_t *lp;
+ int n_item= 0;
if (!c_path->parsed)
{
@@ -3375,17 +3449,28 @@ String *Item_func_json_remove::val_str(String *str)
goto js_error;
lp= c_path->p.last_step+1;
+
if (lp->type & JSON_PATH_ARRAY)
{
+ int corrected_n_item;
if (je.value_type != JSON_VALUE_ARRAY)
continue;
+ corrected_n_item= lp->n_item;
+ if (corrected_n_item < 0)
+ {
+ int array_size;
+ if (json_skip_array_and_count(&je, &array_size))
+ goto js_error;
+ corrected_n_item+= array_size;
+ }
+
while (json_scan_next(&je) == 0 && je.state != JST_ARRAY_END)
{
switch (je.state)
{
case JST_VALUE:
- if (n_item == lp->n_item)
+ if (n_item == corrected_n_item)
{
rem_start= (const char *) (je.s.c_str -
(n_item ? je.sav_c_len : 0));
@@ -3486,7 +3571,7 @@ null_return:
}
-bool Item_func_json_keys::fix_length_and_dec()
+bool Item_func_json_keys::fix_length_and_dec(THD *thd)
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
@@ -3537,7 +3622,7 @@ String *Item_func_json_keys::val_str(String *str)
json_engine_t je;
String *js= args[0]->val_json(&tmp_js);
uint n_keys= 0;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
if ((args[0]->null_value))
goto null_return;
@@ -3654,7 +3739,7 @@ bool Item_func_json_search::fix_fields(THD *thd, Item **ref)
static const uint SQR_MAX_BLOB_WIDTH= (uint) sqrt(MAX_BLOB_WIDTH);
-bool Item_func_json_search::fix_length_and_dec()
+bool Item_func_json_search::fix_length_and_dec(THD *thd)
{
collation.set(args[0]->collation);
@@ -3744,6 +3829,8 @@ String *Item_func_json_search::val_str(String *str)
json_engine_t je;
json_path_t p, sav_path;
uint n_arg;
+ int array_sizes[JSON_DEPTH_LIMIT];
+ uint has_negative_path= 0;
if (args[0]->null_value || args[2]->null_value)
goto null_return;
@@ -3758,17 +3845,21 @@ String *Item_func_json_search::val_str(String *str)
for (n_arg=4; n_arg < arg_count; n_arg++)
{
json_path_with_flags *c_path= paths + n_arg - 4;
+ c_path->p.types_used= JSON_PATH_KEY_NULL;
if (!c_path->parsed)
{
String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-4));
- if (s_p &&
- json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
- (const uchar *) s_p->ptr() + s_p->length()))
+ if (s_p)
{
- report_path_error(s_p, &c_path->p, n_arg);
- goto null_return;
+ if (json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
+ (const uchar *) s_p->ptr() + s_p->length()))
+ {
+ report_path_error(s_p, &c_path->p, n_arg);
+ goto null_return;
+ }
+ c_path->parsed= c_path->constant;
+ has_negative_path|= c_path->p.types_used & JSON_PATH_NEGATIVE_INDEX;
}
- c_path->parsed= c_path->constant;
}
if (args[n_arg]->null_value)
goto null_return;
@@ -3779,9 +3870,14 @@ String *Item_func_json_search::val_str(String *str)
while (json_get_path_next(&je, &p) == 0)
{
+ if (has_negative_path && je.value_type == JSON_VALUE_ARRAY &&
+ json_skip_array_and_count(&je, array_sizes + (p.last_step - p.steps)))
+ goto js_error;
+
if (json_value_scalar(&je))
{
- if ((arg_count < 5 || path_ok(paths, arg_count - 4, &p, je.value_type)) &&
+ if ((arg_count < 5 ||
+ path_ok(paths, arg_count - 4, &p, je.value_type, array_sizes)) &&
compare_json_value_wild(&je, s_str) != 0)
{
++n_path_found;
@@ -3854,7 +3950,7 @@ LEX_CSTRING Item_func_json_format::func_name_cstring() const
}
-bool Item_func_json_format::fix_length_and_dec()
+bool Item_func_json_format::fix_length_and_dec(THD *thd)
{
decimals= 0;
collation.set(args[0]->collation);
@@ -4201,7 +4297,7 @@ end:
}
-bool Item_func_json_normalize::fix_length_and_dec()
+bool Item_func_json_normalize::fix_length_and_dec(THD *thd)
{
collation.set(&my_charset_utf8mb4_bin);
/* 0 becomes 0.0E0, thus one character becomes 5 chars */
@@ -4209,3 +4305,434 @@ bool Item_func_json_normalize::fix_length_and_dec()
set_maybe_null();
return FALSE;
}
+
+
+/*
+ When the two values match or don't match we need to return true or false.
+ But we can have some more elements in the array left or some more keys
+ left in the object that we no longer want to compare. In this case,
+ we want to skip the current item.
+*/
+void json_skip_current_level(json_engine_t *js, json_engine_t *value)
+{
+ json_skip_level(js);
+ json_skip_level(value);
+}
+
+
+/* At least one of the two arguments is a scalar. */
+bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value)
+{
+ if (json_value_scalar(value))
+ {
+ if (js->value_type == value->value_type)
+ {
+ if (js->value_type == JSON_VALUE_NUMBER)
+ {
+ double d_j, d_v;
+ char *end;
+ int err;
+
+ d_j= js->s.cs->strntod((char *) js->value, js->value_len, &end, &err);
+ d_v= value->s.cs->strntod((char *) value->value, value->value_len,
+ &end, &err);
+
+ return (fabs(d_j - d_v) < 1e-12);
+ }
+ else if (js->value_type == JSON_VALUE_STRING)
+ {
+ return value->value_len == js->value_len &&
+ memcmp(value->value, js->value, value->value_len) == 0;
+ }
+ }
+ return value->value_type == js->value_type;
+ }
+ else if (value->value_type == JSON_VALUE_ARRAY)
+ {
+ while (json_scan_next(value) == 0 && value->state == JST_VALUE)
+ {
+ if (json_read_value(value))
+ return FALSE;
+ if (js->value_type == value->value_type)
+ {
+ int res1= json_find_overlap_with_scalar(js, value);
+ if (res1)
+ return TRUE;
+ }
+ if (!json_value_scalar(value))
+ json_skip_level(value);
+ }
+ }
+ return FALSE;
+}
+
+
+/*
+ Compare when one is object and other is array. This means we are looking
+ for the object in the array. Hence, when value type of an element of the
+ array is object, then compare the two objects entirely. If they are
+ equal return true else return false.
+*/
+bool json_compare_arr_and_obj(json_engine_t *js, json_engine_t *value)
+{
+ st_json_engine_t loc_val= *value;
+ while (json_scan_next(js) == 0 && js->state == JST_VALUE)
+ {
+ if (json_read_value(js))
+ return FALSE;
+ if (js->value_type == JSON_VALUE_OBJECT)
+ {
+ int res1= json_find_overlap_with_object(js, value, true);
+ if (res1)
+ return TRUE;
+ *value= loc_val;
+ }
+ if (js->value_type == JSON_VALUE_ARRAY)
+ json_skip_level(js);
+ }
+ return FALSE;
+}
+
+
+bool json_compare_arrays_in_order(json_engine_t *js, json_engine_t *value)
+{
+ bool res= false;
+ while (json_scan_next(js) == 0 && json_scan_next(value) == 0 &&
+ js->state == JST_VALUE && value->state == JST_VALUE)
+ {
+ if (json_read_value(js) || json_read_value(value))
+ return FALSE;
+ if (js->value_type != value->value_type)
+ {
+ json_skip_current_level(js, value);
+ return FALSE;
+ }
+ res= check_overlaps(js, value, true);
+ if (!res)
+ {
+ json_skip_current_level(js, value);
+ return FALSE;
+ }
+ }
+ res= (value->state == JST_ARRAY_END || value->state == JST_OBJ_END ?
+ TRUE : FALSE);
+ json_skip_current_level(js, value);
+ return res;
+}
+
+
+int json_find_overlap_with_array(json_engine_t *js, json_engine_t *value,
+ bool compare_whole)
+{
+ if (value->value_type == JSON_VALUE_ARRAY)
+ {
+ if (compare_whole)
+ return json_compare_arrays_in_order(js, value);
+
+ json_engine_t loc_value= *value, current_js= *js;
+
+ while (json_scan_next(js) == 0 && js->state == JST_VALUE)
+ {
+ if (json_read_value(js))
+ return FALSE;
+ current_js= *js;
+ while (json_scan_next(value) == 0 && value->state == JST_VALUE)
+ {
+ if (json_read_value(value))
+ return FALSE;
+ if (js->value_type == value->value_type)
+ {
+ int res1= check_overlaps(js, value, true);
+ if (res1)
+ return TRUE;
+ }
+ else
+ {
+ if (!json_value_scalar(value))
+ json_skip_level(value);
+ }
+ *js= current_js;
+ }
+ *value= loc_value;
+ if (!json_value_scalar(js))
+ json_skip_level(js);
+ }
+ return FALSE;
+ }
+ else if (value->value_type == JSON_VALUE_OBJECT)
+ {
+ if (compare_whole)
+ {
+ json_skip_current_level(js, value);
+ return FALSE;
+ }
+ return json_compare_arr_and_obj(js, value);
+ }
+ else
+ return json_find_overlap_with_scalar(value, js);
+}
+
+
+int compare_nested_object(json_engine_t *js, json_engine_t *value)
+{
+ int result= 0;
+ const char *value_begin= (const char*)value->s.c_str-1;
+ const char *js_begin= (const char*)js->s.c_str-1;
+ json_skip_level(value);
+ json_skip_level(js);
+ const char *value_end= (const char*)value->s.c_str;
+ const char *js_end= (const char*)js->s.c_str;
+
+ String a(value_begin, value_end-value_begin,value->s.cs);
+ String b(js_begin, js_end-js_begin, js->s.cs);
+
+ DYNAMIC_STRING a_res, b_res;
+ if (init_dynamic_string(&a_res, NULL, 4096, 1024) ||
+ init_dynamic_string(&b_res, NULL, 4096, 1024))
+ {
+ goto error;
+ }
+ if (json_normalize(&a_res, a.ptr(), a.length(), value->s.cs) ||
+ json_normalize(&b_res, b.ptr(), b.length(), value->s.cs))
+ {
+ goto error;
+ }
+
+ result= strcmp(a_res.str, b_res.str) ? 0 : 1;
+
+ error:
+ dynstr_free(&a_res);
+ dynstr_free(&b_res);
+
+ return MY_TEST(result);
+}
+int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,
+ bool compare_whole)
+{
+ if (value->value_type == JSON_VALUE_OBJECT)
+ {
+ if (compare_whole)
+ {
+ return compare_nested_object(js, value);
+ }
+ else
+ {
+ /* Find at least one common key-value pair */
+ json_string_t key_name;
+ bool found_key= false, found_value= false;
+ json_engine_t loc_js= *js;
+ const uchar *k_start, *k_end;
+
+ json_string_set_cs(&key_name, value->s.cs);
+
+ while (json_scan_next(value) == 0 && value->state == JST_KEY)
+ {
+ k_start= value->s.c_str;
+ do
+ {
+ k_end= value->s.c_str;
+ } while (json_read_keyname_chr(value) == 0);
+
+ if (unlikely(value->s.error))
+ return FALSE;
+
+ json_string_set_str(&key_name, k_start, k_end);
+ found_key= find_key_in_object(js, &key_name);
+ found_value= 0;
+
+ if (found_key)
+ {
+ if (json_read_value(js) || json_read_value(value))
+ return FALSE;
+
+ /*
+ The value of key-value pair can be an be anything. If it is an object
+ then we need to compare the whole value and if it is an array then
+ we need to compare the elements in that order. So set compare_whole
+ to true.
+ */
+ if (js->value_type == value->value_type)
+ found_value= check_overlaps(js, value, true);
+ if (found_value)
+ {
+ /*
+ We have found at least one common key-value pair now.
+ No need to check for more key-value pairs. So skip remaining
+ jsons and return TRUE.
+ */
+ json_skip_current_level(js, value);
+ return TRUE;
+ }
+ else
+ {
+ /*
+ Key is found but value is not found. We have already
+ exhausted both values for current key. Hence "reset"
+ only js (first argument i.e json document) and
+ continue.
+ */
+ *js= loc_js;
+ continue;
+ }
+ }
+ else
+ {
+ /*
+ key is not found. So no need to check for value for that key.
+ Read the value anyway so we get the "type" of json value.
+ If is is non-scalar then skip the entire value
+ (scalar values get exhausted while reading so no need to skip them).
+ Then reset the json doc again.
+ */
+ if (json_read_value(value))
+ return FALSE;
+ if (!json_value_scalar(value))
+ json_skip_level(value);
+ *js= loc_js;
+ }
+ }
+ /*
+ At this point we have already returned true if any intersection exists.
+ So skip jsons if not exhausted and return false.
+ */
+ json_skip_current_level(js, value);
+ return FALSE;
+ }
+ }
+ else if (value->value_type == JSON_VALUE_ARRAY)
+ {
+ if (compare_whole)
+ {
+ json_skip_current_level(js, value);
+ return FALSE;
+ }
+ return json_compare_arr_and_obj(value, js);
+ }
+ return FALSE;
+}
+
+
+/*
+ Find if two json documents overlap
+
+ SYNOPSIS
+ check_overlaps()
+ js - json document
+ value - value
+ compare_whole - If true then find full overlap with the document in case of
+ object and comparing in-order in case of array.
+ Else find at least one match between two objects or array.
+
+ IMPLEMENTATION
+ We can compare two json datatypes if they are of same type to check if
+ they are equal. When comparing between a json document and json value,
+ there can be following cases:
+ 1) When at least one of the two json documents is of scalar type:
+ 1.a) If value and json document both are scalar, then return true
+ if they have same type and value.
+ 1.b) If json document is scalar but other is array (or vice versa),
+ then return true if array has at least one element of same type
+ and value as scalar.
+ 1.c) If one is scalar and other is object, then return false because
+ it can't be compared.
+
+ 2) When both arguments are of non-scalar type:
+ 2.a) If both arguments are arrays:
+ Iterate over the value and json document. If there exists at least
+ one element in other array of same type and value as that of
+ element in value, then return true else return false.
+ 2.b) If both arguments are objects:
+ Iterate over value and json document and if there exists at least
+ one key-value pair common between two objects, then return true,
+ else return false.
+ 2.c) If either of json document or value is array and other is object:
+ Iterate over the array, if an element of type object is found,
+ then compare it with the object (which is the other arguemnt).
+ If the entire object matches i.e all they key value pairs match,
+ then return true else return false.
+
+ When we are comparing an object which is nested in other object or nested
+ in an array, we need to compare all the key-value pairs, irrespective of
+ what order they are in as opposed to non-nested where we return true if
+ at least one match is found. However, if we have an array nested in another
+ array, then we compare two arrays in that order i.e we compare
+ i-th element of array 1 with i-th element of array 2.
+
+ RETURN
+ FALSE - If two json documents do not overlap
+ TRUE - if two json documents overlap
+*/
+int check_overlaps(json_engine_t *js, json_engine_t *value, bool compare_whole)
+{
+ DBUG_EXECUTE_IF("json_check_min_stack_requirement",
+ {
+ long arbitrary_var;
+ long stack_used_up= (available_stack_size(current_thd->thread_stack, &arbitrary_var));
+ ALLOCATE_MEM_ON_STACK(my_thread_stack_size-stack_used_up-STACK_MIN_SIZE);
+ });
+ if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
+ return 1;
+
+ switch (js->value_type)
+ {
+ case JSON_VALUE_OBJECT:
+ return json_find_overlap_with_object(js, value, compare_whole);
+ case JSON_VALUE_ARRAY:
+ return json_find_overlap_with_array(js, value, compare_whole);
+ default:
+ return json_find_overlap_with_scalar(js, value);
+ }
+}
+
+longlong Item_func_json_overlaps::val_int()
+{
+ String *js= args[0]->val_json(&tmp_js);
+ json_engine_t je, ve;
+ int result;
+
+ if ((null_value= args[0]->null_value))
+ return 0;
+
+ if (!a2_parsed)
+ {
+ val= args[1]->val_json(&tmp_val);
+ a2_parsed= a2_constant;
+ }
+
+ if (val == 0)
+ {
+ null_value= 1;
+ return 0;
+ }
+
+ json_scan_start(&je, js->charset(), (const uchar *) js->ptr(),
+ (const uchar *) js->ptr() + js->length());
+
+ json_scan_start(&ve, val->charset(), (const uchar *) val->ptr(),
+ (const uchar *) val->end());
+
+ if (json_read_value(&je) || json_read_value(&ve))
+ goto error;
+
+ result= check_overlaps(&je, &ve, false);
+ if (unlikely(je.s.error || ve.s.error))
+ goto error;
+
+ return result;
+
+error:
+ if (je.s.error)
+ report_json_error(js, &je, 0);
+ if (ve.s.error)
+ report_json_error(val, &ve, 1);
+ return 0;
+}
+
+bool Item_func_json_overlaps::fix_length_and_dec(THD *thd)
+{
+ a2_constant= args[1]->const_item();
+ a2_parsed= FALSE;
+ set_maybe_null();
+
+ return Item_bool_func::fix_length_and_dec(thd);
+}
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h
index 7c5e0bfa6e0..6f6b6a7afe8 100644
--- a/sql/item_jsonfunc.h
+++ b/sql/item_jsonfunc.h
@@ -47,6 +47,19 @@ void report_path_error_ex(const char *ps, json_path_t *p,
void report_json_error_ex(const char *js, json_engine_t *je,
const char *fname, int n_param,
Sql_condition::enum_warning_level lv);
+int check_overlaps(json_engine_t *js, json_engine_t *value, bool compare_whole);
+int json_find_overlap_with_object(json_engine_t *js,
+ json_engine_t *value,
+ bool compare_whole);
+void json_skip_current_level(json_engine_t *js, json_engine_t *value);
+bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value);
+bool json_compare_arrays_in_order_in_order(json_engine_t *js, json_engine_t *value);
+bool json_compare_arr_and_obj(json_engine_t *js, json_engine_t* value);
+int json_find_overlap_with_array(json_engine_t *js,
+ json_engine_t *value,
+ bool compare_whole);
+
+
class Json_engine_scan: public json_engine_t
{
@@ -88,9 +101,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_valid") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- if (Item_bool_func::fix_length_and_dec())
+ if (Item_bool_func::fix_length_and_dec(thd))
return TRUE;
set_maybe_null();
return FALSE;
@@ -117,7 +130,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_equals") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_equals>(thd, this); }
longlong val_int() override;
@@ -138,7 +151,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_exists") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_exists>(thd, this); }
longlong val_int() override;
@@ -175,7 +188,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_value") };
return name;
}
- bool fix_length_and_dec() override ;
+ bool fix_length_and_dec(THD *thd) override ;
String *val_str(String *to) override
{
null_value= Json_path_extractor::extract(to, args[0], args[1],
@@ -203,7 +216,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_query") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *to) override
{
null_value= Json_path_extractor::extract(to, args[0], args[1],
@@ -232,7 +245,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_quote") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_quote>(thd, this); }
@@ -251,7 +264,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_unquote") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_unquote>(thd, this); }
@@ -287,7 +300,7 @@ public:
return name;
}
enum Functype functype() const override { return JSON_EXTRACT_FUNC; }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
longlong val_int() override;
double val_real() override;
@@ -314,7 +327,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_contains") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
longlong val_int() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_contains>(thd, this); }
@@ -340,7 +353,7 @@ public:
return name;
}
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void cleanup() override;
longlong val_int() override;
Item *get_copy(THD *thd) override
@@ -359,7 +372,7 @@ public:
Item_func_json_array(THD *thd, List<Item> &list):
Item_json_func(thd, list) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("json_array") };
@@ -378,7 +391,7 @@ protected:
public:
Item_func_json_array_append(THD *thd, List<Item> &list):
Item_json_str_multipath(thd, list) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
uint get_n_paths() const override { return arg_count/2; }
LEX_CSTRING func_name_cstring() const override
@@ -469,7 +482,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_normalize") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_normalize>(thd, this); }
};
@@ -500,7 +513,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_length") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
longlong val_int() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_length>(thd, this); }
@@ -520,7 +533,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_depth") };
return name;
}
- bool fix_length_and_dec() override { max_length= 10; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length= 10; return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_depth>(thd, this); }
@@ -538,7 +551,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_type") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_type>(thd, this); }
@@ -555,7 +568,7 @@ public:
Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List<Item> &list):
Item_json_str_multipath(thd, list),
mode_insert(i_mode), mode_replace(r_mode) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
uint get_n_paths() const override { return arg_count/2; }
LEX_CSTRING func_name_cstring() const override
@@ -578,7 +591,7 @@ protected:
public:
Item_func_json_remove(THD *thd, List<Item> &list):
Item_json_str_multipath(thd, list) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
uint get_n_paths() const override { return arg_count - 1; }
LEX_CSTRING func_name_cstring() const override
@@ -605,7 +618,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_keys") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_keys>(thd, this); }
@@ -633,7 +646,7 @@ public:
return name;
}
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override;
uint get_n_paths() const override { return arg_count > 4 ? arg_count - 4 : 0; }
Item *get_copy(THD *thd) override
@@ -661,7 +674,7 @@ public:
Item_json_func(thd, list), fmt(DETAILED) {}
LEX_CSTRING func_name_cstring() const override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str(String *str) override;
String *val_json(String *str) override;
Item *get_copy(THD *thd) override
@@ -764,4 +777,23 @@ public:
extern bool is_json_type(const Item *item);
+class Item_func_json_overlaps: public Item_bool_func
+{
+ String tmp_js;
+ bool a2_constant, a2_parsed;
+ String tmp_val, *val;
+public:
+ Item_func_json_overlaps(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_overlaps") };
+ return name;
+ }
+ bool fix_length_and_dec(THD *thd) override;
+ longlong val_int() override;
+ Item *get_copy(THD *thd) override
+ { return get_item_copy<Item_func_json_overlaps>(thd, this); }
+};
+
#endif /* ITEM_JSONFUNC_INCLUDED */
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 643c3d4cf3e..624ef411a4a 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -210,7 +210,7 @@ String *Item_func_sha::val_str_ascii(String *str)
return 0;
}
-bool Item_func_sha::fix_length_and_dec()
+bool Item_func_sha::fix_length_and_dec(THD *thd)
{
// size of hex representation of hash
fix_length_and_charset(MY_SHA1_HASH_SIZE * 2, default_charset());
@@ -290,7 +290,7 @@ String *Item_func_sha2::val_str_ascii(String *str)
}
-bool Item_func_sha2::fix_length_and_dec()
+bool Item_func_sha2::fix_length_and_dec(THD *thd)
{
set_maybe_null();
max_length = 0;
@@ -370,7 +370,7 @@ String *Item_aes_crypt::val_str(String *str2)
return 0;
}
-bool Item_func_aes_encrypt::fix_length_and_dec()
+bool Item_func_aes_encrypt::fix_length_and_dec(THD *thd)
{
max_length=my_aes_get_size(MY_AES_ECB, args[0]->max_length);
what= ENCRYPTION_FLAG_ENCRYPT;
@@ -379,7 +379,7 @@ bool Item_func_aes_encrypt::fix_length_and_dec()
-bool Item_func_aes_decrypt::fix_length_and_dec()
+bool Item_func_aes_decrypt::fix_length_and_dec(THD *thd)
{
max_length=args[0]->max_length;
set_maybe_null();
@@ -388,7 +388,7 @@ bool Item_func_aes_decrypt::fix_length_and_dec()
}
-bool Item_func_to_base64::fix_length_and_dec()
+bool Item_func_to_base64::fix_length_and_dec(THD *thd)
{
base_flags|= args[0]->base_flags & item_base_t::MAYBE_NULL;
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
@@ -439,7 +439,7 @@ String *Item_func_to_base64::val_str_ascii(String *str)
}
-bool Item_func_from_base64::fix_length_and_dec()
+bool Item_func_from_base64::fix_length_and_dec(THD *thd)
{
if (args[0]->max_length > (uint) my_base64_decode_max_arg_length())
{
@@ -709,7 +709,7 @@ bool Item_func_concat::append_value(THD *thd, String *res, const String *app)
}
-bool Item_func_concat::fix_length_and_dec()
+bool Item_func_concat::fix_length_and_dec(THD *thd)
{
ulonglong char_length= 0;
@@ -1071,7 +1071,7 @@ null:
}
-bool Item_func_concat_ws::fix_length_and_dec()
+bool Item_func_concat_ws::fix_length_and_dec(THD *thd)
{
ulonglong char_length;
@@ -1141,7 +1141,7 @@ String *Item_func_reverse::val_str(String *str)
}
-bool Item_func_reverse::fix_length_and_dec()
+bool Item_func_reverse::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
@@ -1300,7 +1300,7 @@ null:
}
-bool Item_func_replace::fix_length_and_dec()
+bool Item_func_replace::fix_length_and_dec(THD *thd)
{
ulonglong char_length= (ulonglong) args[0]->max_char_length();
int diff=(int) (args[2]->max_char_length() - 1);
@@ -1327,7 +1327,7 @@ Item_func_sformat::Item_func_sformat(THD *thd, List<Item> &list)
}
-bool Item_func_sformat::fix_length_and_dec()
+bool Item_func_sformat::fix_length_and_dec(THD *thd)
{
if (!val_arg)
return TRUE;
@@ -1450,7 +1450,7 @@ String *Item_func_sformat::val_str(String *res)
}
/*********************************************************************/
-bool Item_func_regexp_replace::fix_length_and_dec()
+bool Item_func_regexp_replace::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 3))
return TRUE;
@@ -1588,7 +1588,7 @@ err:
}
-bool Item_func_regexp_substr::fix_length_and_dec()
+bool Item_func_regexp_substr::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
return TRUE;
@@ -1703,7 +1703,7 @@ null:
}
-bool Item_func_insert::fix_length_and_dec()
+bool Item_func_insert::fix_length_and_dec(THD *thd)
{
ulonglong char_length;
@@ -1736,7 +1736,7 @@ String *Item_str_conv::val_str(String *str)
}
-bool Item_func_lcase::fix_length_and_dec()
+bool Item_func_lcase::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
@@ -1747,7 +1747,7 @@ bool Item_func_lcase::fix_length_and_dec()
return FALSE;
}
-bool Item_func_ucase::fix_length_and_dec()
+bool Item_func_ucase::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
@@ -1807,7 +1807,7 @@ void Item_str_func::left_right_max_length()
}
-bool Item_func_left::fix_length_and_dec()
+bool Item_func_left::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
@@ -1843,7 +1843,7 @@ String *Item_func_right::val_str(String *str)
}
-bool Item_func_right::fix_length_and_dec()
+bool Item_func_right::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
@@ -1900,7 +1900,7 @@ String *Item_func_substr::val_str(String *str)
}
-bool Item_func_substr::fix_length_and_dec()
+bool Item_func_substr::fix_length_and_dec(THD *thd)
{
max_length=args[0]->max_length;
@@ -1930,7 +1930,7 @@ bool Item_func_substr::fix_length_and_dec()
}
-bool Item_func_substr_index::fix_length_and_dec()
+bool Item_func_substr_index::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
return TRUE;
@@ -2275,7 +2275,7 @@ String *Item_func_trim::val_str(String *str)
return trimmed_value(res, (uint32) (ptr - res->ptr()), (uint32) (end - ptr));
}
-bool Item_func_trim::fix_length_and_dec()
+bool Item_func_trim::fix_length_and_dec(THD *thd)
{
if (arg_count == 1)
{
@@ -2471,7 +2471,7 @@ bool Item_func_encode::seed()
return FALSE;
}
-bool Item_func_encode::fix_length_and_dec()
+bool Item_func_encode::fix_length_and_dec(THD *thd)
{
max_length=args[0]->max_length;
base_flags|= ((args[0]->base_flags | args[1]->base_flags) &
@@ -2647,7 +2647,7 @@ bool Item_func_current_role::fix_fields(THD *thd, Item **ref)
return 0;
}
-bool Item_func_soundex::fix_length_and_dec()
+bool Item_func_soundex::fix_length_and_dec(THD *thd)
{
uint32 char_length= args[0]->max_char_length();
if (agg_arg_charsets_for_string_result(collation, args, 1))
@@ -2817,7 +2817,7 @@ String *Item_func_soundex::val_str(String *str)
const int FORMAT_MAX_DECIMALS= 38;
-bool Item_func_format::fix_length_and_dec()
+bool Item_func_format::fix_length_and_dec(THD *thd)
{
uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]);
uint dec= FORMAT_MAX_DECIMALS;
@@ -2964,7 +2964,7 @@ String *Item_func_format::val_str_ascii(String *str)
}
-bool Item_func_elt::fix_length_and_dec()
+bool Item_func_elt::fix_length_and_dec(THD *thd)
{
uint32 char_length= 0;
decimals=0;
@@ -3026,7 +3026,7 @@ String *Item_func_elt::val_str(String *str)
}
-bool Item_func_make_set::fix_length_and_dec()
+bool Item_func_make_set::fix_length_and_dec(THD *thd)
{
uint32 char_length= arg_count - 2; /* Separators */
@@ -3189,7 +3189,7 @@ inline String* alloc_buffer(String *res,String *str,String *tmp_value,
}
-bool Item_func_repeat::fix_length_and_dec()
+bool Item_func_repeat::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
@@ -3265,7 +3265,7 @@ err:
}
-bool Item_func_space::fix_length_and_dec()
+bool Item_func_space::fix_length_and_dec(THD *thd)
{
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
if (args[0]->can_eval_in_optimize())
@@ -3325,7 +3325,7 @@ err:
}
-bool Item_func_binlog_gtid_pos::fix_length_and_dec()
+bool Item_func_binlog_gtid_pos::fix_length_and_dec(THD *thd)
{
collation.set(system_charset_info);
max_length= MAX_BLOB_WIDTH;
@@ -3374,7 +3374,7 @@ static String *default_pad_str(String *pad_str, CHARSET_INFO *collation)
return pad_str;
}
-bool Item_func_pad::fix_length_and_dec()
+bool Item_func_pad::fix_length_and_dec(THD *thd)
{
if (arg_count == 3)
{
@@ -3710,7 +3710,7 @@ String *Item_func_conv_charset::val_str(String *str)
0 : str;
}
-bool Item_func_conv_charset::fix_length_and_dec()
+bool Item_func_conv_charset::fix_length_and_dec(THD *thd)
{
DBUG_ASSERT(collation.derivation == DERIVATION_IMPLICIT);
fix_char_length(args[0]->max_char_length());
@@ -3736,7 +3736,7 @@ String *Item_func_set_collation::val_str(String *str)
return str;
}
-bool Item_func_set_collation::fix_length_and_dec()
+bool Item_func_set_collation::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return true;
@@ -3793,7 +3793,7 @@ String *Item_func_collation::val_str(String *str)
}
-bool Item_func_weight_string::fix_length_and_dec()
+bool Item_func_weight_string::fix_length_and_dec(THD *thd)
{
CHARSET_INFO *cs= args[0]->collation.collation;
collation.set(&my_charset_bin, args[0]->collation.derivation);
@@ -4185,7 +4185,7 @@ String* Item_func_export_set::val_str(String* str)
return str;
}
-bool Item_func_export_set::fix_length_and_dec()
+bool Item_func_export_set::fix_length_and_dec(THD *thd)
{
uint32 length= MY_MAX(args[1]->max_char_length(), args[2]->max_char_length());
uint32 sep_length= (arg_count > 3 ? args[3]->max_char_length() : 1);
@@ -4598,7 +4598,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref)
}
-bool Item_func_dyncol_create::fix_length_and_dec()
+bool Item_func_dyncol_create::fix_length_and_dec(THD *thd)
{
max_length= MAX_BLOB_WIDTH;
set_maybe_null();
@@ -5449,7 +5449,7 @@ Item_temptable_rowid::Item_temptable_rowid(TABLE *table_arg)
max_length= table->file->ref_length;
}
-bool Item_temptable_rowid::fix_length_and_dec()
+bool Item_temptable_rowid::fix_length_and_dec(THD *thd)
{
used_tables_cache= table->map;
const_item_cache= false;
@@ -5715,7 +5715,7 @@ error_exit:
return nullptr;
}
-bool Item_func_natural_sort_key::fix_length_and_dec(void)
+bool Item_func_natural_sort_key::fix_length_and_dec(THD *thd)
{
if (agg_arg_charsets_for_string_result(collation, args, 1))
return true;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 86a095a39e6..89a392a9add 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -145,7 +145,7 @@ class Item_func_md5 :public Item_str_ascii_checksum_func
public:
Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
fix_length_and_charset(32, default_charset());
return FALSE;
@@ -165,7 +165,7 @@ class Item_func_sha :public Item_str_ascii_checksum_func
public:
Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("sha") };
@@ -181,7 +181,7 @@ public:
Item_func_sha2(THD *thd, Item *a, Item *b)
:Item_str_ascii_checksum_func(thd, a, b) {}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("sha2") };
@@ -198,7 +198,7 @@ public:
Item_func_to_base64(THD *thd, Item *a)
:Item_str_ascii_checksum_func(thd, a) {}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("to_base64") };
@@ -215,7 +215,7 @@ public:
Item_func_from_base64(THD *thd, Item *a)
:Item_str_binary_checksum_func(thd, a) { }
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("from_base64") };
@@ -246,7 +246,7 @@ class Item_func_aes_encrypt :public Item_aes_crypt
public:
Item_func_aes_encrypt(THD *thd, Item *a, Item *b)
:Item_aes_crypt(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("aes_encrypt") };
@@ -261,7 +261,7 @@ class Item_func_aes_decrypt :public Item_aes_crypt
public:
Item_func_aes_decrypt(THD *thd, Item *a, Item *b):
Item_aes_crypt(thd, a, b) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("aes_decrypt") };
@@ -282,7 +282,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("natural_sort_key")};
return name;
}
- bool fix_length_and_dec(void) override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{
return get_item_copy<Item_func_natural_sort_key>(thd, this);
@@ -308,7 +308,7 @@ public:
Item_func_concat(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("concat") };
@@ -351,7 +351,7 @@ public:
Item_func_decode_histogram(THD *thd, Item *a, Item *b):
Item_str_func(thd, a, b) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(system_charset_info);
max_length= MAX_BLOB_WIDTH;
@@ -373,7 +373,7 @@ class Item_func_concat_ws :public Item_str_func
public:
Item_func_concat_ws(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("concat_ws") };
@@ -390,7 +390,7 @@ class Item_func_reverse :public Item_str_func
public:
Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("reverse") };
@@ -408,7 +408,7 @@ public:
Item_func_replace(THD *thd, Item *org, Item *find, Item *replace):
Item_str_func(thd, org, find, replace) {}
String *val_str(String *to) override { return val_str_internal(to, NULL); };
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
String *val_str_internal(String *str, String *empty_string_for_null);
LEX_CSTRING func_name_cstring() const override
{
@@ -456,7 +456,7 @@ public:
DBUG_VOID_RETURN;
}
String *val_str(String *str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_replace") };
@@ -481,7 +481,7 @@ public:
DBUG_VOID_RETURN;
}
String *val_str(String *str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_substr") };
@@ -499,7 +499,7 @@ public:
Item *new_str):
Item_str_func(thd, org, start, length, new_str) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("insert") };
@@ -531,7 +531,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("lcase") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_lcase>(thd, this); }
};
@@ -545,7 +545,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ucase") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_ucase>(thd, this); }
};
@@ -558,7 +558,7 @@ public:
Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
bool hash_not_null(Hasher *hasher) override;
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("left") };
@@ -575,7 +575,7 @@ class Item_func_right :public Item_str_func
public:
Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("right") };
@@ -596,7 +596,7 @@ public:
Item_func_substr(THD *thd, Item *a, Item *b, Item *c):
Item_str_func(thd, a, b, c) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("substr") };
@@ -613,7 +613,7 @@ 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;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("sformat") };
@@ -635,9 +635,9 @@ public:
Item_func_substr(thd, a, b) {}
Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c):
Item_func_substr(thd, a, b, c) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_func_substr::fix_length_and_dec();
+ bool res= Item_func_substr::fix_length_and_dec(thd);
set_maybe_null();
return res;
}
@@ -657,7 +657,7 @@ public:
Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c):
Item_str_func(thd, a, b, c) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("substring_index") };
@@ -702,7 +702,7 @@ public:
Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {}
Sql_mode_dependency value_depends_on_sql_mode() const override;
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("trim") };
@@ -734,9 +734,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("trim_oracle") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_func_trim::fix_length_and_dec();
+ bool res= Item_func_trim::fix_length_and_dec(thd);
set_maybe_null();
return res;
}
@@ -786,9 +786,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ltrim_oracle") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_func_ltrim::fix_length_and_dec();
+ bool res= Item_func_ltrim::fix_length_and_dec(thd);
set_maybe_null();
return res;
}
@@ -834,9 +834,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("rtrim_oracle") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_func_rtrim::fix_length_and_dec();
+ bool res= Item_func_rtrim::fix_length_and_dec(thd);
set_maybe_null();
return res;
}
@@ -867,7 +867,7 @@ public:
Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {}
String *val_str_ascii(String *str) override;
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
fix_length_and_charset((alg == 1 ?
SCRAMBLED_PASSWORD_CHAR_LENGTH :
@@ -898,7 +898,7 @@ public:
Item_func_des_encrypt(THD *thd, Item *a, Item *b)
:Item_str_binary_checksum_func(thd, a, b) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
@@ -923,7 +923,7 @@ public:
Item_func_des_decrypt(THD *thd, Item *a, Item *b)
:Item_str_binary_checksum_func(thd, a, b) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
@@ -967,7 +967,7 @@ public:
constructor_helper();
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
max_length = 13;
@@ -1000,7 +1000,7 @@ public:
Item_func_encode(THD *thd, Item *a, Item *seed_arg):
Item_str_binary_checksum_func(thd, a, seed_arg) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("encode") };
@@ -1058,7 +1058,7 @@ class Item_func_database :public Item_func_sysconst
public:
Item_func_database(THD *thd): Item_func_sysconst(thd) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= NAME_CHAR_LEN * system_charset_info->mbmaxlen;
set_maybe_null();
@@ -1092,7 +1092,7 @@ public:
{
str->append(func_name_cstring());
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= 512 * system_charset_info->mbmaxlen;
null_value= false;
@@ -1120,7 +1120,7 @@ public:
return (null_value ? 0 : &str_value);
}
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= (uint32) (username_char_length +
HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN;
@@ -1174,7 +1174,7 @@ public:
Item_func_current_role(THD *thd, Name_resolution_context *context_arg):
Item_func_sysconst(thd), context(context_arg) {}
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN;
return FALSE;
@@ -1210,7 +1210,7 @@ class Item_func_soundex :public Item_str_func
public:
Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("soundex") };
@@ -1228,7 +1228,7 @@ public:
double val_real() override;
longlong val_int() override;
String *val_str(String *str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("elt") };
@@ -1246,7 +1246,7 @@ class Item_func_make_set :public Item_str_func
public:
Item_func_make_set(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
String *val_str(String *str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("make_set") };
@@ -1267,7 +1267,7 @@ public:
Item_str_ascii_func(thd, org, dec, lang) {}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("format") };
@@ -1291,7 +1291,7 @@ public:
{ collation.set(cs); }
String *val_str(String *) override;
void append_char(String * str, int32 num);
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= arg_count * 4;
return FALSE;
@@ -1312,7 +1312,7 @@ public:
Item_func_chr(THD *thd, Item *arg1, CHARSET_INFO *cs):
Item_func_char(thd, arg1, cs) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= 4;
return FALSE;
@@ -1333,7 +1333,7 @@ public:
Item_func_repeat(THD *thd, Item *arg1, Item *arg2):
Item_str_func(thd, arg1, arg2) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("repeat") };
@@ -1349,7 +1349,7 @@ class Item_func_space :public Item_str_func
public:
Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("space") };
@@ -1366,7 +1366,7 @@ public:
Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2):
Item_str_func(thd, arg1, arg2) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("binlog_gtid_pos") };
@@ -1390,7 +1390,7 @@ public:
Item_str_func(thd, arg1, arg2, arg3) {}
Item_func_pad(THD *thd, Item *arg1, Item *arg2):
Item_str_func(thd, arg1, arg2) {}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
};
@@ -1422,9 +1422,9 @@ public:
Item_func_rpad(thd, arg1, arg2, arg3) {}
Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2):
Item_func_rpad(thd, arg1, arg2) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_func_rpad::fix_length_and_dec();
+ bool res= Item_func_rpad::fix_length_and_dec(thd);
set_maybe_null();
return res;
}
@@ -1465,9 +1465,9 @@ public:
Item_func_lpad(thd, arg1, arg2, arg3) {}
Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2):
Item_func_lpad(thd, arg1, arg2) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_func_lpad::fix_length_and_dec();
+ bool res= Item_func_lpad::fix_length_and_dec(thd);
set_maybe_null();
return res;
}
@@ -1492,7 +1492,7 @@ public:
return name;
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(default_charset());
fix_char_length(64);
@@ -1531,7 +1531,7 @@ public:
DBUG_ASSERT(fixed());
return m_arg0_type_handler->Item_func_hex_val_str_ascii(this, str);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
decimals=0;
@@ -1558,7 +1558,7 @@ public:
return name;
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(&my_charset_bin);
decimals=0;
@@ -1584,7 +1584,7 @@ public:
set_maybe_null();
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(args[0]->collation);
decimals=0;
@@ -1638,7 +1638,7 @@ public:
tmp->set_charset(&my_charset_bin);
return tmp;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(&my_charset_bin);
max_length=args[0]->max_length;
@@ -1667,7 +1667,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("load_file") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
set_maybe_null();
@@ -1693,7 +1693,7 @@ class Item_func_export_set: public Item_str_func
Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e):
Item_str_func(thd, a, b, c, d, e) {}
String *val_str(String *str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("export_set") };
@@ -1715,7 +1715,7 @@ public:
return name;
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(args[0]->collation);
ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 +
@@ -1812,7 +1812,7 @@ public:
return 1;
return res;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("convert") };
@@ -1831,7 +1831,7 @@ public:
Item_func_set_collation(THD *thd, Item *a, CHARSET_INFO *set_collation):
Item_str_func(thd, a), m_set_collation(set_collation) {}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override;
LEX_CSTRING func_name_cstring() const override
{
@@ -1856,7 +1856,7 @@ class Item_func_expr_str_metadata :public Item_str_func
{
public:
Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
collation.set(system_charset_info);
max_length= 64 * collation.collation->mbmaxlen; // should be enough
@@ -1924,7 +1924,7 @@ public:
return name;
}
String *val_str(String *) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override
{
if (!Item_str_func::eq(item, binary_cmp))
@@ -1967,7 +1967,7 @@ public:
static LEX_CSTRING crc32c_name= {STRING_WITH_LEN("crc32c") };
return crc_func == my_crc32c ? crc32c_name : crc32_name;
}
- bool fix_length_and_dec() override { max_length=10; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
longlong val_int() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_crc32>(thd, this); }
@@ -1984,7 +1984,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("uncompressed_length") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length=10;
set_maybe_null();
@@ -2006,7 +2006,7 @@ class Item_func_compress: public Item_str_binary_checksum_func
public:
Item_func_compress(THD *thd, Item *a)
:Item_str_binary_checksum_func(thd, a) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= (args[0]->max_length * 120) / 100 + 12;
return FALSE;
@@ -2027,7 +2027,7 @@ class Item_func_uncompress: public Item_str_binary_checksum_func
public:
Item_func_uncompress(THD *thd, Item *a)
:Item_str_binary_checksum_func(thd, a) {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
max_length= MAX_BLOB_WIDTH;
@@ -2057,7 +2057,7 @@ protected:
public:
Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs);
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("column_create") };
@@ -2099,7 +2099,7 @@ public:
return name;
}
String *val_str(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= MAX_BLOB_WIDTH;
set_maybe_null();
@@ -2119,7 +2119,7 @@ class Item_dyncol_get: public Item_str_func
public:
Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num)
{}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
max_length= MAX_BLOB_WIDTH;
@@ -2166,7 +2166,7 @@ class Item_func_dyncol_list: public Item_str_func
public:
Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str)
{collation.set(DYNCOL_UTF);}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
max_length= MAX_BLOB_WIDTH;
@@ -2203,7 +2203,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("<rowid>") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_temptable_rowid>(thd, this); }
};
@@ -2222,7 +2222,7 @@ public:
return name;
}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= WSREP_GTID_STR_LEN;
set_maybe_null();
@@ -2243,7 +2243,7 @@ public:
return name;
}
String *val_str_ascii(String *) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= WSREP_GTID_STR_LEN;
set_maybe_null();
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index e99c968efba..6e4c5f48928 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1026,7 +1026,13 @@ bool Item_subselect::const_item() const
Item *Item_subselect::get_tmp_table_item(THD *thd_arg)
{
if (!with_sum_func() && !const_item())
- return new (thd->mem_root) Item_temptable_field(thd_arg, result_field);
+ {
+ auto item_field=
+ new (thd->mem_root) Item_field(thd_arg, result_field);
+ if (item_field)
+ item_field->set_refers_to_temp_table(true);
+ return item_field;
+ }
return copy_or_same(thd_arg);
}
@@ -5304,10 +5310,12 @@ bool subselect_hash_sj_engine::make_semi_join_conds()
/* New equi-join condition for the current column. */
Item_func_eq *eq_cond;
/* Item for the corresponding field from the materialized temp table. */
- Item_field *right_col_item;
+ Item_field *right_col_item= new (thd->mem_root)
+ Item_field(thd, context, tmp_table->field[i]);
+ if (right_col_item)
+ right_col_item->set_refers_to_temp_table(true);
- if (!(right_col_item= new (thd->mem_root)
- Item_temptable_field(thd, context, tmp_table->field[i])) ||
+ if (!right_col_item ||
!(eq_cond= new (thd->mem_root)
Item_func_eq(thd, item_in->left_expr->element_index(i),
right_col_item)) ||
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index a26adb17e28..ffac6dbb912 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -553,10 +553,18 @@ Item *Item_sum::get_tmp_table_item(THD *thd)
Item *arg= sum_item->args[i];
if (!arg->const_item())
{
- if (arg->type() == Item::FIELD_ITEM)
- ((Item_field*) arg)->field= result_field_tmp++;
- else
- sum_item->args[i]= new (thd->mem_root) Item_temptable_field(thd, result_field_tmp++);
+ if (arg->type() == Item::FIELD_ITEM)
+ {
+ ((Item_field*) arg)->field= result_field_tmp++;
+ }
+ else
+ {
+ auto item_field=
+ new (thd->mem_root) Item_field(thd, result_field_tmp++);
+ if (item_field)
+ item_field->set_refers_to_temp_table(true);
+ sum_item->args[i]= item_field;
+ }
}
}
}
@@ -1142,7 +1150,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
result_field=0;
max_length=float_length(decimals);
null_value=1;
- if (fix_length_and_dec() ||
+ if (fix_length_and_dec(thd) ||
check_sum_func(thd, ref))
return TRUE;
@@ -1168,7 +1176,7 @@ Item_sum_min_max::fix_fields(THD *thd, Item **ref)
/* We should ignore FIELD's in arguments to sum functions */
with_flags|= (args[0]->with_flags & ~item_with_t::FIELD);
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
DBUG_RETURN(TRUE);
if (!is_window_func_sum_expr())
@@ -1244,7 +1252,7 @@ bool Item_sum_hybrid::fix_length_and_dec_string()
}
-bool Item_sum_min_max::fix_length_and_dec()
+bool Item_sum_min_max::fix_length_and_dec(THD *thd)
{
DBUG_ASSERT(args[0]->field_type() == args[0]->real_item()->field_type());
DBUG_ASSERT(args[0]->result_type() == args[0]->real_item()->result_type());
@@ -1373,7 +1381,7 @@ Item_sum_sp::fix_fields(THD *thd, Item **ref)
result_field= NULL;
max_length= float_length(decimals);
null_value= 1;
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
return TRUE;
if (check_sum_func(thd, ref))
@@ -1460,12 +1468,12 @@ Item_sum_sp::cleanup()
*/
bool
-Item_sum_sp::fix_length_and_dec()
+Item_sum_sp::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_sum_sp::fix_length_and_dec");
DBUG_ASSERT(sp_result_field);
Type_std_attributes::set(sp_result_field->type_std_attributes());
- bool res= Item_sum::fix_length_and_dec();
+ bool res= Item_sum::fix_length_and_dec(thd);
DBUG_RETURN(res);
}
@@ -1562,7 +1570,7 @@ void Item_sum_sum::fix_length_and_dec_decimal()
}
-bool Item_sum_sum::fix_length_and_dec()
+bool Item_sum_sum::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_sum_sum::fix_length_and_dec");
set_maybe_null();
@@ -1984,7 +1992,7 @@ void Item_sum_avg::fix_length_and_dec_double()
}
-bool Item_sum_avg::fix_length_and_dec()
+bool Item_sum_avg::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_sum_avg::fix_length_and_dec");
prec_increment= current_thd->variables.div_precincrement;
@@ -2216,7 +2224,7 @@ void Item_sum_variance::fix_length_and_dec_decimal()
}
-bool Item_sum_variance::fix_length_and_dec()
+bool Item_sum_variance::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_sum_variance::fix_length_and_dec");
set_maybe_null();
@@ -3484,7 +3492,7 @@ my_decimal *Item_sum_udf_int::val_decimal(my_decimal *dec)
/** Default max_length is max argument length. */
-bool Item_sum_udf_str::fix_length_and_dec()
+bool Item_sum_udf_str::fix_length_and_dec(THD *thd)
{
DBUG_ENTER("Item_sum_udf_str::fix_length_and_dec");
max_length=0;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 58fa61f2d3b..7308734070d 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -468,7 +468,7 @@ public:
Updated value is then saved in the field.
*/
virtual void update_field()=0;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
null_value=1;
@@ -790,7 +790,7 @@ public:
{
return get_date_from_int(thd, ltime, fuzzydate);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=21;
@@ -812,7 +812,7 @@ protected:
my_decimal direct_sum_decimal;
my_decimal dec_buffs[2];
uint curr_dec_buff;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
public:
Item_sum_sum(THD *thd, Item *item_par, bool distinct):
@@ -957,7 +957,7 @@ public:
void fix_length_and_dec_double();
void fix_length_and_dec_decimal();
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
enum Sumfunctype sum_func () const override
{
return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC;
@@ -1041,7 +1041,7 @@ public:
class Item_sum_variance :public Item_sum_double
{
Stddev m_stddev;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
public:
uint sample;
@@ -1157,7 +1157,7 @@ public:
cmp_sign(item->cmp_sign), was_values(item->was_values)
{ }
bool fix_fields(THD *, Item **) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void setup_hybrid(THD *thd, Item *item, Item *value_arg);
void clear() override;
void direct_add(Item *item);
@@ -1248,7 +1248,7 @@ public:
void update_field() override;
const Type_handler *type_handler() const override
{ return &type_handler_ulonglong; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
if (args[0]->check_type_can_return_int(func_name_cstring()))
return true;
@@ -1438,7 +1438,7 @@ public:
{
return create_table_field_from_handler(root, table);
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool fix_fields(THD *thd, Item **ref) override;
LEX_CSTRING func_name_cstring() const override;
const Type_handler *type_handler() const override;
@@ -1728,7 +1728,7 @@ class Item_sum_udf_float :public Item_udf_sum
my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const override
{ return &type_handler_double; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
@@ -1756,7 +1756,7 @@ public:
return &type_handler_ulonglong;
return &type_handler_slonglong;
}
- bool fix_length_and_dec() override { decimals=0; max_length=21; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=21; return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_udf_int>(thd, this); }
@@ -1798,7 +1798,7 @@ public:
my_decimal *val_decimal(my_decimal *dec) override;
const Type_handler *type_handler() const override
{ return string_type_handler(); }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_udf_str>(thd, this); }
@@ -1829,7 +1829,7 @@ public:
my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
@@ -1907,7 +1907,7 @@ public:
{ DBUG_ASSERT(fixed()); null_value=1; return 0; }
double val_real() { DBUG_ASSERT(fixed()); null_value=1; return 0.0; }
longlong val_int() { DBUG_ASSERT(fixed()); null_value=1; return 0; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ base_flags|= item_base_t::MAYBE_NULL; max_length=0; return FALSE; }
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
void clear() {}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 0a24578ce85..8399e5dc0ac 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -971,9 +971,8 @@ longlong Item_func_month::val_int()
}
-bool Item_func_monthname::fix_length_and_dec()
+bool Item_func_monthname::fix_length_and_dec(THD *thd)
{
- THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection;
locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
@@ -1116,9 +1115,8 @@ longlong Item_func_weekday::val_int()
return dt.weekday(odbc_type) + MY_TEST(odbc_type);
}
-bool Item_func_dayname::fix_length_and_dec()
+bool Item_func_dayname::fix_length_and_dec(THD *thd)
{
- THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection;
locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
@@ -1551,7 +1549,7 @@ bool Item_func_curtime::fix_fields(THD *thd, Item **items)
{
if (decimals > TIME_SECOND_PART_DIGITS)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<ulonglong>(decimals),
+ my_error(ER_TOO_BIG_PRECISION, MYF(0),
func_name(), TIME_SECOND_PART_DIGITS);
return 1;
}
@@ -1627,7 +1625,7 @@ bool Item_func_now::fix_fields(THD *thd, Item **items)
{
if (decimals > TIME_SECOND_PART_DIGITS)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<ulonglong>(decimals),
+ my_error(ER_TOO_BIG_PRECISION, MYF(0),
func_name(), TIME_SECOND_PART_DIGITS);
return 1;
}
@@ -1735,9 +1733,8 @@ bool Item_func_sec_to_time::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fu
return false;
}
-bool Item_func_date_format::fix_length_and_dec()
+bool Item_func_date_format::fix_length_and_dec(THD *thd)
{
- THD* thd= current_thd;
if (!is_time_format)
{
if (arg_count < 3)
@@ -2617,9 +2614,8 @@ err_exit:
}
-bool Item_func_tochar::fix_length_and_dec()
+bool Item_func_tochar::fix_length_and_dec(THD *thd)
{
- thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection;
Item *arg1= args[1]->this_item();
my_repertoire_t repertoire= arg1->collation.repertoire;
@@ -2683,6 +2679,7 @@ bool Item_func_tochar::fix_length_and_dec()
String *Item_func_tochar::val_str(String* str)
{
+ THD *thd= current_thd;
StringBuffer<64> format_buffer;
String *format;
MYSQL_TIME l_time;
@@ -2733,9 +2730,8 @@ null_date:
}
-bool Item_func_from_unixtime::fix_length_and_dec()
+bool Item_func_from_unixtime::fix_length_and_dec(THD *thd)
{
- THD *thd= current_thd;
thd->time_zone_used= 1;
tz= thd->variables.time_zone;
Type_std_attributes::set(
@@ -2818,7 +2814,7 @@ void Item_func_convert_tz::cleanup()
}
-bool Item_date_add_interval::fix_length_and_dec()
+bool Item_date_add_interval::fix_length_and_dec(THD *thd)
{
enum_field_types arg0_field_type;
@@ -2947,7 +2943,7 @@ bool Item_extract::check_arguments() const
}
-bool Item_extract::fix_length_and_dec()
+bool Item_extract::fix_length_and_dec(THD *thd)
{
set_maybe_null(); // If wrong date
uint32 daylen= args[0]->cmp_type() == TIME_RESULT ? 2 :
@@ -3441,7 +3437,7 @@ err:
}
-bool Item_func_add_time::fix_length_and_dec()
+bool Item_func_add_time::fix_length_and_dec(THD *thd)
{
enum_field_types arg0_field_type;
@@ -3852,7 +3848,7 @@ get_date_time_result_type(const char *format, uint length)
}
-bool Item_func_str_to_date::fix_length_and_dec()
+bool Item_func_str_to_date::fix_length_and_dec(THD *thd)
{
if (!args[0]->type_handler()->is_traditional_scalar_type() ||
!args[1]->type_handler()->is_traditional_scalar_type())
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 9b78d6c159e..a5f6d9307c6 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -62,7 +62,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("period_add") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
return FALSE;
@@ -84,7 +84,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("period_diff") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
@@ -105,7 +105,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_days") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
@@ -137,7 +137,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_seconds") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
fix_char_length(12);
@@ -168,7 +168,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("dayofmonth") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@@ -197,7 +197,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("month") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
fix_char_length(2);
@@ -226,7 +226,7 @@ public:
return name;
}
String *val_str(String *str) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool check_partition_func_processor(void *int_arg) override {return TRUE;}
bool check_valid_arguments_processor(void *int_arg) override
{
@@ -251,7 +251,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("dayofyear") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
fix_char_length(3);
@@ -279,7 +279,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("hour") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@@ -307,7 +307,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("minute") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@@ -335,7 +335,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("quarter") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
@@ -363,7 +363,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("second") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@@ -397,7 +397,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("week") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@@ -434,7 +434,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("yearweek") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
@@ -464,7 +464,7 @@ public:
}
enum_monotonicity_info get_monotonicity_info() const override;
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
@@ -499,7 +499,7 @@ public:
{
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals= 0;
fix_char_length(1);
@@ -529,7 +529,7 @@ class Item_func_dayname :public Item_str_func
String *val_str(String *str) override;
const Type_handler *type_handler() const override
{ return &type_handler_varchar; }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool check_partition_func_processor(void *int_arg) override {return TRUE;}
bool check_vcol_func_processor(void *arg) override
{
@@ -600,10 +600,10 @@ public:
return FALSE;
return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
fix_length_and_dec_generic(arg_count ?
- args[0]->datetime_precision(current_thd) : 0);
+ args[0]->datetime_precision(thd) : 0);
return FALSE;
}
longlong int_op() override;
@@ -629,9 +629,9 @@ public:
{
return !has_time_args();
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- fix_length_and_dec_generic(args[0]->time_precision(current_thd));
+ fix_length_and_dec_generic(args[0]->time_precision(thd));
return FALSE;
}
longlong int_op() override;
@@ -657,7 +657,7 @@ public:
{ return Date(this).to_string(to); }
my_decimal *val_decimal(my_decimal *to) override
{ return Date(this).to_decimal(to); }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
fix_attributes_date();
set_maybe_null(arg_count > 0);
@@ -717,7 +717,7 @@ public:
Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0)
{ decimals= dec; }
bool fix_fields(THD *, Item **) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ fix_attributes_time(decimals); return FALSE; }
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
/*
@@ -821,7 +821,7 @@ public:
Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0)
{ decimals= dec; }
bool fix_fields(THD *, Item **) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ fix_attributes_datetime(decimals); return FALSE;}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0;
@@ -949,7 +949,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("date_format") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
uint format_length(const String *format);
bool eq(const Item *item, bool binary_cmp) const override;
bool check_vcol_func_processor(void *arg) override
@@ -1014,7 +1014,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_char") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool parse_format_string(const String *format, uint *fmt_len);
bool check_vcol_func_processor(void *arg) override
@@ -1041,7 +1041,7 @@ class Item_func_from_unixtime :public Item_datetimefunc
static LEX_CSTRING name= {STRING_WITH_LEN("from_unixtime") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
bool check_vcol_func_processor(void *arg) override
{
@@ -1089,9 +1089,9 @@ class Item_func_convert_tz :public Item_datetimefunc
static LEX_CSTRING name= {STRING_WITH_LEN("convert_tz") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- fix_attributes_datetime(args[0]->datetime_precision(current_thd));
+ fix_attributes_datetime(args[0]->datetime_precision(thd));
set_maybe_null();
return FALSE;
}
@@ -1109,7 +1109,7 @@ class Item_func_sec_to_time :public Item_timefunc
public:
Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
fix_attributes_time(args[0]->decimals);
set_maybe_null();
@@ -1139,7 +1139,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("date_add_interval") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override;
void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return INTERVAL_PRECEDENCE; }
@@ -1205,7 +1205,7 @@ class Item_extract :public Item_int_func,
return name;
}
bool check_arguments() const override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override;
void print(String *str, enum_query_type query_type) override;
bool check_partition_func_processor(void *int_arg) override {return FALSE;}
@@ -1292,7 +1292,7 @@ public:
void fix_length_and_dec_numeric();
void fix_length_and_dec_str();
void fix_length_and_dec_native_to_binary(uint32 octet_length);
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this);
}
@@ -1335,7 +1335,7 @@ public:
print_cast_temporal(str, query_type);
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this);
}
@@ -1359,7 +1359,7 @@ public:
print_cast_temporal(str, query_type);
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return args[0]->type_handler()->
Item_time_typecast_fix_length_and_dec(this);
@@ -1385,7 +1385,7 @@ public:
print_cast_temporal(str, query_type);
}
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
return args[0]->type_handler()->
Item_datetime_typecast_fix_length_and_dec(this);
@@ -1430,9 +1430,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("timestamp") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- THD *thd= current_thd;
uint dec0= args[0]->datetime_precision(thd);
uint dec1= Interval_DDhhmmssff::fsp(thd, args[1]);
fix_attributes_datetime(MY_MAX(dec0, dec1));
@@ -1476,7 +1475,7 @@ public:
Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg)
:Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1)
{ }
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING addtime= { STRING_WITH_LEN("addtime") };
@@ -1499,9 +1498,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("timediff") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- THD *thd= current_thd;
uint dec= MY_MAX(args[0]->time_precision(thd),
args[1]->time_precision(thd));
fix_attributes_time(dec);
@@ -1524,7 +1522,7 @@ public:
Item_func_maketime(THD *thd, Item *a, Item *b, Item *c):
Item_timefunc(thd, a, b, c)
{}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
fix_attributes_time(args[2]->decimals);
set_maybe_null();
@@ -1551,7 +1549,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("microsecond") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
set_maybe_null();
@@ -1586,7 +1584,7 @@ public:
return name;
}
longlong val_int() override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals=0;
set_maybe_null();
@@ -1616,7 +1614,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("get_format") };
return name;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
decimals=0;
@@ -1647,7 +1645,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("str_to_date") };
return name;
}
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_str_to_date>(thd, this); }
};
diff --git a/sql/item_vers.h b/sql/item_vers.h
index 7cd5d847b15..88c8cea837a 100644
--- a/sql/item_vers.h
+++ b/sql/item_vers.h
@@ -35,7 +35,7 @@ public:
bool val_bool() override;
longlong val_int() override { return val_bool(); }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
set_maybe_null();
null_value= 0;
@@ -67,7 +67,7 @@ public:
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_trt_ts>(thd, this); }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ fix_attributes_datetime(decimals); return FALSE; }
};
@@ -102,9 +102,9 @@ public:
return NULL_clex_str;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
- bool res= Item_int_func::fix_length_and_dec();
+ bool res= Item_int_func::fix_length_and_dec(thd);
max_length= 20;
return res;
}
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 4fef4fa10b2..5438cade27a 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -126,7 +126,7 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
with_flags= (with_flags & ~item_with_t::SUM_FUNC) | item_with_t::WINDOW_FUNC;
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
return TRUE;
max_length= window_func()->max_length;
@@ -352,7 +352,7 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
with_flags|= args[i]->with_flags;
}
- if (fix_length_and_dec())
+ if (fix_length_and_dec(thd))
return TRUE;
setup_hybrid(thd, args[0]);
@@ -368,7 +368,7 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
}
-bool Item_sum_hybrid_simple::fix_length_and_dec()
+bool Item_sum_hybrid_simple::fix_length_and_dec(THD *thd)
{
set_maybe_null();
null_value= true;
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index ce9d89e62dd..0dfc683ccf1 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -317,7 +317,7 @@ class Item_sum_hybrid_simple : public Item_sum_hybrid
bool add() override;
bool fix_fields(THD *, Item **) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
void setup_hybrid(THD *thd, Item *item);
double val_real() override;
longlong val_int() override;
@@ -554,7 +554,7 @@ class Item_sum_percent_rank: public Item_sum_double,
const Type_handler *type_handler() const override
{ return &type_handler_double; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires.
@@ -644,7 +644,7 @@ class Item_sum_cume_dist: public Item_sum_double,
const Type_handler *type_handler() const override
{ return &type_handler_double; }
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires.
@@ -885,7 +885,7 @@ public:
const Type_handler *type_handler() const override
{return Type_handler_hybrid_field_type::type_handler();}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires.
@@ -1022,7 +1022,7 @@ public:
}
void update_field() override {}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires.
@@ -1373,7 +1373,7 @@ public:
void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
List<Item> &fields, uint flags) override;
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
Type_std_attributes::set(window_func());
return FALSE;
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index a130be4f973..7c209060c37 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -189,7 +189,7 @@ public:
}
return str;
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
max_length= MAX_BLOB_WIDTH;
collation.collation= pxml->charset();
@@ -469,7 +469,7 @@ public:
{
return nodeset->copy(*native_cache);
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{ max_length= MAX_BLOB_WIDTH; return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_context_cache>(thd, this); }
@@ -487,7 +487,7 @@ public:
{
return { STRING_WITH_LEN("xpath_position") };
}
- bool fix_length_and_dec() override { max_length=10; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
longlong val_int() override
{
args[0]->val_native(current_thd, &tmp_native_value);
@@ -511,7 +511,7 @@ public:
{
return { STRING_WITH_LEN("xpath_count") };
}
- bool fix_length_and_dec() override { max_length=10; return FALSE; }
+ bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
longlong val_int() override
{
uint predicate_supplied_context_size;
@@ -2766,7 +2766,7 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
}
-bool Item_xml_str_func::fix_length_and_dec()
+bool Item_xml_str_func::fix_length_and_dec(THD *thd)
{
max_length= MAX_BLOB_WIDTH;
return agg_arg_charsets_for_comparison(collation, args, arg_count);
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index e2ffe2fa630..f6e153c9451 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -118,7 +118,7 @@ public:
set_maybe_null();
}
bool fix_fields(THD *thd, Item **ref) override;
- bool fix_length_and_dec() override;
+ bool fix_length_and_dec(THD *thd) override;
bool const_item() const override
{
return const_item_cache && (!nodeset_func || nodeset_func->const_item());
diff --git a/sql/json_table.cc b/sql/json_table.cc
index 21782a9f14b..4f3cfb6b090 100644
--- a/sql/json_table.cc
+++ b/sql/json_table.cc
@@ -339,7 +339,8 @@ handle_new_nested:
while (!json_get_path_next(&m_engine, &m_cur_path))
{
- if (json_path_compare(&m_path, &m_cur_path, m_engine.value_type))
+ if (json_path_compare(&m_path, &m_cur_path, m_engine.value_type,
+ NULL))
continue;
/* path found. */
++m_ordinality_counter;
@@ -547,7 +548,7 @@ int ha_json_table::fill_column_values(THD *thd, uchar * buf, uchar *pos)
{
json_engine_t je;
json_path_step_t *cur_step;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
int not_found;
const uchar* node_start;
const uchar* node_end;
@@ -611,7 +612,8 @@ int ha_json_table::fill_column_values(THD *thd, uchar * buf, uchar *pos)
more matches for it in json and report an error if so.
*/
if (jc->m_path.types_used &
- (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD) &&
+ (JSON_PATH_WILD | JSON_PATH_DOUBLE_WILD |
+ JSON_PATH_ARRAY_RANGE) &&
(json_scan_next(&je) ||
!json_find_path(&je, &jc->m_path, &cur_step,
array_counters)))
@@ -767,7 +769,7 @@ bool Create_json_table::add_json_table_fields(THD *thd, TABLE *table,
uint fieldnr= 0;
MEM_ROOT *mem_root_save= thd->mem_root;
List_iterator_fast<Json_table_column> jc_i(jt->m_columns);
- Column_derived_attributes da(NULL);
+ Column_derived_attributes da(&my_charset_utf8mb4_general_ci);
DBUG_ENTER("add_json_table_fields");
thd->mem_root= &table->mem_root;
@@ -784,11 +786,10 @@ bool Create_json_table::add_json_table_fields(THD *thd, TABLE *table,
executing a prepared statement for the second time.
*/
sql_f->length= sql_f->char_length;
- if (!sql_f->charset)
- sql_f->charset= &my_charset_utf8mb4_general_ci;
- if (sql_f->prepare_stage1(thd, thd->mem_root, table->file,
- table->file->ha_table_flags(), &da))
+ if (sql_f->prepare_stage1(thd, thd->mem_root,
+ COLUMN_DEFINITION_TABLE_FIELD,
+ &da))
goto err_exit;
while ((jc2= it2++) != jc)
@@ -928,6 +929,19 @@ int Json_table_column::set(THD *thd, enum_type ctype, const LEX_CSTRING &path,
}
+int Json_table_column::set(THD *thd, enum_type ctype, const LEX_CSTRING &path,
+ const Lex_column_charset_collation_attrs_st &cl)
+{
+ if (cl.is_empty() || cl.is_contextually_typed_collate_default())
+ return set(thd, ctype, path, nullptr);
+
+ CHARSET_INFO *tmp;
+ if (!(tmp= cl.resolved_to_character_set(&my_charset_utf8mb4_general_ci)))
+ return 1;
+ return set(thd, ctype, path, tmp);
+}
+
+
static int print_path(String *str, const json_path_t *p)
{
return str->append('\'') ||
@@ -970,7 +984,10 @@ int Json_table_column::print(THD *thd, Field **f, String *str)
if (str->append(column_type) ||
((*f)->has_charset() && m_explicit_cs &&
(str->append(STRING_WITH_LEN(" CHARSET ")) ||
- str->append(&m_explicit_cs->cs_name))) ||
+ str->append(&m_explicit_cs->cs_name) ||
+ (Charset(m_explicit_cs).can_have_collate_clause() &&
+ (str->append(STRING_WITH_LEN(" COLLATE ")) ||
+ str->append(&m_explicit_cs->coll_name))))) ||
str->append(m_column_type == PATH ? &path : &exists_path) ||
print_path(str, &m_path))
return 1;
@@ -1338,7 +1355,6 @@ static void add_extra_deps(List<TABLE_LIST> *join_list, table_map deps)
});
if (check_stack_overrun(current_thd, STACK_MIN_SIZE , NULL))
return;
-
while ((table= li++))
{
table->dep_tables |= deps;
diff --git a/sql/json_table.h b/sql/json_table.h
index 7316edd4ee6..74c2bfc217d 100644
--- a/sql/json_table.h
+++ b/sql/json_table.h
@@ -161,6 +161,8 @@ public:
m_column_type= ctype;
}
int set(THD *thd, enum_type ctype, const LEX_CSTRING &path, CHARSET_INFO *cs);
+ int set(THD *thd, enum_type ctype, const LEX_CSTRING &path,
+ const Lex_column_charset_collation_attrs_st &cl);
Json_table_column(Create_field *f, Json_table_nested_path *nest) :
m_field(f), m_nest(nest), m_explicit_cs(NULL)
{
diff --git a/sql/lex_charset.cc b/sql/lex_charset.cc
new file mode 100644
index 00000000000..b83d175307f
--- /dev/null
+++ b/sql/lex_charset.cc
@@ -0,0 +1,700 @@
+/* Copyright (c) 2021, 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
+ 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 "my_sys.h"
+#include "m_ctype.h"
+#include "lex_charset.h"
+#include "mysqld_error.h"
+
+
+static void
+raise_ER_CONFLICTING_DECLARATIONS(const char *clause1,
+ const char *name1,
+ const char *clause2,
+ const char *name2,
+ bool reverse_order)
+{
+ if (!reverse_order)
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ clause1, name1, clause2, name2);
+ else
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ clause2, name2, clause1, name1);
+}
+
+
+static void
+raise_ER_CONFLICTING_DECLARATIONS(const char *clause1,
+ const char *name1,
+ const char *name1_part2,
+ const char *clause2,
+ const char *name2,
+ bool reverse_order)
+{
+ char def[MY_CS_NAME_SIZE * 2];
+ my_snprintf(def, sizeof(def), "%s (%s)", name1, name1_part2);
+ raise_ER_CONFLICTING_DECLARATIONS(clause1, def,
+ clause2, name2,
+ reverse_order);
+}
+
+
+bool Lex_exact_charset::raise_if_not_equal(const Lex_exact_charset &rhs) const
+{
+ if (m_ci == rhs.m_ci)
+ return false;
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ "CHARACTER SET ", m_ci->cs_name.str,
+ "CHARACTER SET ", rhs.m_ci->cs_name.str);
+ return true;
+}
+
+
+bool Lex_exact_charset::
+ raise_if_not_applicable(const Lex_exact_collation &cl) const
+{
+ return Lex_exact_charset_opt_extended_collate(m_ci, false).
+ raise_if_not_applicable(cl);
+}
+
+
+bool Lex_exact_charset_opt_extended_collate::
+ raise_if_charsets_differ(const Lex_exact_charset &cs) const
+{
+ if (!my_charset_same(m_ci, cs.charset_info()))
+ {
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ "CHARACTER SET ", m_ci->cs_name.str,
+ "CHARACTER SET ", cs.charset_info()->cs_name.str);
+ return true;
+ }
+ return false;
+}
+
+
+bool Lex_exact_charset_opt_extended_collate::
+ raise_if_not_applicable(const Lex_exact_collation &cl) const
+{
+ if (!my_charset_same(m_ci, cl.charset_info()))
+ {
+ my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
+ cl.charset_info()->coll_name.str, m_ci->cs_name.str);
+ return true;
+ }
+ return false;
+}
+
+
+bool
+Lex_exact_collation::raise_if_not_equal(const Lex_exact_collation &cl) const
+{
+ if (m_ci != cl.m_ci)
+ {
+ my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
+ "COLLATE ", m_ci->coll_name.str,
+ "COLLATE ", cl.m_ci->coll_name.str);
+ return true;
+ }
+ return false;
+}
+
+
+/*
+ Merge an exact collation and a contexual collation.
+ @param cl - The contextual collation to merge to "this".
+ @param reverse_order - If the contextual collation is on the left side
+
+ Use reverse_order as follows:
+ false: COLLATE latin1_swedish_ci COLLATE DEFAULT
+ true: COLLATE DEFAULT COLLATE latin1_swedish_ci
+*/
+bool
+Lex_exact_collation::
+ raise_if_conflicts_with_context_collation(const Lex_context_collation &cl,
+ bool reverse_order) const
+{
+ if (cl.is_contextually_typed_collate_default() &&
+ !(m_ci->state & MY_CS_PRIMARY))
+ {
+ raise_ER_CONFLICTING_DECLARATIONS("COLLATE ", m_ci->coll_name.str,
+ "COLLATE ", "DEFAULT", reverse_order);
+ return true;
+ }
+
+ if (cl.is_contextually_typed_binary_style() &&
+ !(m_ci->state & MY_CS_BINSORT))
+ {
+ raise_ER_CONFLICTING_DECLARATIONS("COLLATE ", m_ci->coll_name.str,
+ "", "BINARY", reverse_order);
+ return true;
+ }
+ return false;
+}
+
+
+bool
+Lex_context_collation::raise_if_not_equal(const Lex_context_collation &cl) const
+{
+ /*
+ Only equal context collations are possible here so far:
+ - Column grammar only supports BINARY, but does not support COLLATE DEFAULT
+ - DB/Table grammar only support COLLATE DEFAULT
+ But we'll have different collations here - uca140 is coming soon.
+ */
+ DBUG_ASSERT(m_ci == cl.m_ci);
+ return false;
+}
+
+
+/*
+ Resolve a context collation to the character set (when the former gets known):
+ CREATE TABLE t1 (a CHAR(10) BINARY) CHARACTER SET latin1;
+ CREATE DATABASE db1 COLLATE DEFAULT CHARACTER SET latin1;
+*/
+bool Lex_exact_charset_opt_extended_collate::
+ merge_context_collation_override(const Lex_context_collation &cl)
+{
+ DBUG_ASSERT(m_ci);
+
+ // CHAR(10) BINARY
+ if (cl.is_contextually_typed_binary_style())
+ {
+ CHARSET_INFO *ci= find_bin_collation();
+ if (!ci)
+ return true;
+ m_ci= ci;
+ m_with_collate= true;
+ return false;
+ }
+
+ // COLLATE DEFAULT
+ if (cl.is_contextually_typed_collate_default())
+ {
+ CHARSET_INFO *ci= find_default_collation();
+ DBUG_ASSERT(ci);
+ if (!ci)
+ return true;
+ m_ci= ci;
+ m_with_collate= true;
+ return false;
+ }
+
+ /*
+ A non-binary and non-default contextually typed collation.
+ We don't have such yet - the parser cannot produce this.
+ But we have "uca1400_as_ci" coming soon.
+ */
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+bool Lex_extended_collation_st::merge_exact_charset(const Lex_exact_charset &cs)
+{
+ switch (m_type) {
+ case TYPE_EXACT:
+ {
+ // COLLATE latin1_swedish_ci .. CHARACTER SET latin1
+ return cs.raise_if_not_applicable(Lex_exact_collation(m_ci));
+ }
+ case TYPE_CONTEXTUALLY_TYPED:
+ {
+ // COLLATE DEFAULT .. CHARACTER SET latin1
+ Lex_exact_charset_opt_extended_collate tmp(cs);
+ if (tmp.merge_context_collation(Lex_context_collation(m_ci)))
+ return true;
+ *this= Lex_extended_collation(tmp.collation());
+ return false;
+ }
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+bool Lex_extended_collation_st::
+ merge_exact_collation(const Lex_exact_collation &rhs)
+{
+ switch (m_type) {
+
+ case TYPE_EXACT:
+ /*
+ EXACT + EXACT
+ COLLATE latin1_bin .. COLLATE latin1_bin
+ */
+ return Lex_exact_collation(m_ci).raise_if_not_equal(rhs);
+
+ case TYPE_CONTEXTUALLY_TYPED:
+ {
+ /*
+ CONTEXT + EXACT
+ CHAR(10) COLLATE DEFAULT .. COLLATE latin1_swedish_ci
+ CHAR(10) BINARY .. COLLATE latin1_bin
+ CHAR(10) COLLATE uca1400_as_ci .. COLLATE latin1_bin - coming soon
+ */
+ if (rhs.raise_if_conflicts_with_context_collation(
+ Lex_context_collation(m_ci), true))
+ return true;
+ *this= Lex_extended_collation(rhs);
+ return false;
+ }
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+bool Lex_extended_collation_st::
+ raise_if_conflicts_with_context_collation(const Lex_context_collation &rhs)
+ const
+{
+ switch (m_type) {
+
+ case TYPE_EXACT:
+ /*
+ EXACT + CONTEXT
+ COLLATE latin1_swedish_ci .. COLLATE DEFAULT
+ */
+ return Lex_exact_collation(m_ci).
+ raise_if_conflicts_with_context_collation(rhs, false);
+
+ case TYPE_CONTEXTUALLY_TYPED:
+ {
+ /*
+ CONTEXT + CONTEXT:
+ CHAR(10) BINARY .. COLLATE DEFAULT - not supported by the parser
+ CREATE DATABASE db1 COLLATE DEFAULT COLLATE DEFAULT;
+ */
+ return Lex_context_collation(m_ci).raise_if_not_equal(rhs);
+ }
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+/*
+ Merge two non-empty COLLATE clauses.
+*/
+bool Lex_extended_collation_st::merge(const Lex_extended_collation_st &rhs)
+{
+ switch (rhs.type()) {
+ case TYPE_EXACT:
+ /*
+ EXACT + EXACT
+ COLLATE latin1_swedish_ci .. COLLATE latin1_swedish_ci
+
+ CONTEXT + EXACT
+ COLLATE DEFAULT .. COLLATE latin1_swedish_ci
+ CHAR(10) BINARY .. COLLATE latin1_bin
+ */
+ return merge_exact_collation(Lex_exact_collation(rhs.m_ci));
+ case TYPE_CONTEXTUALLY_TYPED:
+ /*
+ EXACT + CONTEXT
+ COLLATE latin1_swedish_ci .. COLLATE DEFAULT
+
+ CONTEXT + CONTEXT
+ COLLATE DEFAULT .. COLLATE DEFAULT
+ CHAR(10) BINARY .. COLLATE DEFAULT
+ */
+ return raise_if_conflicts_with_context_collation(
+ Lex_context_collation(rhs.m_ci));
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+/** find a collation with binary comparison rules
+*/
+CHARSET_INFO *Lex_exact_charset_opt_extended_collate::find_bin_collation() const
+{
+ /*
+ We don't need to handle old_mode=UTF8_IS_UTF8MB3 here,
+ because "m_ci" points to a real character set name.
+ It can be either "utf8mb3" or "utf8mb4". It cannot be "utf8".
+ No thd->get_utf8_flag() flag passed to get_charset_by_csname().
+ */
+ DBUG_ASSERT(m_ci->cs_name.length !=4 || memcmp(m_ci->cs_name.str, "utf8", 4));
+ /*
+ CREATE TABLE t1 (a CHAR(10) BINARY)
+ CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+ Nothing to do, we have the binary collation already.
+ */
+ if (m_ci->state & MY_CS_BINSORT)
+ return m_ci;
+
+ // CREATE TABLE t1 (a CHAR(10) BINARY) CHARACTER SET utf8mb4;
+ CHARSET_INFO *cs;
+ if (!(cs= get_charset_by_csname(m_ci->cs_name.str, MY_CS_BINSORT, MYF(0))))
+ {
+ char tmp[65];
+ strxnmov(tmp, sizeof(tmp)-1, m_ci->cs_name.str, "_bin", NULL);
+ my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp);
+ }
+ return cs;
+}
+
+
+CHARSET_INFO *
+Lex_exact_charset_opt_extended_collate::find_default_collation() const
+{
+ // See comments in find_bin_collation()
+ DBUG_ASSERT(m_ci->cs_name.length !=4 || memcmp(m_ci->cs_name.str, "utf8", 4));
+ /*
+ CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT) CHARACTER SET utf8mb4;
+ Nothing to do, we have the default collation already.
+ */
+ if (m_ci->state & MY_CS_PRIMARY)
+ return m_ci;
+ /*
+ CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT)
+ CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
+
+ Don't need to handle old_mode=UTF8_IS_UTF8MB3 here.
+ See comments in find_bin_collation.
+ */
+ CHARSET_INFO *cs= get_charset_by_csname(m_ci->cs_name.str,
+ MY_CS_PRIMARY, MYF(MY_WME));
+ /*
+ The above should never fail, as we have default collations for
+ all character sets.
+ */
+ DBUG_ASSERT(cs);
+ return cs;
+}
+
+
+/*
+ Resolve an empty or a contextually typed collation according to the
+ upper level default character set (and optionally a collation), e.g.:
+ CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1;
+ CREATE TABLE t1 (a CHAR(10) BINARY) CHARACTER SET latin1;
+ CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT)
+ CHARACTER SET latin1 COLLATE latin1_bin;
+
+ "this" is the COLLATE clause (e.g. of a column)
+ "def" is the upper level CHARACTER SET clause (e.g. of a table)
+*/
+CHARSET_INFO *Lex_exact_charset_extended_collation_attrs_st::
+ resolved_to_character_set(CHARSET_INFO *def) const
+{
+ DBUG_ASSERT(def);
+
+ switch (m_type) {
+ case TYPE_EMPTY:
+ return def;
+ case TYPE_CHARACTER_SET:
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ case TYPE_COLLATE_EXACT:
+ DBUG_ASSERT(m_ci);
+ return m_ci;
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ {
+ Lex_exact_charset_opt_extended_collate tmp(def, true);
+ if (tmp.merge_context_collation_override(Lex_context_collation(m_ci)))
+ return NULL;
+ return tmp.collation().charset_info();
+ }
+ }
+ DBUG_ASSERT(0);
+ return NULL;
+}
+
+
+bool Lex_exact_charset_extended_collation_attrs_st::
+ merge_exact_collation(const Lex_exact_collation &cl)
+{
+ switch (m_type) {
+ case TYPE_EMPTY:
+ /*
+ No CHARACTER SET clause
+ CHAR(10) NOT NULL COLLATE latin1_bin
+ */
+ *this= Lex_exact_charset_extended_collation_attrs(cl);
+ return false;
+ case TYPE_CHARACTER_SET:
+ {
+ // CHARACTER SET latin1 .. COLLATE latin1_swedish_ci
+ Lex_exact_charset_opt_extended_collate tmp(m_ci, false);
+ if (tmp.merge_exact_collation(cl))
+ return true;
+ *this= Lex_exact_charset_extended_collation_attrs(tmp);
+ return false;
+ }
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ case TYPE_COLLATE_EXACT:
+ {
+ // [CHARACTER SET latin1] COLLATE latin1_bin .. COLLATE latin1_bin
+ return Lex_exact_collation(m_ci).raise_if_not_equal(cl);
+ }
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ {
+ // COLLATE DEFAULT .. COLLATE latin1_swedish_ci
+ if (cl.raise_if_conflicts_with_context_collation(
+ Lex_context_collation(m_ci), true))
+ return true;
+ *this= Lex_exact_charset_extended_collation_attrs(cl);
+ return false;
+ }
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+bool Lex_exact_charset_extended_collation_attrs_st::
+ merge_context_collation(const Lex_context_collation &cl)
+{
+ switch (m_type) {
+ case TYPE_EMPTY:
+ /*
+ No CHARACTER SET clause
+ CHAR(10) NOT NULL .. COLLATE DEFAULT
+ */
+ *this= Lex_exact_charset_extended_collation_attrs(cl);
+ return false;
+ case TYPE_CHARACTER_SET:
+ {
+ // CHARACTER SET latin1 .. COLLATE DEFAULT
+ Lex_exact_charset_opt_extended_collate tmp(m_ci, false);
+ if (tmp.merge_context_collation(cl))
+ return true;
+ *this= Lex_exact_charset_extended_collation_attrs(tmp);
+ return false;
+ }
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ case TYPE_COLLATE_EXACT:
+ // [CHARACTER SET latin1] COLLATE latin1_swedish_ci .. COLLATE DEFAULT
+ return Lex_exact_collation(m_ci).
+ raise_if_conflicts_with_context_collation(cl, false);
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ // COLLATE DEFAULT .. COLLATE DEFAULT
+ return Lex_context_collation(m_ci).raise_if_not_equal(cl);
+ }
+
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+bool Lex_exact_charset_opt_extended_collate::
+ merge_exact_collation(const Lex_exact_collation &cl)
+{
+ // CHARACTER SET latin1 [COLLATE latin1_bin] .. COLLATE latin1_bin
+ if (m_with_collate)
+ return Lex_exact_collation(m_ci).raise_if_not_equal(cl);
+ if (raise_if_not_applicable(cl))
+ return true;
+ *this= Lex_exact_charset_opt_extended_collate(cl);
+ return false;
+}
+
+
+bool Lex_exact_charset_opt_extended_collate::
+ merge_context_collation(const Lex_context_collation &cl)
+{
+ // CHARACTER SET latin1 [COLLATE latin1_bin] .. COLLATE DEFAULT
+ if (m_with_collate)
+ return Lex_exact_collation(m_ci).
+ raise_if_conflicts_with_context_collation(cl, false);
+ return merge_context_collation_override(cl);
+}
+
+
+bool Lex_exact_charset_extended_collation_attrs_st::
+ merge_collation(const Lex_extended_collation_st &cl)
+{
+ switch (cl.type()) {
+ case Lex_extended_collation_st::TYPE_EXACT:
+ return merge_exact_collation(Lex_exact_collation(cl.charset_info()));
+ case Lex_extended_collation_st::TYPE_CONTEXTUALLY_TYPED:
+ return merge_context_collation(Lex_context_collation(cl.charset_info()));
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+/*
+ Mix an unordered combination of CHARACTER SET and COLLATE clauses
+ (i.e. COLLATE can come before CHARACTER SET).
+ Merge a CHARACTER SET clause.
+ @param cs - The "CHARACTER SET exact_charset_name".
+*/
+bool Lex_exact_charset_extended_collation_attrs_st::
+ merge_exact_charset(const Lex_exact_charset &cs)
+{
+ DBUG_ASSERT(cs.charset_info());
+
+ switch (m_type) {
+ case TYPE_EMPTY:
+ // CHARACTER SET cs
+ *this= Lex_exact_charset_extended_collation_attrs(cs);
+ return false;
+
+ case TYPE_CHARACTER_SET:
+ // CHARACTER SET cs1 .. CHARACTER SET cs2
+ return Lex_exact_charset(m_ci).raise_if_not_equal(cs);
+
+ case TYPE_COLLATE_EXACT:
+ // COLLATE latin1_bin .. CHARACTER SET cs
+ if (cs.raise_if_not_applicable(Lex_exact_collation(m_ci)))
+ return true;
+ m_type= TYPE_CHARACTER_SET_COLLATE_EXACT;
+ return false;
+
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ // CHARACTER SET cs1 COLLATE cl .. CHARACTER SET cs2
+ return Lex_exact_charset_opt_extended_collate(m_ci, true).
+ raise_if_charsets_differ(cs);
+
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ // COLLATE DEFAULT .. CHARACTER SET cs
+ {
+ Lex_exact_charset_opt_extended_collate tmp(cs);
+ if (tmp.merge_context_collation(Lex_context_collation(m_ci)))
+ return true;
+ *this= Lex_exact_charset_extended_collation_attrs(tmp);
+ return false;
+ }
+ }
+ DBUG_ASSERT(0);
+ return false;
+}
+
+
+bool Lex_extended_charset_extended_collation_attrs_st::merge_charset_default()
+{
+ if (m_charset_order == CHARSET_TYPE_EMPTY)
+ m_charset_order= CHARSET_TYPE_CONTEXT;
+ Lex_opt_context_charset_st::merge_charset_default();
+ return false;
+}
+
+
+bool Lex_extended_charset_extended_collation_attrs_st::
+ merge_exact_charset(const Lex_exact_charset &cs)
+{
+ if (m_charset_order == CHARSET_TYPE_EMPTY)
+ m_charset_order= CHARSET_TYPE_EXACT;
+ return Lex_exact_charset_extended_collation_attrs_st::merge_exact_charset(cs);
+}
+
+
+bool Lex_extended_charset_extended_collation_attrs_st::
+ raise_if_charset_conflicts_with_default(
+ const Lex_exact_charset_opt_extended_collate &def) const
+{
+ DBUG_ASSERT(m_charset_order != CHARSET_TYPE_EMPTY || is_empty());
+ if (!my_charset_same(def.collation().charset_info(), m_ci))
+ {
+ raise_ER_CONFLICTING_DECLARATIONS("CHARACTER SET ", "DEFAULT",
+ def.collation().charset_info()->cs_name.str,
+ "CHARACTER SET ", m_ci->cs_name.str,
+ m_charset_order == CHARSET_TYPE_EXACT);
+ return true;
+ }
+ return false;
+}
+
+
+CHARSET_INFO *
+Lex_extended_charset_extended_collation_attrs_st::
+ resolved_to_context(const Charset_collation_context &ctx) const
+{
+ if (Lex_opt_context_charset_st::is_empty())
+ {
+ // Without CHARACTER SET DEFAULT
+ return Lex_exact_charset_extended_collation_attrs_st::
+ resolved_to_character_set(ctx.collate_default().charset_info());
+ }
+
+ // With CHARACTER SET DEFAULT
+ switch (type()) {
+ case TYPE_EMPTY:
+ // CHARACTER SET DEFAULT;
+ return ctx.charset_default().charset().charset_info();
+
+ case TYPE_CHARACTER_SET:
+ // CHARACTER SET DEFAULT CHARACTER SET cs_exact
+ if (raise_if_charset_conflicts_with_default(ctx.charset_default()))
+ {
+ /*
+ A possible scenario:
+ SET character_set_server=utf8mb4;
+ CREATE DATABASE db1 CHARACTER SET latin1 CHARACTER SET DEFAULT;
+ */
+ return NULL;
+ }
+ return m_ci;
+
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ case TYPE_COLLATE_EXACT:
+ {
+ /*
+ CREATE DATABASE db1
+ COLLATE cl_exact
+ [ CHARACTER SET cs_exact ]
+ CHARACTER SET DEFAULT;
+ */
+ if (m_type == TYPE_CHARACTER_SET_COLLATE_EXACT &&
+ raise_if_charset_conflicts_with_default(ctx.charset_default()))
+ {
+ /*
+ A possible scenario:
+ SET character_set_server=utf8mb4;
+ CREATE DATABASE db1
+ COLLATE latin1_bin
+ CHARACTER SET latin1
+ CHARACTER SET DEFAULT;
+ */
+ return NULL;
+ }
+ /*
+ Now check that "COLLATE cl_exact" does not conflict with
+ CHARACTER SET DEFAULT.
+ */
+ if (ctx.charset_default().
+ raise_if_not_applicable(Lex_exact_collation(m_ci)))
+ {
+ /*
+ A possible scenario:
+ SET character_set_server=utf8mb4;
+ CREATE DATABASE db1
+ COLLATE latin1_bin
+ CHARACTER SET DEFAULT;
+ */
+ return NULL;
+ }
+ return m_ci;
+ }
+
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ /*
+ Both CHARACTER SET and COLLATE are contextual:
+ ALTER DATABASE db1 CHARACTER SET DEFAULT COLLATE DEFAULT;
+ ALTER DATABASE db1 COLLATE DEFAULT CHARACTER SET DEFAULT;
+ */
+ return Lex_exact_charset_extended_collation_attrs_st::
+ resolved_to_character_set(ctx.charset_default().
+ collation().charset_info());
+ }
+ DBUG_ASSERT(0);
+ return NULL;
+}
diff --git a/sql/lex_charset.h b/sql/lex_charset.h
new file mode 100644
index 00000000000..d8d4422b34f
--- /dev/null
+++ b/sql/lex_charset.h
@@ -0,0 +1,642 @@
+/* Copyright (c) 2021, 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
+
+#ifndef LEX_CHARSET_INCLUDED
+#define LEX_CHARSET_INCLUDED
+
+
+/*
+ An exact character set, e.g:
+ CHARACTER SET latin1
+*/
+class Lex_exact_charset
+{
+ CHARSET_INFO *m_ci;
+public:
+ explicit Lex_exact_charset(CHARSET_INFO *ci)
+ :m_ci(ci)
+ {
+ DBUG_ASSERT(m_ci);
+ DBUG_ASSERT(m_ci->state & MY_CS_PRIMARY);
+ }
+ CHARSET_INFO *charset_info() const { return m_ci; }
+ bool raise_if_not_equal(const Lex_exact_charset &rhs) const;
+ bool raise_if_not_applicable(const class Lex_exact_collation &cl) const;
+};
+
+
+/*
+ An optional contextually typed character set:
+ [ CHARACTER SET DEFAULT ]
+*/
+class Lex_opt_context_charset_st
+{
+ /*
+ Currently we support only DEFAULT as a possible value.
+ So "bool" is enough.
+ */
+ bool m_had_charset_default;
+public:
+ void init()
+ {
+ m_had_charset_default= false;
+ }
+ void merge_charset_default()
+ {
+ /*
+ Ok to specify CHARACTER SET DEFAULT multiple times.
+ No error raised here.
+ */
+ m_had_charset_default= true;
+ }
+ bool is_empty() const
+ {
+ return !m_had_charset_default;
+ }
+ bool is_contextually_typed_charset_default() const
+ {
+ return m_had_charset_default;
+ }
+};
+
+
+/*
+ A contextually typed collation, e.g.:
+ COLLATE DEFAULT
+ CHAR(10) BINARY
+*/
+class Lex_context_collation
+{
+ CHARSET_INFO *m_ci;
+public:
+ explicit Lex_context_collation(CHARSET_INFO *ci)
+ :m_ci(ci)
+ {
+ DBUG_ASSERT(ci);
+ }
+ CHARSET_INFO *charset_info() const { return m_ci; }
+ bool is_contextually_typed_collate_default() const
+ {
+ return m_ci == &my_collation_contextually_typed_default;
+ }
+ bool is_contextually_typed_binary_style() const
+ {
+ return m_ci == &my_collation_contextually_typed_binary;
+ }
+ bool raise_if_not_equal(const Lex_context_collation &cl) const;
+};
+
+
+/*
+ An exact collation, e.g.
+ COLLATE latin1_swedish_ci
+*/
+class Lex_exact_collation
+{
+ CHARSET_INFO *m_ci;
+public:
+ explicit Lex_exact_collation(CHARSET_INFO *ci)
+ :m_ci(ci)
+ {
+ DBUG_ASSERT(ci);
+ }
+ CHARSET_INFO *charset_info() const { return m_ci; }
+ // EXACT + EXACT
+ bool raise_if_not_equal(const Lex_exact_collation &cl) const;
+ // EXACT + CONTEXT
+ // CONTEXT + EXACT
+ bool raise_if_conflicts_with_context_collation(const Lex_context_collation &,
+ bool reverse_order) const;
+};
+
+
+/*
+ Parse time COLLATE clause:
+ COLLATE colation_name
+ The collation can be either exact or contextual:
+ COLLATE latin1_bin
+ COLLATE DEFAULT
+*/
+class Lex_extended_collation_st
+{
+public:
+ enum Type
+ {
+ TYPE_EXACT,
+ TYPE_CONTEXTUALLY_TYPED
+ };
+protected:
+ CHARSET_INFO *m_ci;
+ Type m_type;
+public:
+ void init(CHARSET_INFO *ci, Type type)
+ {
+ m_ci= ci;
+ m_type= type;
+ }
+ CHARSET_INFO *charset_info() const { return m_ci; }
+ Type type() const { return m_type; }
+ void set_collate_default()
+ {
+ m_ci= &my_collation_contextually_typed_default;
+ m_type= TYPE_CONTEXTUALLY_TYPED;
+ }
+ bool raise_if_conflicts_with_context_collation(const Lex_context_collation &)
+ const;
+ bool merge_exact_charset(const Lex_exact_charset &rhs);
+ bool merge_exact_collation(const Lex_exact_collation &rhs);
+ bool merge(const Lex_extended_collation_st &rhs);
+};
+
+
+class Lex_extended_collation: public Lex_extended_collation_st
+{
+public:
+ Lex_extended_collation(CHARSET_INFO *ci, Type type)
+ {
+ init(ci, type);
+ }
+ Lex_extended_collation(const Lex_exact_collation &rhs)
+ {
+ init(rhs.charset_info(), TYPE_EXACT);
+ }
+};
+
+
+/*
+ CHARACTER SET cs_exact [COLLATE cl_exact_or_context]
+*/
+class Lex_exact_charset_opt_extended_collate
+{
+ CHARSET_INFO *m_ci;
+ bool m_with_collate;
+public:
+ Lex_exact_charset_opt_extended_collate(CHARSET_INFO *ci, bool with_collate)
+ :m_ci(ci), m_with_collate(with_collate)
+ {
+ DBUG_ASSERT(m_ci);
+ DBUG_ASSERT((m_ci->state & MY_CS_PRIMARY) || m_with_collate);
+ }
+ Lex_exact_charset_opt_extended_collate(const Lex_exact_charset &cs)
+ :m_ci(cs.charset_info()), m_with_collate(false)
+ {
+ DBUG_ASSERT(m_ci);
+ DBUG_ASSERT(m_ci->state & MY_CS_PRIMARY);
+ }
+ Lex_exact_charset_opt_extended_collate(const Lex_exact_collation &cl)
+ :m_ci(cl.charset_info()), m_with_collate(true)
+ {
+ DBUG_ASSERT(m_ci);
+ }
+ bool with_collate() const { return m_with_collate; }
+ CHARSET_INFO *find_bin_collation() const;
+ CHARSET_INFO *find_default_collation() const;
+ bool raise_if_charsets_differ(const Lex_exact_charset &cs) const;
+ bool raise_if_not_applicable(const Lex_exact_collation &cl) const;
+ /*
+ Add another COLLATE clause (exact or context).
+ So the full syntax looks like:
+ CHARACTER SET cs [COLLATE cl] ... COLLATE cl2
+ */
+ bool merge_collation(const Lex_extended_collation_st &cl)
+ {
+ switch (cl.type()) {
+ case Lex_extended_collation_st::TYPE_EXACT:
+ return merge_exact_collation(Lex_exact_collation(cl.charset_info()));
+ case Lex_extended_collation_st::TYPE_CONTEXTUALLY_TYPED:
+ return merge_context_collation(Lex_context_collation(cl.charset_info()));
+ }
+ DBUG_ASSERT(0);
+ return false;
+ }
+ /*
+ Add a context collation:
+ CHARACTER SET cs [COLLATE cl] ... COLLATE DEFAULT
+ */
+ bool merge_context_collation(const Lex_context_collation &cl);
+ bool merge_context_collation_override(const Lex_context_collation &cl);
+ /*
+ Add an exact collation:
+ CHARACTER SET cs [COLLATE cl] ... COLLATE latin1_bin
+ */
+ bool merge_exact_collation(const Lex_exact_collation &cl);
+ Lex_exact_collation collation() const
+ {
+ return Lex_exact_collation(m_ci);
+ }
+ Lex_exact_charset charset() const
+ {
+ if ((m_ci->state & MY_CS_PRIMARY))
+ return Lex_exact_charset(m_ci);
+ return Lex_exact_charset(find_default_collation());
+ }
+};
+
+
+/*
+ Parse time character set and collation for:
+ [CHARACTER SET cs_exact] [COLLATE cl_exact_or_context]
+
+ Can be:
+
+ 1. Empty (not specified on the column level):
+ CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin2; -- (1a)
+ CREATE TABLE t1 (a CHAR(10)); -- (1b)
+
+ 2. Precisely typed:
+ CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin); -- (2a)
+ CREATE TABLE t1 (
+ a CHAR(10) CHARACTER SET latin1 COLLATE latin1_bin); -- (2b)
+
+ 3. Contextually typed:
+ CREATE TABLE t2 (a CHAR(10) BINARY) CHARACTER SET latin2; -- (3a)
+ CREATE TABLE t2 (a CHAR(10) BINARY); -- (3b)
+ CREATE TABLE t2 (a CHAR(10) COLLATE DEFAULT)
+ CHARACER SET latin2 COLLATE latin2_bin; -- (3c)
+
+ In case of an empty or a contextually typed collation,
+ it is a subject to later resolution, when the context
+ character set becomes known in the end of the CREATE statement:
+ - either after the explicit table level CHARACTER SET, like in (1a,3a,3c)
+ - or by the inhereted database level CHARACTER SET, like in (1b,3b)
+
+ Resolution happens in Type_handler::Column_definition_prepare_stage1().
+*/
+struct Lex_exact_charset_extended_collation_attrs_st
+{
+public:
+ enum Type
+ {
+ TYPE_EMPTY= 0,
+ TYPE_CHARACTER_SET= 1,
+ TYPE_COLLATE_EXACT= 2,
+ TYPE_CHARACTER_SET_COLLATE_EXACT= 3,
+ TYPE_COLLATE_CONTEXTUALLY_TYPED= 4
+ };
+
+// Number of bits required to store enum Type values
+
+#define LEX_CHARSET_COLLATION_TYPE_BITS 3
+#define LEX_CHARSET_COLLATION_TYPE_MASK ((1<<LEX_CHARSET_COLLATION_TYPE_BITS)-1)
+
+ static_assert(LEX_CHARSET_COLLATION_TYPE_MASK >=
+ TYPE_COLLATE_CONTEXTUALLY_TYPED,
+ "Lex_exact_charset_extended_collation_attrs_st::Type bits");
+
+protected:
+ CHARSET_INFO *m_ci;
+ Type m_type;
+protected:
+ static Type type_from_lex_collation_type(Lex_extended_collation_st::Type type)
+ {
+ switch (type) {
+ case Lex_extended_collation_st::TYPE_EXACT:
+ return TYPE_COLLATE_EXACT;
+ case Lex_extended_collation_st::TYPE_CONTEXTUALLY_TYPED:
+ return TYPE_COLLATE_CONTEXTUALLY_TYPED;
+ }
+ DBUG_ASSERT(0);
+ return TYPE_COLLATE_EXACT;
+ }
+public:
+ void init()
+ {
+ m_ci= NULL;
+ m_type= TYPE_EMPTY;
+ }
+ void init(CHARSET_INFO *cs, Type type)
+ {
+ DBUG_ASSERT(cs || type == TYPE_EMPTY);
+ m_ci= cs;
+ m_type= type;
+ }
+ void init(const Lex_exact_charset &cs)
+ {
+ m_ci= cs.charset_info();
+ m_type= TYPE_CHARACTER_SET;
+ }
+ void init(const Lex_exact_collation &cs)
+ {
+ m_ci= cs.charset_info();
+ m_type= TYPE_COLLATE_EXACT;
+ }
+ void init(const Lex_exact_charset_opt_extended_collate &cscl)
+ {
+ if (cscl.with_collate())
+ init(cscl.collation().charset_info(), TYPE_CHARACTER_SET_COLLATE_EXACT);
+ else
+ init(cscl.charset());
+ }
+ bool is_empty() const
+ {
+ return m_type == TYPE_EMPTY;
+ }
+ void set_charset(const Lex_exact_charset &cs)
+ {
+ m_ci= cs.charset_info();
+ m_type= TYPE_CHARACTER_SET;
+ }
+ bool set_charset_collate_default(const Lex_exact_charset &cs)
+ {
+ CHARSET_INFO *ci;
+ if (!(ci= Lex_exact_charset_opt_extended_collate(cs).
+ find_default_collation()))
+ return true;
+ m_ci= ci;
+ m_type= TYPE_CHARACTER_SET_COLLATE_EXACT;
+ return false;
+ }
+ bool set_charset_collate_binary(const Lex_exact_charset &cs)
+ {
+ CHARSET_INFO *ci;
+ if (!(ci= Lex_exact_charset_opt_extended_collate(cs).find_bin_collation()))
+ return true;
+ m_ci= ci;
+ m_type= TYPE_CHARACTER_SET_COLLATE_EXACT;
+ return false;
+ }
+ void set_collate_default()
+ {
+ m_ci= &my_collation_contextually_typed_default;
+ m_type= TYPE_COLLATE_CONTEXTUALLY_TYPED;
+ }
+ void set_contextually_typed_binary_style()
+ {
+ m_ci= &my_collation_contextually_typed_binary;
+ m_type= TYPE_COLLATE_CONTEXTUALLY_TYPED;
+ }
+ bool is_contextually_typed_collate_default() const
+ {
+ return Lex_context_collation(m_ci).is_contextually_typed_collate_default();
+ }
+ CHARSET_INFO *charset_info() const
+ {
+ return m_ci;
+ }
+ Type type() const
+ {
+ return m_type;
+ }
+ bool is_contextually_typed_collation() const
+ {
+ return m_type == TYPE_COLLATE_CONTEXTUALLY_TYPED;
+ }
+ CHARSET_INFO *resolved_to_character_set(CHARSET_INFO *cs) const;
+ /*
+ Merge the column CHARACTER SET clause to:
+ - an exact collation name
+ - a contextually typed collation
+ "this" corresponds to `CHARACTER SET xxx [BINARY]`
+ "cl" corresponds to the COLLATE clause
+ */
+ bool merge_column_charset_clause_and_collate_clause(
+ const Lex_exact_charset_extended_collation_attrs_st &cl)
+ {
+ switch (cl.type()) {
+ case TYPE_EMPTY:
+ return false;
+ case TYPE_COLLATE_EXACT:
+ return merge_exact_collation(Lex_exact_collation(cl.charset_info()));
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ case TYPE_CHARACTER_SET:
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ break;
+ }
+ DBUG_ASSERT(0);
+ return false;
+ }
+ /*
+ This method is used in the "attribute_list" rule to merge two independent
+ COLLATE clauses (not belonging to a CHARACTER SET clause).
+ "BINARY" and "COLLATE DEFAULT" are not possible
+ in an independent COLLATE clause in a column attribute.
+ */
+ bool merge_column_collate_clause_and_collate_clause(
+ const Lex_exact_charset_extended_collation_attrs_st &cl)
+ {
+ DBUG_ASSERT(m_type != TYPE_COLLATE_CONTEXTUALLY_TYPED);
+ DBUG_ASSERT(m_type != TYPE_CHARACTER_SET);
+ switch (cl.type()) {
+ case TYPE_EMPTY:
+ return false;
+ case TYPE_COLLATE_EXACT:
+ return merge_exact_collation(Lex_exact_collation(cl.charset_info()));
+ case TYPE_COLLATE_CONTEXTUALLY_TYPED:
+ case TYPE_CHARACTER_SET:
+ case TYPE_CHARACTER_SET_COLLATE_EXACT:
+ break;
+ }
+ DBUG_ASSERT(0);
+ return false;
+ }
+ bool merge_exact_charset(const Lex_exact_charset &cs);
+ bool merge_exact_collation(const Lex_exact_collation &cl);
+ bool merge_context_collation(const Lex_context_collation &cl);
+ bool merge_collation(const Lex_extended_collation_st &cl);
+};
+
+
+class Charset_collation_context
+{
+ /*
+ Although the goal of m_charset_default is to store the meaning
+ of CHARACTER SET DEFAULT, it does not necessarily point to a
+ default collation of CHARACTER SET DEFAULT. It can point to its any
+ arbitrary collation.
+ For performance purposes we don't need to find the default
+ collation at the instantiation time of "this", because:
+ - m_charset_default may not be even needed during the resolution
+ - when it's needed, in many cases it's passed to my_charset_same(),
+ which does not need the default collation again.
+
+ Note, m_charset_default and m_collate_default are not necessarily equal.
+
+ - The default value for CHARACTER SET is taken from the upper level:
+ CREATE DATABASE db1 CHARACTER SET DEFAULT; <-- @@character_set_server
+ ALTER DATABASE db1 CHARACTER SET DEFAULT; <-- @@character_set_server
+
+ - The default value for COLLATE is taken from the upper level for CREATE:
+ CREATE DATABASE db1 COLLATE DEFAULT; <-- @@collation_server
+ CREATE TABLE db1.t1 COLLATE DEFAULT; <-- character set of "db1"
+
+ - The default value for COLLATE is taken from the same level for ALTER:
+ ALTER DATABASE db1 COLLATE DEFAULT; <-- the default collation of the
+ current db1 character set
+ ALTER TABLE db1.t1 COLLATE DEFAULT; <-- the default collation of the
+ current db1.t1 character set
+ */
+
+ // comes from the upper level
+ Lex_exact_charset_opt_extended_collate m_charset_default;
+
+ // comes from the upper or the current level
+ Lex_exact_collation m_collate_default;
+public:
+ Charset_collation_context(CHARSET_INFO *charset_default,
+ CHARSET_INFO *collate_default)
+ :m_charset_default(charset_default,
+ !(charset_default->state & MY_CS_PRIMARY)),
+ m_collate_default(collate_default)
+ { }
+ const Lex_exact_charset_opt_extended_collate charset_default() const
+ {
+ return m_charset_default;
+ }
+ const Lex_exact_collation collate_default() const
+ {
+ return m_collate_default;
+ }
+};
+
+
+/*
+ A universal container. It can store at the same time:
+ - CHARACTER SET DEFAULT
+ - CHARACTER SET cs_exact
+ - COLLATE {cl_exact|cl_context}
+ All three parts can co-exist.
+ All three parts are optional.
+ Parts can come in any arbitrary order, e.g:
+
+ CHARACTER SET DEFAULT [CHARACTER SET latin1] COLLATE latin1_bin
+ CHARACTER SET latin1 CHARACTER SET DEFAULT COLLATE latin1_bin
+ COLLATE latin1_bin [CHARACTER SET latin1] CHARACTER SET DEFAULT
+ COLLATE latin1_bin CHARACTER SET DEFAULT [CHARACTER SET latin1]
+*/
+class Lex_extended_charset_extended_collation_attrs_st:
+ public Lex_opt_context_charset_st,
+ public Lex_exact_charset_extended_collation_attrs_st
+{
+ enum charset_type_t
+ {
+ CHARSET_TYPE_EMPTY,
+ CHARSET_TYPE_CONTEXT,
+ CHARSET_TYPE_EXACT
+ };
+ /*
+ Which part came first:
+ - CHARACTER SET DEFAULT or
+ - CHARACTER SET cs_exact
+ e.g. to produce error messages preserving the user typed
+ order of CHARACTER SET clauses in case of conflicts.
+ */
+ charset_type_t m_charset_order;
+public:
+ void init()
+ {
+ Lex_opt_context_charset_st::init();
+ Lex_exact_charset_extended_collation_attrs_st::init();
+ m_charset_order= CHARSET_TYPE_EMPTY;
+ }
+ void init(const Lex_exact_charset_opt_extended_collate &c)
+ {
+ Lex_opt_context_charset_st::init();
+ Lex_exact_charset_extended_collation_attrs_st::init(c);
+ m_charset_order= CHARSET_TYPE_EXACT;
+ }
+ bool is_empty() const
+ {
+ return Lex_opt_context_charset_st::is_empty() &&
+ Lex_exact_charset_extended_collation_attrs_st::is_empty();
+ }
+ bool raise_if_charset_conflicts_with_default(
+ const Lex_exact_charset_opt_extended_collate &def) const;
+ CHARSET_INFO *resolved_to_context(const Charset_collation_context &ctx) const;
+ bool merge_charset_default();
+ bool merge_exact_charset(const Lex_exact_charset &cs);
+};
+
+
+class Lex_exact_charset_extended_collation_attrs:
+ public Lex_exact_charset_extended_collation_attrs_st
+{
+public:
+ Lex_exact_charset_extended_collation_attrs()
+ {
+ init();
+ }
+ Lex_exact_charset_extended_collation_attrs(CHARSET_INFO *collation, Type type)
+ {
+ init(collation, type);
+ }
+ explicit
+ Lex_exact_charset_extended_collation_attrs(const Lex_exact_charset &cs)
+ {
+ init(cs.charset_info(), TYPE_CHARACTER_SET);
+ }
+ explicit
+ Lex_exact_charset_extended_collation_attrs(const Lex_exact_collation &cl)
+ {
+ init(cl.charset_info(), TYPE_COLLATE_EXACT);
+ }
+ explicit
+ Lex_exact_charset_extended_collation_attrs(const Lex_context_collation &cl)
+ {
+ init(cl.charset_info(), TYPE_COLLATE_CONTEXTUALLY_TYPED);
+ }
+ explicit
+ Lex_exact_charset_extended_collation_attrs(
+ const Lex_exact_charset_opt_extended_collate &cscl)
+ {
+ init(cscl);
+ }
+ explicit
+ Lex_exact_charset_extended_collation_attrs(const Lex_extended_collation_st &cl)
+ {
+ init(cl.charset_info(), type_from_lex_collation_type(cl.type()));
+ }
+ static Lex_exact_charset_extended_collation_attrs national(bool bin_mod)
+ {
+ return bin_mod ?
+ Lex_exact_charset_extended_collation_attrs(&my_charset_utf8mb3_bin,
+ TYPE_COLLATE_EXACT) :
+ Lex_exact_charset_extended_collation_attrs(&my_charset_utf8mb3_general_ci,
+ TYPE_CHARACTER_SET);
+ }
+};
+
+
+class Lex_extended_charset_extended_collation_attrs:
+ public Lex_extended_charset_extended_collation_attrs_st
+{
+public:
+ Lex_extended_charset_extended_collation_attrs()
+ {
+ init();
+ }
+ explicit Lex_extended_charset_extended_collation_attrs(
+ const Lex_exact_charset_opt_extended_collate &c)
+ {
+ init(c);
+ }
+};
+
+
+
+using Lex_column_charset_collation_attrs_st =
+ Lex_exact_charset_extended_collation_attrs_st;
+
+using Lex_column_charset_collation_attrs =
+ Lex_exact_charset_extended_collation_attrs;
+
+
+using Lex_table_charset_collation_attrs_st =
+ Lex_extended_charset_extended_collation_attrs_st;
+
+using Lex_table_charset_collation_attrs =
+ Lex_extended_charset_extended_collation_attrs;
+
+
+#endif // LEX_CHARSET_INCLUDED
diff --git a/sql/lock.cc b/sql/lock.cc
index 0767b787bec..da13fff35c8 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -657,7 +657,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table)
a and b are freed with my_free()
*/
-MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b)
+MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a, MYSQL_LOCK *b, THD *thd)
{
MYSQL_LOCK *sql_lock;
TABLE **table, **end_table;
@@ -665,16 +665,28 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b)
DBUG_PRINT("enter", ("a->lock_count: %u b->lock_count: %u",
a->lock_count, b->lock_count));
- if (!(sql_lock= (MYSQL_LOCK*)
- my_malloc(key_memory_MYSQL_LOCK, sizeof(*sql_lock) +
- sizeof(THR_LOCK_DATA*)*((a->lock_count+b->lock_count)*2) +
- sizeof(TABLE*)*(a->table_count+b->table_count),MYF(MY_WME))))
- DBUG_RETURN(0); // Fatal error
+ const size_t lock_size= sizeof(*sql_lock) +
+ sizeof(THR_LOCK_DATA *) * ((a->lock_count + b->lock_count) * 2) +
+ sizeof(TABLE *) * (a->table_count + b->table_count);
+ if (thd)
+ {
+ sql_lock= (MYSQL_LOCK *) thd->alloc(lock_size);
+ if (!sql_lock)
+ DBUG_RETURN(0);
+ sql_lock->flags= GET_LOCK_ON_THD;
+ }
+ else
+ {
+ sql_lock= (MYSQL_LOCK *)
+ my_malloc(key_memory_MYSQL_LOCK, lock_size, MYF(MY_WME));
+ if (!sql_lock)
+ DBUG_RETURN(0);
+ sql_lock->flags= 0;
+ }
sql_lock->lock_count=a->lock_count+b->lock_count;
sql_lock->table_count=a->table_count+b->table_count;
sql_lock->locks=(THR_LOCK_DATA**) (sql_lock+1);
sql_lock->table=(TABLE**) (sql_lock->locks+sql_lock->lock_count*2);
- sql_lock->flags= 0;
memcpy(sql_lock->locks,a->locks,a->lock_count*sizeof(*a->locks));
memcpy(sql_lock->locks+a->lock_count,b->locks,
b->lock_count*sizeof(*b->locks));
@@ -708,8 +720,10 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b)
a->lock_count, b->lock_count);
/* Delete old, not needed locks */
- my_free(a);
- my_free(b);
+ if (!(a->flags & GET_LOCK_ON_THD))
+ my_free(a);
+ if (!(b->flags & GET_LOCK_ON_THD))
+ my_free(b);
DBUG_RETURN(sql_lock);
}
diff --git a/sql/lock.h b/sql/lock.h
index 0b23ddd3846..85a93b9a7e3 100644
--- a/sql/lock.h
+++ b/sql/lock.h
@@ -34,7 +34,7 @@ int mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
int mysql_unlock_some_tables(THD *thd, TABLE **table,uint count, uint flag);
int mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
-MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
+MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a, MYSQL_LOCK *b, THD *thd= NULL);
/* Lock based on name */
bool lock_schema_name(THD *thd, const char *db);
/* Lock based on stored routine name */
diff --git a/sql/log.cc b/sql/log.cc
index ac86441df32..f64616d4770 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -62,6 +62,7 @@
#include "wsrep_mysqld.h"
#ifdef WITH_WSREP
#include "wsrep_trans_observer.h"
+#include "wsrep_status.h"
#endif /* WITH_WSREP */
#ifdef HAVE_REPLICATION
@@ -2190,7 +2191,7 @@ inline bool is_prepared_xa(THD *thd)
/*
We flush the cache wrapped in a beging/rollback if:
. aborting a single or multi-statement transaction and;
- . the OPTION_KEEP_LOG is active or;
+ . the OPTION_BINLOG_THIS_TRX is active or;
. the format is STMT and a non-trans table was updated or;
. the format is MIXED and a temporary non-trans table was
updated or;
@@ -2201,7 +2202,7 @@ static bool trans_cannot_safely_rollback(THD *thd, bool all)
{
DBUG_ASSERT(ending_trans(thd, all));
- return ((thd->variables.option_bits & OPTION_KEEP_LOG) ||
+ return ((thd->variables.option_bits & OPTION_BINLOG_THIS_TRX) ||
(trans_has_updated_non_trans_table(thd) &&
thd->wsrep_binlog_format() == BINLOG_FORMAT_STMT) ||
(thd->transaction->all.has_modified_non_trans_temp_table() &&
@@ -2614,10 +2615,10 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
*/
if (unlikely(thd->wsrep_trx().is_streaming() ||
(trans_has_updated_non_trans_table(thd)) ||
- (thd->variables.option_bits & OPTION_KEEP_LOG)))
+ (thd->variables.option_bits & OPTION_BINLOG_THIS_TRX)))
#else
if (unlikely(trans_has_updated_non_trans_table(thd) ||
- (thd->variables.option_bits & OPTION_KEEP_LOG)))
+ (thd->variables.option_bits & OPTION_BINLOG_THIS_TRX)))
#endif /* WITH_WSREP */
{
char buf[1024];
@@ -9230,8 +9231,9 @@ void sql_perror(const char *message)
*/
bool reopen_fstreams(const char *filename, FILE *outstream, FILE *errstream)
{
- if ((outstream && !my_freopen(filename, "a", outstream)) ||
- (errstream && !my_freopen(filename, "a", errstream)))
+ static constexpr const char *mode= "a" IF_WIN("t", );
+ if ((outstream && !my_freopen(filename, mode, outstream)) ||
+ (errstream && !my_freopen(filename, mode, errstream)))
{
my_error(ER_CANT_CREATE_FILE, MYF(0), filename, errno);
return TRUE;
@@ -9373,6 +9375,16 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
fflush(stderr);
+#ifdef WITH_WSREP
+ if (level <= WARNING_LEVEL)
+ {
+ wsrep::reporter::log_level const lvl = (level <= ERROR_LEVEL ?
+ wsrep::reporter::error :
+ wsrep::reporter::warning);
+ Wsrep_status::report_log_msg(lvl, tag, tag_length, buffer, length, skr);
+ }
+#endif /* WITH_WSREP */
+
mysql_mutex_unlock(&LOCK_error_log);
DBUG_VOID_RETURN;
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 932a8d1588f..919db4cdeb5 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -4166,3 +4166,16 @@ bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file)
return (my_b_copy_all_to_file(cache, file) ||
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE));
}
+
+#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
+int Log_event::apply_event(rpl_group_info* rgi)
+{
+ int res;
+ THD_STAGE_INFO(thd, stage_apply_event);
+ rgi->current_event= this;
+ res= do_apply_event(rgi);
+ rgi->current_event= NULL;
+ THD_STAGE_INFO(thd, stage_after_apply_event);
+ return res;
+}
+#endif
diff --git a/sql/log_event.h b/sql/log_event.h
index ad575ee7244..d8f7196d4eb 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -1542,14 +1542,7 @@ public:
@see do_apply_event
*/
- int apply_event(rpl_group_info *rgi)
- {
- int res;
- THD_STAGE_INFO(thd, stage_apply_event);
- res= do_apply_event(rgi);
- THD_STAGE_INFO(thd, stage_after_apply_event);
- return res;
- }
+ int apply_event(rpl_group_info *rgi);
/**
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
index b3fca6de0ac..710b89bbb54 100644
--- a/sql/log_event_server.cc
+++ b/sql/log_event_server.cc
@@ -5847,6 +5847,18 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
lex->query_tables_last= &tables->next_global;
}
}
+
+ /*
+ It is needed to set_time():
+ 1) it continues the property that "Time" in SHOW PROCESSLIST shows how
+ much slave is behind
+ 2) it will be needed when we allow replication from a table with no
+ TIMESTAMP column to a table with one.
+ So we call set_time(), like in SBR. Presently it changes nothing.
+ 3) vers_set_hist_part() requires proper query time.
+ */
+ thd->set_time(when, when_sec_part);
+
if (unlikely(open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0)))
{
#ifdef WITH_WSREP
@@ -6024,16 +6036,6 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
which tested replicate-* rules).
*/
- /*
- It's not needed to set_time() but
- 1) it continues the property that "Time" in SHOW PROCESSLIST shows how
- much slave is behind
- 2) it will be needed when we allow replication from a table with no
- TIMESTAMP column to a table with one.
- So we call set_time(), like in SBR. Presently it changes nothing.
- */
- thd->set_time(when, when_sec_part);
-
if (m_width == table->s->fields && bitmap_is_set_all(&m_cols))
set_flags(COMPLETE_ROWS_F);
diff --git a/sql/my_apc.cc b/sql/my_apc.cc
index e0feabab8e2..9777deb399a 100644
--- a/sql/my_apc.cc
+++ b/sql/my_apc.cc
@@ -186,6 +186,10 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
}
else
{
+#ifndef DBUG_OFF
+ /* We didn't make the call, because the target is disabled */
+ n_calls_processed++;
+#endif
mysql_mutex_unlock(LOCK_thd_kill_ptr);
}
return res;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e0c830f8618..32392ab882e 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3544,6 +3544,7 @@ SHOW_VAR com_status_vars[]= {
{"show_errors", STMT_STATUS(SQLCOM_SHOW_ERRORS)},
{"show_events", STMT_STATUS(SQLCOM_SHOW_EVENTS)},
{"show_explain", STMT_STATUS(SQLCOM_SHOW_EXPLAIN)},
+ {"show_analyze", STMT_STATUS(SQLCOM_SHOW_ANALYZE)},
{"show_fields", STMT_STATUS(SQLCOM_SHOW_FIELDS)},
#ifndef DBUG_OFF
{"show_function_code", STMT_STATUS(SQLCOM_SHOW_FUNC_CODE)},
@@ -8526,6 +8527,16 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
between options, setting of multiple variables, etc.
Do them here.
*/
+
+ if (global_system_variables.old_mode)
+ {
+ global_system_variables.old_behavior|= (OLD_MODE_NO_PROGRESS_INFO |
+ OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN |
+ OLD_MODE_COMPAT_5_1_CHECKSUM);
+ sql_print_warning("--old is deprecated and will be removed in a future "
+ "release. Please use --old-mode instead. ");
+ }
+
if (global_system_variables.net_buffer_length >
global_system_variables.max_allowed_packet)
{
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 36b17e28eab..e649c83f3c9 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -904,6 +904,10 @@ enum enum_query_type
QT_NO_DATA_EXPANSION= (1 << 9),
// Remove wrappers added for TVC when creating or showing view
QT_NO_WRAPPERS_FOR_TVC_IN_VIEW= (1 << 12),
+
+ // The temporary tables used by the query might be freed by the time
+ // this print() call is made.
+ QT_DONT_ACCESS_TMP_TABLES= (1 << 13)
};
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 8bef4165878..79cf7c41bf4 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -38,6 +38,8 @@
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
+#include "sql_table.h"
+#include "transaction.h"
partition_info *partition_info::get_clone(THD *thd, bool empty_data_and_index_file)
@@ -304,13 +306,11 @@ bool partition_info::set_partition_bitmaps(List<String> *partition_names)
The external routine needing this code is check_partition_info
*/
-#define MAX_PART_NAME_SIZE 8
-
char *partition_info::create_default_partition_names(THD *thd, uint part_no,
uint num_parts_arg,
uint start_no)
{
- char *ptr= (char*) thd->calloc(num_parts_arg * MAX_PART_NAME_SIZE);
+ char *ptr= (char*) thd->calloc(num_parts_arg * MAX_PART_NAME_SIZE + 1);
char *move_ptr= ptr;
uint i= 0;
DBUG_ENTER("create_default_partition_names");
@@ -398,8 +398,6 @@ bool partition_info::set_up_default_partitions(THD *thd, handler *file,
const char *error_string;
if (part_type == RANGE_PARTITION)
error_string= "RANGE";
- else if (part_type == VERSIONING_PARTITION)
- error_string= "SYSTEM_TIME";
else
error_string= "LIST";
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), error_string);
@@ -799,18 +797,16 @@ bool partition_info::has_unique_name(partition_element *element)
vers_info->interval Limit by fixed time interval
vers_info->hist_part (out) Working history partition
*/
-int partition_info::vers_set_hist_part(THD *thd)
+bool partition_info::vers_set_hist_part(THD *thd, uint *create_count)
{
- if (!vers_require_hist_part(thd))
- return 0;
+ DBUG_ASSERT(!thd->lex->last_table() ||
+ !thd->lex->last_table()->vers_conditions.delete_history);
+
+ const bool auto_hist= create_count && vers_info->auto_hist;
- if (table->pos_in_table_list &&
- table->pos_in_table_list->partition_names)
- {
- return HA_ERR_PARTITION_LIST;
- }
if (vers_info->limit)
{
+ DBUG_ASSERT(!vers_info->interval.is_set());
ha_partition *hp= (ha_partition*)(table->file);
partition_element *next;
List_iterator<partition_element> it(partitions);
@@ -825,17 +821,23 @@ int partition_info::vers_set_hist_part(THD *thd)
vers_info->hist_part= next;
records= next_records;
}
- if (records >= vers_info->limit && next != vers_info->now_part)
- vers_info->hist_part= next;
+ if (records >= vers_info->limit)
+ {
+ if (next == vers_info->now_part)
+ {
+ if (auto_hist)
+ *create_count= 1;
+ }
+ else
+ vers_info->hist_part= next;
+ }
return 0;
}
-
- if (vers_info->interval.is_set())
+ else if (vers_info->interval.is_set() &&
+ vers_info->hist_part->range_value <= thd->query_start())
{
- if (vers_info->hist_part->range_value > thd->query_start())
- return 0;
-
partition_element *next= NULL;
+ bool error= true;
List_iterator<partition_element> it(partitions);
while (next != vers_info->hist_part)
next= it++;
@@ -844,10 +846,170 @@ int partition_info::vers_set_hist_part(THD *thd)
{
vers_info->hist_part= next;
if (next->range_value > thd->query_start())
- return 0;
+ {
+ error= false;
+ break;
+ }
+ }
+ if (error)
+ {
+ if (auto_hist)
+ {
+ *create_count= 0;
+ const my_time_t hist_end= (my_time_t) vers_info->hist_part->range_value;
+ DBUG_ASSERT(thd->query_start() >= hist_end);
+ MYSQL_TIME h0, q0;
+ my_tz_OFFSET0->gmt_sec_to_TIME(&h0, hist_end);
+ my_tz_OFFSET0->gmt_sec_to_TIME(&q0, thd->query_start());
+ longlong q= pack_time(&q0);
+ longlong h= pack_time(&h0);
+ while (h <= q)
+ {
+ if (date_add_interval(thd, &h0, vers_info->interval.type,
+ vers_info->interval.step))
+ return true;
+ h= pack_time(&h0);
+ ++*create_count;
+ if (*create_count == MAX_PARTITIONS - 2)
+ {
+ my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(ME_WARNING));
+ my_error(ER_VERS_HIST_PART_FAILED, MYF(0),
+ table->s->db.str, table->s->table_name.str);
+ return true;
+ }
+ }
+ }
+ else
+ {
+ my_error(WARN_VERS_PART_FULL, MYF(ME_WARNING|ME_ERROR_LOG),
+ table->s->db.str, table->s->table_name.str,
+ vers_info->hist_part->partition_name, "INTERVAL");
+ }
}
}
- return 0;
+
+ return false;
+}
+
+
+/**
+ @brief Run fast_alter_partition_table() to add new history partitions
+ for tables requiring them.
+
+ @param num_parts Number of partitions to create
+*/
+bool vers_create_partitions(THD *thd, TABLE_LIST* tl, uint num_parts)
+{
+ bool result= true;
+ Table_specification_st create_info;
+ Alter_info alter_info;
+ partition_info *save_part_info= thd->work_part_info;
+ Query_tables_list save_query_tables;
+ Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
+ bool save_no_write_to_binlog= thd->lex->no_write_to_binlog;
+ thd->m_reprepare_observer= NULL;
+ thd->lex->reset_n_backup_query_tables_list(&save_query_tables);
+ thd->lex->no_write_to_binlog= true;
+ TABLE *table= tl->table;
+
+ DBUG_ASSERT(!thd->is_error());
+ DBUG_ASSERT(num_parts);
+
+ {
+ DBUG_ASSERT(table->s->get_table_ref_type() == TABLE_REF_BASE_TABLE);
+ DBUG_ASSERT(table->versioned());
+ DBUG_ASSERT(table->part_info);
+ DBUG_ASSERT(table->part_info->vers_info);
+ alter_info.reset();
+ alter_info.partition_flags= ALTER_PARTITION_ADD|ALTER_PARTITION_AUTO_HIST;
+ create_info.init();
+ create_info.alter_info= &alter_info;
+ Alter_table_ctx alter_ctx(thd, tl, 1, &table->s->db, &table->s->table_name);
+
+ MDL_REQUEST_INIT(&tl->mdl_request, MDL_key::TABLE, tl->db.str,
+ tl->table_name.str, MDL_SHARED_NO_WRITE, MDL_TRANSACTION);
+ if (thd->mdl_context.acquire_lock(&tl->mdl_request,
+ thd->variables.lock_wait_timeout))
+ goto exit;
+ table->mdl_ticket= tl->mdl_request.ticket;
+
+ create_info.db_type= table->s->db_type();
+ create_info.options|= HA_VERSIONED_TABLE;
+ DBUG_ASSERT(create_info.db_type);
+
+ create_info.vers_info.set_start(table->s->vers_start_field()->field_name);
+ create_info.vers_info.set_end(table->s->vers_end_field()->field_name);
+
+ partition_info *part_info= new partition_info();
+ if (unlikely(!part_info))
+ {
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ goto exit;
+ }
+ part_info->use_default_num_partitions= false;
+ part_info->use_default_num_subpartitions= false;
+ part_info->num_parts= num_parts;
+ part_info->num_subparts= table->part_info->num_subparts;
+ part_info->subpart_type= table->part_info->subpart_type;
+ if (unlikely(part_info->vers_init_info(thd)))
+ {
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ goto exit;
+ }
+
+ thd->work_part_info= part_info;
+ if (part_info->set_up_defaults_for_partitioning(thd, table->file, NULL,
+ table->part_info->next_part_no(num_parts)))
+ {
+ my_error(ER_VERS_HIST_PART_FAILED, MYF(ME_WARNING),
+ tl->db.str, tl->table_name.str);
+ goto exit;
+ }
+ bool partition_changed= false;
+ bool fast_alter_partition= false;
+ if (prep_alter_part_table(thd, table, &alter_info, &create_info,
+ &partition_changed, &fast_alter_partition))
+ {
+ my_error(ER_VERS_HIST_PART_FAILED, MYF(ME_WARNING),
+ tl->db.str, tl->table_name.str);
+ goto exit;
+ }
+ if (!fast_alter_partition)
+ {
+ my_error(ER_VERS_HIST_PART_FAILED, MYF(ME_WARNING),
+ tl->db.str, tl->table_name.str);
+ goto exit;
+ }
+ DBUG_ASSERT(partition_changed);
+ if (mysql_prepare_alter_table(thd, table, &create_info, &alter_info,
+ &alter_ctx))
+ {
+ my_error(ER_VERS_HIST_PART_FAILED, MYF(ME_WARNING),
+ tl->db.str, tl->table_name.str);
+ goto exit;
+ }
+
+ if (fast_alter_partition_table(thd, table, &alter_info, &alter_ctx,
+ &create_info, tl))
+ {
+ my_error(ER_VERS_HIST_PART_FAILED, MYF(ME_WARNING),
+ tl->db.str, tl->table_name.str);
+ goto exit;
+ }
+ }
+
+ result= false;
+ // NOTE: we have to return DA_EMPTY for new command
+ DBUG_ASSERT(thd->get_stmt_da()->is_ok());
+ thd->get_stmt_da()->reset_diagnostics_area();
+ thd->variables.option_bits|= OPTION_BINLOG_THIS;
+
+exit:
+ thd->work_part_info= save_part_info;
+ thd->m_reprepare_observer= save_reprepare_observer;
+ thd->lex->restore_backup_query_tables_list(&save_query_tables);
+ thd->lex->no_write_to_binlog= save_no_write_to_binlog;
+ return result;
}
@@ -856,7 +1018,7 @@ int partition_info::vers_set_hist_part(THD *thd)
*/
void partition_info::vers_check_limit(THD *thd)
{
- if (!vers_info->limit ||
+ if (vers_info->auto_hist || !vers_info->limit ||
vers_info->hist_part->id + 1 < vers_info->now_part->id)
return;
@@ -2650,13 +2812,14 @@ bool partition_info::vers_init_info(THD * thd)
bool partition_info::vers_set_interval(THD* thd, Item* interval,
interval_type int_type, Item* starts,
- const char *table_name)
+ bool auto_hist, const char *table_name)
{
DBUG_ASSERT(part_type == VERSIONING_PARTITION);
MYSQL_TIME ltime;
uint err;
vers_info->interval.type= int_type;
+ vers_info->auto_hist= auto_hist;
/* 1. assign INTERVAL to interval.step */
if (interval->fix_fields_if_needed_for_scalar(thd, &interval))
@@ -2738,6 +2901,23 @@ interval_starts_error:
}
+bool partition_info::vers_set_limit(ulonglong limit, bool auto_hist,
+ const char *table_name)
+{
+ DBUG_ASSERT(part_type == VERSIONING_PARTITION);
+
+ if (limit < 1)
+ {
+ my_error(ER_PART_WRONG_VALUE, MYF(0), table_name, "LIMIT");
+ return true;
+ }
+
+ vers_info->limit= limit;
+ vers_info->auto_hist= auto_hist;
+ return !limit;
+}
+
+
bool partition_info::error_if_requires_values() const
{
switch (part_type) {
diff --git a/sql/partition_info.h b/sql/partition_info.h
index d80676057d3..833a231e6ce 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -36,23 +36,33 @@ struct st_ddl_log_memory_entry;
#define MAX_PART_NAME_SIZE 8
-
struct Vers_part_info : public Sql_alloc
{
Vers_part_info() :
limit(0),
+ auto_hist(false),
now_part(NULL),
hist_part(NULL)
{
interval.type= INTERVAL_LAST;
}
- Vers_part_info(Vers_part_info &src) :
+ Vers_part_info(const Vers_part_info &src) :
interval(src.interval),
limit(src.limit),
+ auto_hist(src.auto_hist),
now_part(NULL),
hist_part(NULL)
{
}
+ Vers_part_info& operator= (const Vers_part_info &src)
+ {
+ interval= src.interval;
+ limit= src.limit;
+ auto_hist= src.auto_hist;
+ now_part= src.now_part;
+ hist_part= src.hist_part;
+ return *this;
+ }
bool initialized()
{
if (now_part)
@@ -72,9 +82,10 @@ struct Vers_part_info : public Sql_alloc
my_time_t start;
INTERVAL step;
enum interval_type type;
- bool is_set() { return type < INTERVAL_LAST; }
+ bool is_set() const { return type < INTERVAL_LAST; }
} interval;
ulonglong limit;
+ bool auto_hist;
partition_element *now_part;
partition_element *hist_part;
};
@@ -400,19 +411,14 @@ public:
bool vers_init_info(THD *thd);
bool vers_set_interval(THD *thd, Item *interval,
interval_type int_type, Item *starts,
- const char *table_name);
- bool vers_set_limit(ulonglong limit)
- {
- DBUG_ASSERT(part_type == VERSIONING_PARTITION);
- vers_info->limit= limit;
- return !limit;
- }
+ bool auto_part, const char *table_name);
+ bool vers_set_limit(ulonglong limit, bool auto_part, const char *table_name);
+ bool vers_set_hist_part(THD* thd, uint *create_count);
bool vers_require_hist_part(THD *thd) const
{
return part_type == VERSIONING_PARTITION &&
thd->lex->vers_history_generating();
}
- int vers_set_hist_part(THD *thd);
void vers_check_limit(THD *thd);
bool vers_fix_field_list(THD *thd);
void vers_update_el_ids();
@@ -437,6 +443,7 @@ void part_type_error(THD *thd, partition_info *work_part_info,
uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
bool check_partition_dirs(partition_info *part_info);
+bool vers_create_partitions(THD* thd, TABLE_LIST* tl, uint num_parts);
/* Initialize the iterator to return a single partition with given part_id */
@@ -492,11 +499,6 @@ bool partition_info::vers_fix_field_list(THD * thd)
}
-/**
- @brief Update partition_element's id
-
- @returns true on error; false on success
-*/
inline
void partition_info::vers_update_el_ids()
{
diff --git a/sql/privilege.h b/sql/privilege.h
index 82173912e2a..9e505691736 100644
--- a/sql/privilege.h
+++ b/sql/privilege.h
@@ -634,6 +634,7 @@ constexpr privilege_t PRIV_STMT_DROP_SERVER= FEDERATED_ADMIN_ACL | SUPER_ACL;
/* Privileges related to processes */
constexpr privilege_t PRIV_COM_PROCESS_INFO= PROCESS_ACL;
+// This privilege applies both for SHOW EXPLAIN and SHOW ANALYZE
constexpr privilege_t PRIV_STMT_SHOW_EXPLAIN= PROCESS_ACL;
constexpr privilege_t PRIV_STMT_SHOW_ENGINE_STATUS= PROCESS_ACL;
constexpr privilege_t PRIV_STMT_SHOW_ENGINE_MUTEX= PROCESS_ACL;
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index f7059668b11..c4e5c75b10a 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2013, Kristian Nielsen and MariaDB Services Ab.
- Copyright (c) 2020, MariaDB Corporation.
+ Copyright (c) 2020, 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
@@ -16,6 +16,7 @@
/* Definitions for MariaDB global transaction ID (GTID). */
+#include <type_traits>
#ifndef MYSQL_CLIENT
#include "mariadb.h"
@@ -3481,32 +3482,42 @@ my_bool Window_gtid_event_filter::has_finished()
return m_has_stop ? m_has_passed : FALSE;
}
-void free_gtid_filter_element(void *p)
+void free_u32_gtid_filter_element(void *p)
{
- gtid_filter_element *gfe = (gtid_filter_element *) p;
+ gtid_filter_element<uint32> *gfe= (gtid_filter_element<uint32> *) p;
if (gfe->filter)
delete gfe->filter;
my_free(gfe);
}
-Id_delegating_gtid_event_filter::Id_delegating_gtid_event_filter()
- : m_num_stateful_filters(0), m_num_completed_filters(0)
+template <typename T>
+Id_delegating_gtid_event_filter<T>::Id_delegating_gtid_event_filter()
+ : m_num_stateful_filters(0), m_num_completed_filters(0),
+ m_id_restriction_mode(id_restriction_mode::MODE_NOT_SET)
{
+ void (*free_func)(void *);
+ if (std::is_same<T,uint32>::value)
+ free_func= free_u32_gtid_filter_element;
+ else
+ DBUG_ASSERT(0);
+
my_hash_init(PSI_INSTRUMENT_ME, &m_filters_by_id_hash, &my_charset_bin, 32,
- offsetof(gtid_filter_element, identifier),
- sizeof(gtid_filter_identifier), NULL, free_gtid_filter_element,
+ offsetof(gtid_filter_element<T>, identifier),
+ sizeof(T), NULL, free_func,
HASH_UNIQUE);
m_default_filter= new Accept_all_gtid_filter();
}
-Id_delegating_gtid_event_filter::~Id_delegating_gtid_event_filter()
+template <typename T>
+Id_delegating_gtid_event_filter<T>::~Id_delegating_gtid_event_filter()
{
my_hash_free(&m_filters_by_id_hash);
delete m_default_filter;
}
-void Id_delegating_gtid_event_filter::set_default_filter(
+template <typename T>
+void Id_delegating_gtid_event_filter<T>::set_default_filter(
Gtid_event_filter *filter)
{
if (m_default_filter)
@@ -3515,17 +3526,19 @@ void Id_delegating_gtid_event_filter::set_default_filter(
m_default_filter= filter;
}
-gtid_filter_element *
-Id_delegating_gtid_event_filter::find_or_create_filter_element_for_id(
- gtid_filter_identifier filter_id)
+template <typename T>
+gtid_filter_element<T> *
+Id_delegating_gtid_event_filter<T>::find_or_create_filter_element_for_id(
+ T filter_id)
{
- gtid_filter_element *fe= (gtid_filter_element *) my_hash_search(
- &m_filters_by_id_hash, (const uchar *) &filter_id, 0);
+ gtid_filter_element<T> *fe=
+ (gtid_filter_element<T> *) my_hash_search(
+ &m_filters_by_id_hash, (const uchar *) &filter_id, 0);
if (!fe)
{
- gtid_filter_element *new_fe= (gtid_filter_element *) my_malloc(
- PSI_NOT_INSTRUMENTED, sizeof(gtid_filter_element), MYF(MY_WME));
+ gtid_filter_element<T> *new_fe= (gtid_filter_element<T> *) my_malloc(
+ PSI_NOT_INSTRUMENTED, sizeof(gtid_filter_element<T>), MYF(MY_WME));
new_fe->filter= NULL;
new_fe->identifier= filter_id;
if (my_hash_insert(&m_filters_by_id_hash, (uchar*) new_fe))
@@ -3540,7 +3553,8 @@ Id_delegating_gtid_event_filter::find_or_create_filter_element_for_id(
return fe;
}
-my_bool Id_delegating_gtid_event_filter::has_finished()
+template <typename T>
+my_bool Id_delegating_gtid_event_filter<T>::has_finished()
{
/*
If all user-defined filters have deactivated, we are effectively
@@ -3550,11 +3564,13 @@ my_bool Id_delegating_gtid_event_filter::has_finished()
m_num_completed_filters == m_num_stateful_filters;
}
-my_bool Id_delegating_gtid_event_filter::exclude(rpl_gtid *gtid)
+template <typename T>
+my_bool Id_delegating_gtid_event_filter<T>::exclude(rpl_gtid *gtid)
{
- gtid_filter_identifier filter_id= get_id_from_gtid(gtid);
- gtid_filter_element *filter_element= (gtid_filter_element *) my_hash_search(
- &m_filters_by_id_hash, (const uchar *) &filter_id, 0);
+ T filter_id= get_id_from_gtid(gtid);
+ gtid_filter_element<T> *filter_element=
+ (gtid_filter_element<T> *) my_hash_search(&m_filters_by_id_hash,
+ (const uchar *) &filter_id, 0);
Gtid_event_filter *filter=
(filter_element ? filter_element->filter : m_default_filter);
my_bool ret= TRUE;
@@ -3574,11 +3590,120 @@ my_bool Id_delegating_gtid_event_filter::exclude(rpl_gtid *gtid)
return ret;
}
+
+template <typename F> Gtid_event_filter* create_event_filter()
+{
+ return new F();
+}
+
+template <typename T>
+int Id_delegating_gtid_event_filter<T>::set_id_restrictions(
+ T *id_list, size_t n_ids, id_restriction_mode mode)
+{
+ static const char *WHITELIST_NAME= "do", *BLACKLIST_NAME= "ignore";
+
+ size_t id_ctr;
+ int err;
+ const char *filter_name, *opposite_filter_name;
+ Gtid_event_filter *(*construct_filter)(void);
+ Gtid_event_filter *(*construct_default_filter)(void);
+
+ /*
+ Set up variables which help this filter either be in whitelist or blacklist
+ mode
+ */
+ if (mode == Gtid_event_filter::id_restriction_mode::WHITELIST_MODE)
+ {
+ filter_name= WHITELIST_NAME;
+ opposite_filter_name= BLACKLIST_NAME;
+ construct_filter=
+ create_event_filter<Accept_all_gtid_filter>;
+ construct_default_filter=
+ create_event_filter<Reject_all_gtid_filter>;
+ }
+ else
+ {
+ DBUG_ASSERT(mode ==
+ Gtid_event_filter::id_restriction_mode::BLACKLIST_MODE);
+ filter_name= BLACKLIST_NAME;
+ opposite_filter_name= WHITELIST_NAME;
+ construct_filter=
+ create_event_filter<Reject_all_gtid_filter>;
+ construct_default_filter=
+ create_event_filter<Accept_all_gtid_filter>;
+ }
+
+ if (m_id_restriction_mode !=
+ Gtid_event_filter::id_restriction_mode::MODE_NOT_SET)
+ {
+ if (mode != m_id_restriction_mode)
+ {
+ /*
+ If a rule specifying the opposite version of this has already been set,
+ error.
+ */
+ sql_print_error("Cannot create %s filtering rule for %s id because "
+ "%s rule already exists",
+ filter_name, get_id_type_name(),
+ opposite_filter_name);
+ err= 1;
+ goto err;
+ }
+
+ /* This filter is specified more than once, only use the latest values */
+ my_hash_reset(&m_filters_by_id_hash);
+ }
+
+ for (id_ctr= 0; id_ctr < n_ids; id_ctr++)
+ {
+ T filter_id= id_list[id_ctr];
+ gtid_filter_element<T> *map_element=
+ find_or_create_filter_element_for_id(filter_id);
+
+ if(map_element == NULL)
+ {
+ /*
+ If map_element is NULL, find_or_create_filter_element_for_id failed and
+ has already written the error message
+ */
+ err= 1;
+ goto err;
+ }
+ else if (map_element->filter == NULL)
+ {
+ map_element->filter= construct_filter();
+ m_num_stateful_filters++;
+ }
+ else
+ {
+ DBUG_ASSERT(map_element->filter->get_filter_type() ==
+ (mode ==
+ Gtid_event_filter::id_restriction_mode::WHITELIST_MODE
+ ? Gtid_event_filter::ACCEPT_ALL_GTID_FILTER_TYPE
+ : Gtid_event_filter::REJECT_ALL_GTID_FILTER_TYPE));
+ }
+ }
+
+ /*
+ With a whitelist, we by only want to accept the ids which are specified.
+ Everything else should be denied.
+
+ With a blacklist, we by default want to accept everything that is not
+ specified in the list
+ */
+ set_default_filter(construct_default_filter());
+ m_id_restriction_mode= mode;
+ err= 0;
+
+err:
+ return err;
+}
+
Window_gtid_event_filter *
Domain_gtid_event_filter::find_or_create_window_filter_for_id(
- uint32 domain_id)
+ decltype(rpl_gtid::domain_id) domain_id)
{
- gtid_filter_element *filter_element=
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *filter_element=
find_or_create_filter_element_for_id(domain_id);
Window_gtid_event_filter *wgef= NULL;
@@ -3607,9 +3732,11 @@ Domain_gtid_event_filter::find_or_create_window_filter_for_id(
return wgef;
}
-static my_bool check_filter_entry_validity(void *entry, void *are_filters_invalid_arg)
+static my_bool check_filter_entry_validity(void *entry,
+ void *are_filters_invalid_arg)
{
- gtid_filter_element *fe= (gtid_filter_element*) entry;
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ (gtid_filter_element<decltype(rpl_gtid::domain_id)> *) entry;
if (fe)
{
@@ -3630,7 +3757,8 @@ static my_bool check_filter_entry_validity(void *entry, void *are_filters_invali
int Domain_gtid_event_filter::validate_window_filters()
{
int are_filters_invalid= 0;
- my_hash_iterate(&m_filters_by_id_hash, check_filter_entry_validity, &are_filters_invalid);
+ my_hash_iterate(&m_filters_by_id_hash, check_filter_entry_validity,
+ &are_filters_invalid);
return are_filters_invalid;
}
@@ -3646,8 +3774,9 @@ int Domain_gtid_event_filter::add_start_gtid(rpl_gtid *gtid)
}
else if (!(err= filter_to_update->set_start_gtid(gtid)))
{
- gtid_filter_element *fe= (gtid_filter_element *) my_hash_search(
- &m_filters_by_id_hash, (const uchar *) &(gtid->domain_id), 0);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ (gtid_filter_element<decltype(rpl_gtid::domain_id)> *) my_hash_search(
+ &m_filters_by_id_hash, (const uchar *) &(gtid->domain_id), 0);
insert_dynamic(&m_start_filters, (const void *) &fe);
}
@@ -3666,8 +3795,9 @@ int Domain_gtid_event_filter::add_stop_gtid(rpl_gtid *gtid)
}
else if (!(err= filter_to_update->set_stop_gtid(gtid)))
{
- gtid_filter_element *fe= (gtid_filter_element *) my_hash_search(
- &m_filters_by_id_hash, (const uchar *) &(gtid->domain_id), 0);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ (gtid_filter_element<decltype(rpl_gtid::domain_id)> *) my_hash_search(
+ &m_filters_by_id_hash, (const uchar *) &(gtid->domain_id), 0);
insert_dynamic(&m_stop_filters, (const void *) &fe);
/*
@@ -3700,8 +3830,9 @@ rpl_gtid *Domain_gtid_event_filter::get_start_gtids()
for (i = 0; i < n_start_gtids; i++)
{
- gtid_filter_element *fe=
- *(gtid_filter_element **) dynamic_array_ptr(&m_start_filters, i);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ *(gtid_filter_element<decltype(rpl_gtid::domain_id)> **)
+ dynamic_array_ptr(&m_start_filters, i);
DBUG_ASSERT(fe->filter &&
fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE);
Window_gtid_event_filter *wgef=
@@ -3725,8 +3856,9 @@ rpl_gtid *Domain_gtid_event_filter::get_stop_gtids()
for (i = 0; i < n_stop_gtids; i++)
{
- gtid_filter_element *fe=
- *(gtid_filter_element **) dynamic_array_ptr(&m_stop_filters, i);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ *(gtid_filter_element<decltype(rpl_gtid::domain_id)> **)
+ dynamic_array_ptr(&m_stop_filters, i);
DBUG_ASSERT(fe->filter &&
fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE);
Window_gtid_event_filter *wgef=
@@ -3744,8 +3876,9 @@ void Domain_gtid_event_filter::clear_start_gtids()
uint32 i;
for (i = 0; i < get_num_start_gtids(); i++)
{
- gtid_filter_element *fe=
- *(gtid_filter_element **) dynamic_array_ptr(&m_start_filters, i);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ *(gtid_filter_element<decltype(rpl_gtid::domain_id)> **)
+ dynamic_array_ptr(&m_start_filters, i);
DBUG_ASSERT(fe->filter &&
fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE);
Window_gtid_event_filter *wgef=
@@ -3776,8 +3909,9 @@ void Domain_gtid_event_filter::clear_stop_gtids()
for (i = 0; i < get_num_stop_gtids(); i++)
{
- gtid_filter_element *fe=
- *(gtid_filter_element **) dynamic_array_ptr(&m_stop_filters, i);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *fe=
+ *(gtid_filter_element<decltype(rpl_gtid::domain_id)> **)
+ dynamic_array_ptr(&m_stop_filters, i);
DBUG_ASSERT(fe->filter &&
fe->filter->get_filter_type() == WINDOW_GTID_FILTER_TYPE);
Window_gtid_event_filter *wgef=
@@ -3823,10 +3957,10 @@ my_bool Domain_gtid_event_filter::exclude(rpl_gtid *gtid)
*/
if (get_num_stop_gtids())
{
- gtid_filter_identifier filter_id= get_id_from_gtid(gtid);
- gtid_filter_element *filter_element=
- (gtid_filter_element *) my_hash_search(&m_filters_by_id_hash,
- (const uchar *) &filter_id, 0);
+ decltype(rpl_gtid::domain_id) filter_id= get_id_from_gtid(gtid);
+ gtid_filter_element<decltype(rpl_gtid::domain_id)> *filter_element=
+ (gtid_filter_element<decltype(rpl_gtid::domain_id)> *) my_hash_search(
+ &m_filters_by_id_hash, (const uchar *) &filter_id, 0);
if (filter_element)
{
Gtid_event_filter *filter= filter_element->filter;
@@ -3841,3 +3975,52 @@ my_bool Domain_gtid_event_filter::exclude(rpl_gtid *gtid)
return include_domain ? Id_delegating_gtid_event_filter::exclude(gtid)
: TRUE;
}
+
+Intersecting_gtid_event_filter::Intersecting_gtid_event_filter(
+ Gtid_event_filter *filter1, Gtid_event_filter *filter2)
+{
+ my_init_dynamic_array(PSI_INSTRUMENT_ME, &m_filters,
+ sizeof(Gtid_event_filter *), 3, 3, MYF(0));
+ insert_dynamic(&m_filters, (void *) &filter1);
+ insert_dynamic(&m_filters, (void *) &filter2);
+}
+
+Intersecting_gtid_event_filter::~Intersecting_gtid_event_filter()
+{
+ Gtid_event_filter *tmp_filter= NULL;
+ ulong i;
+ for (i= 0; i < m_filters.elements; i++)
+ {
+ tmp_filter= *(Gtid_event_filter **) dynamic_array_ptr(&m_filters, i);
+ delete tmp_filter;
+ }
+ delete_dynamic(&m_filters);
+}
+
+my_bool Intersecting_gtid_event_filter::exclude(rpl_gtid *gtid)
+{
+ Gtid_event_filter *tmp_filter= NULL;
+ ulong i;
+ for (i= 0; i < m_filters.elements; i++)
+ {
+ tmp_filter= *(Gtid_event_filter **) dynamic_array_ptr(&m_filters, i);
+ DBUG_ASSERT(tmp_filter);
+ if (tmp_filter->exclude(gtid))
+ return TRUE;
+ }
+ return FALSE;
+}
+
+my_bool Intersecting_gtid_event_filter::has_finished()
+{
+ Gtid_event_filter *tmp_filter= NULL;
+ ulong i;
+ for (i= 0; i < m_filters.elements; i++)
+ {
+ tmp_filter= *(Gtid_event_filter **) dynamic_array_ptr(&m_filters, i);
+ DBUG_ASSERT(tmp_filter);
+ if (tmp_filter->has_finished())
+ return TRUE;
+ }
+ return FALSE;
+}
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index ffe804a8f01..8fed16543f3 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -38,9 +38,6 @@ struct rpl_gtid
uint64 seq_no;
};
-/* Data structure to help with quick lookup for filters. */
-typedef decltype(rpl_gtid::domain_id) gtid_filter_identifier;
-
inline bool operator==(const rpl_gtid& lhs, const rpl_gtid& rhs)
{
return
@@ -466,7 +463,8 @@ public:
Ensures that the expected stop GTID positions exist within the specified
binary logs.
*/
- my_bool verify_stop_state(FILE *out, rpl_gtid *stop_gtids, size_t n_stop_gtids);
+ my_bool verify_stop_state(FILE *out, rpl_gtid *stop_gtids,
+ size_t n_stop_gtids);
/*
Ensure a GTID state (e.g., from a Gtid_list_log_event) is consistent with
@@ -515,8 +513,8 @@ public:
private:
/*
- Holds the records for each domain id we are monitoring. Elements are of type
- `struct audit_elem` and indexed by domian_id.
+ Holds the records for each domain id we are monitoring. Elements are of
+ type `struct audit_elem` and indexed by domian_id.
*/
HASH m_audit_elem_domain_lookup;
};
@@ -535,7 +533,15 @@ public:
DELEGATING_GTID_FILTER_TYPE = 1,
WINDOW_GTID_FILTER_TYPE = 2,
ACCEPT_ALL_GTID_FILTER_TYPE = 3,
- REJECT_ALL_GTID_FILTER_TYPE = 4
+ REJECT_ALL_GTID_FILTER_TYPE = 4,
+ INTERSECTING_GTID_FILTER_TYPE = 5
+ };
+
+ enum class id_restriction_mode
+ {
+ MODE_NOT_SET,
+ WHITELIST_MODE,
+ BLACKLIST_MODE,
};
/*
@@ -598,8 +604,9 @@ public:
positions, m_start (exclusive) and m_stop (inclusive), within a domain.
This filter is stateful, such that it expects GTIDs to be an increasing
- stream, and internally, the window will activate and deactivate when the start
- and stop positions of the event stream have passed through, respectively.
+ stream, and internally, the window will activate and deactivate when the
+ start and stop positions of the event stream have passed through,
+ respectively.
*/
class Window_gtid_event_filter : public Gtid_event_filter
{
@@ -703,11 +710,11 @@ private:
rpl_gtid m_stop;
};
-typedef struct _gtid_filter_element
+template <typename T> struct gtid_filter_element
{
Gtid_event_filter *filter;
- gtid_filter_identifier identifier; /* Used for HASH lookup */
-} gtid_filter_element;
+ T identifier; /* Used for HASH lookup */
+};
/*
Gtid_event_filter subclass which has no specific implementation, but rather
@@ -717,8 +724,10 @@ typedef struct _gtid_filter_element
filter can be identified.
This class should be subclassed, where the get_id_from_gtid function
- specifies how to extract the filter identifier from a GTID.
+ specifies how to extract the filter identifier from a GTID. The type of the
+ filter identifier is a template for the class.
*/
+template <typename T>
class Id_delegating_gtid_event_filter : public Gtid_event_filter
{
public:
@@ -731,7 +740,21 @@ public:
uint32 get_filter_type() { return DELEGATING_GTID_FILTER_TYPE; }
- virtual gtid_filter_identifier get_id_from_gtid(rpl_gtid *) = 0;
+ virtual T get_id_from_gtid(rpl_gtid *) = 0;
+ virtual const char* get_id_type_name() = 0;
+
+ /*
+ Sets restrictions on entire ids using the corresponding mode (i.e. either
+ whitelist or blacklist, refer to Gtid_event_filter::id_restriction_mode)
+
+ A blacklist will allow all ids except for the ones provided in the input
+ list.
+ A whitelist will only allow ids provided in the input list.
+
+ Returns 0 on ok, non-zero on error.
+ */
+ int set_id_restrictions(T *id_list, size_t n_ids,
+ Gtid_event_filter::id_restriction_mode mode);
protected:
@@ -741,12 +764,14 @@ protected:
HASH m_filters_by_id_hash;
- gtid_filter_element *find_or_create_filter_element_for_id(gtid_filter_identifier);
+ Gtid_event_filter::id_restriction_mode m_id_restriction_mode;
+
+ gtid_filter_element<T> *find_or_create_filter_element_for_id(T);
};
/*
- A subclass of Id_delegating_gtid_event_filter which identifies filters using the
- domain id of a GTID.
+ A subclass of Id_delegating_gtid_event_filter which identifies filters using
+ the domain id of a GTID.
Additional helper functions include:
add_start_gtid(GTID) : adds a start GTID position to this filter, to be
@@ -760,15 +785,18 @@ protected:
get_num_start_gtids() : gets the count of added GTID start positions
get_num_stop_gtids() : gets the count of added GTID stop positions
*/
-class Domain_gtid_event_filter : public Id_delegating_gtid_event_filter
+class Domain_gtid_event_filter
+ : public Id_delegating_gtid_event_filter<decltype(rpl_gtid::domain_id)>
{
public:
Domain_gtid_event_filter()
{
my_init_dynamic_array(PSI_INSTRUMENT_ME, &m_start_filters,
- sizeof(gtid_filter_element*), 8, 8, MYF(0));
+ sizeof(decltype(rpl_gtid::domain_id) *), 8, 8,
+ MYF(0));
my_init_dynamic_array(PSI_INSTRUMENT_ME, &m_stop_filters,
- sizeof(gtid_filter_element*), 8, 8, MYF(0));
+ sizeof(decltype(rpl_gtid::domain_id) *), 8, 8,
+ MYF(0));
}
~Domain_gtid_event_filter()
{
@@ -779,11 +807,13 @@ public:
/*
Returns the domain id of from the input GTID
*/
- gtid_filter_identifier get_id_from_gtid(rpl_gtid *gtid)
+ decltype(rpl_gtid::domain_id) get_id_from_gtid(rpl_gtid *gtid)
{
return gtid->domain_id;
}
+ const char* get_id_type_name() { return "domain"; }
+
/*
Override Id_delegating_gtid_event_filter to extend with domain specific
filtering logic
@@ -840,7 +870,65 @@ private:
DYNAMIC_ARRAY m_start_filters;
DYNAMIC_ARRAY m_stop_filters;
- Window_gtid_event_filter *find_or_create_window_filter_for_id(gtid_filter_identifier);
+ Window_gtid_event_filter *
+ find_or_create_window_filter_for_id(decltype(rpl_gtid::domain_id));
+};
+
+/*
+ A subclass of Id_delegating_gtid_event_filter which identifies filters using
+ the server id of a GTID.
+*/
+class Server_gtid_event_filter
+ : public Id_delegating_gtid_event_filter<decltype(rpl_gtid::server_id)>
+{
+public:
+ /*
+ Returns the server id of from the input GTID
+ */
+ decltype(rpl_gtid::server_id) get_id_from_gtid(rpl_gtid *gtid)
+ {
+ return gtid->server_id;
+ }
+
+ const char* get_id_type_name() { return "server"; }
+};
+
+/*
+ A Gtid_event_filter implementation that delegates the filtering to other
+ filters, where the result is the intersection between them all.
+*/
+class Intersecting_gtid_event_filter : public Gtid_event_filter
+{
+public:
+ Intersecting_gtid_event_filter(Gtid_event_filter *filter1,
+ Gtid_event_filter *filter2);
+ ~Intersecting_gtid_event_filter();
+
+ /*
+ Returns TRUE if any filers exclude the gtid, returns FALSE otherwise, i.e.
+ all filters must allow the GTID.
+ */
+ my_bool exclude(rpl_gtid *gtid);
+
+ /*
+ Returns true if any filters have finished. To elaborate, as this filter
+ performs an intersection, if any filter has finished, the result would
+ be excluded regardless.
+ */
+ my_bool has_finished();
+
+ uint32 get_filter_type() { return INTERSECTING_GTID_FILTER_TYPE; }
+
+ /*
+ Adds a new filter to the intersection
+ */
+ my_bool add_filter(Gtid_event_filter *filter)
+ {
+ return insert_dynamic(&m_filters, (void *) &filter);
+ }
+
+ protected:
+ DYNAMIC_ARRAY m_filters;
};
#endif /* RPL_GTID_H */
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index 80ee143a8e8..0fd9070426b 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -695,6 +695,8 @@ struct rpl_group_info
*/
uint64 gtid_sub_id;
rpl_gtid current_gtid;
+ /* Currently applied event or NULL */
+ Log_event *current_event;
uint64 commit_id;
/*
This is used to keep transaction commit order.
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 5956c159278..e41cf8b6eb9 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -6190,15 +6190,15 @@ ER_SP_NO_RECURSION
ger "Rekursive gespeicherte Routinen und Triggers sind nicht erlaubt"
spa "No autorizadas funciones almacenadas recursivas ni disparadores"
ER_TOO_BIG_SCALE 42000 S1009
- chi "指定的大规模%llu为'%-.192s'。最大是%u"
- eng "Too big scale %llu specified for '%-.192s'. Maximum is %u"
- ger "Zu großer Skalierungsfaktor %llu für '%-.192s' angegeben. Maximum ist %u"
- spa "Escala %llu demasiado grande especificada para '%-.192s'. El máximo es de %u"
+ chi "指定的大规模为'%-.192s'。最大是%u"
+ eng "Too big scale specified for '%-.192s'. Maximum is %u"
+ ger "Zu großer Skalierungsfaktor für '%-.192s' angegeben. Maximum ist %u"
+ spa "Escala demasiado grande especificada para '%-.192s'. El máximo es de %u"
ER_TOO_BIG_PRECISION 42000 S1009
- chi "指定的精度%llu太大 '%-.192s'。最大是%u"
- eng "Too big precision %llu specified for '%-.192s'. Maximum is %u"
- ger "Zu große Genauigkeit %llu für '%-.192s' angegeben. Maximum ist %u"
- spa "Precisión %llu demasiado grande especificada para '%-.192s'. El máximo es de %u"
+ chi "指定的精度太大 '%-.192s'。最大是%u"
+ eng "Too big precision specified for '%-.192s'. Maximum is %u"
+ ger "Zu große Genauigkeit für '%-.192s' angegeben. Maximum ist %u"
+ spa "Precisión demasiado grande especificada para '%-.192s'. El máximo es de %u"
ER_M_BIGGER_THAN_D 42000 S1009
chi "对于FLOAT(M,D),DOUBLE(M,D)或DECIMAL(M,D),M必须> = D(列'%-.192s')"
eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s')"
@@ -8736,9 +8736,9 @@ ER_NO_SUCH_TABLE_IN_ENGINE 42S02
spa "La tabla '%-.192s.%-.192s' no existe en el motor"
swe "Det finns ingen tabell som heter '%-.192s.%-.192s' i handlern"
ER_TARGET_NOT_EXPLAINABLE
+ eng "Target is not executing an operation with a query plan"
chi "目标未è¿è¡Œå¯è§£é‡Šçš„命令"
- eng "Target is not running an EXPLAINable command"
- spa "El objetivo no está ejecutando un comando EXPLAINable"
+ spa "El objetivo no está ejecutando una operación con un plan de consulta (query)"
ER_CONNECTION_ALREADY_EXISTS
chi "连接'%.*s'与现有连接'%.*s'冲çª"
eng "Connection '%.*s' conflicts with existing connection '%.*s'"
@@ -9460,7 +9460,7 @@ ER_JSON_PATH_DEPTH
spa "El límite de %d en profundidad de ruta JSON se ha alcanzado en argumento %d a función '%s' en la posición %d"
ER_JSON_PATH_NO_WILDCARD
chi "JSON路径中的通é…符ä¸å…许 å‚æ•°%d 函数'%s'"
- eng "Wildcards in JSON path not allowed in argument %d to function '%s'"
+ eng "Wildcards or range in JSON path not allowed in argument %d to function '%s'"
spa "Comodines en ruta JSON no permitidos en argumento %d a función '%s'"
ER_JSON_PATH_ARRAY
chi "JSON路径应当以排列为终 å‚æ•°%d 函数'%s'"
@@ -10072,3 +10072,5 @@ ER_SF_OUT_INOUT_ARG_NOT_ALLOWED
eng "OUT or INOUT argument %d for function %s is not allowed here"
ER_INCONSISTENT_SLAVE_TEMP_TABLE
eng "Replicated query '%s' table `%s.%s` can not be temporary"
+ER_VERS_HIST_PART_FAILED
+ eng "Versioned table %`s.%`s: adding HISTORY partition(s) failed"
diff --git a/sql/slave.cc b/sql/slave.cc
index 83f138b78f0..0aa7ac62c8b 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1368,13 +1368,13 @@ static bool sql_slave_killed(rpl_group_info *rgi)
if (rli->sql_driver_thd->killed || rli->abort_slave)
{
/*
- The transaction should always be binlogged if OPTION_KEEP_LOG is
+ The transaction should always be binlogged if OPTION_BINLOG_THIS_TRX is
set (it implies that something can not be rolled back). And such
case should be regarded similarly as modifing a
non-transactional table because retrying of the transaction will
lead to an error or inconsistency as well.
- Example: OPTION_KEEP_LOG is set if a temporary table is created
+ Example: OPTION_BINLOG_THIS_TRX is set if a temporary table is created
or dropped.
Note that transaction.all.modified_non_trans_table may be 1
@@ -1384,7 +1384,7 @@ static bool sql_slave_killed(rpl_group_info *rgi)
*/
if ((thd->transaction->all.modified_non_trans_table ||
- (thd->variables.option_bits & OPTION_KEEP_LOG)) &&
+ (thd->variables.option_bits & OPTION_BINLOG_THIS_TRX)) &&
rli->is_in_group())
{
char msg_stopped[]=
@@ -1396,10 +1396,10 @@ static bool sql_slave_killed(rpl_group_info *rgi)
"documentation for details).";
DBUG_PRINT("info", ("modified_non_trans_table: %d OPTION_BEGIN: %d "
- "OPTION_KEEP_LOG: %d is_in_group: %d",
+ "OPTION_BINLOG_THIS_TRX: %d is_in_group: %d",
thd->transaction->all.modified_non_trans_table,
MY_TEST(thd->variables.option_bits & OPTION_BEGIN),
- MY_TEST(thd->variables.option_bits & OPTION_KEEP_LOG),
+ MY_TEST(thd->variables.option_bits & OPTION_BINLOG_THIS_TRX),
rli->is_in_group()));
if (rli->abort_slave)
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index d23b5e88baa..85a812f85d9 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -222,6 +222,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_ERRORS:
case SQLCOM_SHOW_EXPLAIN:
+ case SQLCOM_SHOW_ANALYZE:
case SQLCOM_SHOW_FIELDS:
case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_GENERIC:
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 2a7f885734e..5959203b36d 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -411,7 +411,7 @@ bool Sql_cmd_alter_table::execute(THD *thd)
referenced from this structure will be modified.
@todo move these into constructor...
*/
- HA_CREATE_INFO create_info(lex->create_info);
+ Table_specification_st create_info(lex->create_info);
Alter_info alter_info(lex->alter_info, thd->mem_root);
create_info.alter_info= &alter_info;
privilege_t priv(NO_ACL);
diff --git a/sql/sql_analyze_stmt.cc b/sql/sql_analyze_stmt.cc
index 60a08c86bf7..734ca1f8abb 100644
--- a/sql/sql_analyze_stmt.cc
+++ b/sql/sql_analyze_stmt.cc
@@ -33,7 +33,7 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
else
writer->add_member("r_loops").add_ll(get_r_loops());
- if (get_r_loops() && time_tracker.timed)
+ if (time_tracker.has_timed_statistics())
{
writer->add_member("r_total_time_ms").
add_double(time_tracker.get_time_ms());
diff --git a/sql/sql_analyze_stmt.h b/sql/sql_analyze_stmt.h
index e2037279a7a..d033e79168a 100644
--- a/sql/sql_analyze_stmt.h
+++ b/sql/sql_analyze_stmt.h
@@ -98,6 +98,8 @@ public:
return 1000.0 * static_cast<double>(cycles) /
static_cast<double>(sys_timer_info.cycles.frequency);
}
+
+ bool has_timed_statistics() const { return cycles > 0; }
};
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3a5a90966b8..bc9ab817b86 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -63,7 +63,6 @@
#include "wsrep_trans_observer.h"
#endif /* WITH_WSREP */
-
bool
No_such_table_error_handler::handle_condition(THD *,
uint sql_errno,
@@ -778,6 +777,18 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
}
+int close_thread_tables_for_query(THD *thd)
+{
+ if (thd->lex && thd->lex->explain)
+ thd->lex->explain->notify_tables_are_closed();
+
+ DBUG_EXECUTE_IF("explain_notify_tables_are_closed",
+ if (dbug_user_var_equals_str(thd, "show_explain_probe_query",
+ thd->query()))
+ dbug_serve_apcs(thd, 1);
+ );
+ return close_thread_tables(thd);
+}
/*
Close all tables used by the current substatement, or all tables
used by this thread if we are on the upper level.
@@ -962,7 +973,7 @@ void close_thread_table(THD *thd, TABLE **table_ptr)
DBUG_PRINT("tcache", ("table: '%s'.'%s' %p", table->s->db.str,
table->s->table_name.str, table));
DBUG_ASSERT(!table->file->keyread_enabled());
- DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
+ DBUG_ASSERT(table->file->inited == handler::NONE);
/*
The metadata lock must be released after giving back
@@ -976,11 +987,8 @@ void close_thread_table(THD *thd, TABLE **table_ptr)
table->vcol_cleanup_expr(thd);
table->mdl_ticket= NULL;
- if (table->file)
- {
- table->file->update_global_table_stats();
- table->file->update_global_index_stats();
- }
+ table->file->update_global_table_stats();
+ table->file->update_global_index_stats();
/*
This look is needed to allow THD::notify_shared_lock() to
@@ -1658,6 +1666,137 @@ bool is_locked_view(THD *thd, TABLE_LIST *t)
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+/**
+ Switch part_info->hist_part and request partition creation if needed.
+
+ @retval true Error or partition creation was requested.
+ @retval false No error
+*/
+bool TABLE::vers_switch_partition(THD *thd, TABLE_LIST *table_list,
+ Open_table_context *ot_ctx)
+{
+ if (!part_info || part_info->part_type != VERSIONING_PARTITION ||
+ table_list->vers_conditions.delete_history ||
+ thd->stmt_arena->is_stmt_prepare() ||
+ table_list->lock_type < TL_WRITE_ALLOW_WRITE ||
+ table_list->mdl_request.type < MDL_SHARED_WRITE ||
+ table_list->mdl_request.type == MDL_EXCLUSIVE)
+ {
+ return false;
+ }
+
+ /*
+ NOTE: we need this condition of prelocking_placeholder because we cannot do
+ auto-create after the transaction is started. Auto-create does
+ close_tables_for_reopen() and that is not possible under started transaction.
+ Also the transaction may not be cancelled at that moment: f.ex. trigger
+ after insert is run when some data is already written.
+
+ We must do auto-creation for PRELOCK_ROUTINE tables at the initial
+ open_tables() no matter what initiating sql_command is.
+ */
+ if (table_list->prelocking_placeholder != TABLE_LIST::PRELOCK_ROUTINE)
+ {
+ switch (thd->lex->sql_command)
+ {
+ case SQLCOM_INSERT_SELECT:
+ case SQLCOM_INSERT:
+ if (thd->lex->duplicates != DUP_UPDATE)
+ return false;
+ break;
+ case SQLCOM_LOAD:
+ if (thd->lex->duplicates != DUP_REPLACE)
+ return false;
+ break;
+ case SQLCOM_LOCK_TABLES:
+ case SQLCOM_DELETE:
+ case SQLCOM_UPDATE:
+ case SQLCOM_REPLACE:
+ case SQLCOM_REPLACE_SELECT:
+ case SQLCOM_DELETE_MULTI:
+ case SQLCOM_UPDATE_MULTI:
+ break;
+ default:
+ /*
+ TODO: make row events set thd->lex->sql_command appropriately.
+
+ Sergei Golubchik: f.ex. currently row events increment
+ thd->status_var.com_stat[] each event for its own SQLCOM_xxx, it won't be
+ needed if they'll just set thd->lex->sql_command.
+ */
+ if (thd->rgi_slave && thd->rgi_slave->current_event &&
+ thd->lex->sql_command == SQLCOM_END)
+ {
+ switch (thd->rgi_slave->current_event->get_type_code())
+ {
+ case UPDATE_ROWS_EVENT:
+ case UPDATE_ROWS_EVENT_V1:
+ case DELETE_ROWS_EVENT:
+ case DELETE_ROWS_EVENT_V1:
+ break;
+ default:;
+ return false;
+ }
+ }
+ break;
+ }
+ }
+
+ if (table_list->partition_names)
+ {
+ my_error(ER_VERS_NOT_ALLOWED, MYF(0), s->db.str, s->table_name.str);
+ return true;
+ }
+
+ TABLE *table= this;
+
+ /*
+ NOTE: The semantics of vers_set_hist_part() is twofold: even when we
+ don't need auto-create, we need to update part_info->hist_part.
+ */
+ uint *create_count= (table_list->vers_skip_create == thd->query_id) ?
+ NULL : &ot_ctx->vers_create_count;
+ table_list->vers_skip_create= thd->query_id;
+ if (table->part_info->vers_set_hist_part(thd, create_count))
+ return true;
+ if (ot_ctx->vers_create_count)
+ {
+ Open_table_context::enum_open_table_action action;
+ TABLE_LIST *table_arg;
+ mysql_mutex_lock(&table->s->LOCK_share);
+ if (!table->s->vers_skip_auto_create)
+ {
+ table->s->vers_skip_auto_create= true;
+ action= Open_table_context::OT_ADD_HISTORY_PARTITION;
+ table_arg= table_list;
+ }
+ else
+ {
+ /*
+ NOTE: this may repeat multiple times until creating thread acquires
+ MDL_EXCLUSIVE. Since auto-creation is rare operation this is acceptable.
+ We could suspend this thread on cond-var but we must first exit
+ MDL_SHARED_WRITE and we cannot store cond-var into TABLE_SHARE
+ because it is already released and there is no guarantee that it will
+ be same instance if we acquire it again.
+ */
+ table_list->vers_skip_create= 0;
+ ot_ctx->vers_create_count= 0;
+ action= Open_table_context::OT_REOPEN_TABLES;
+ table_arg= NULL;
+ DEBUG_SYNC(thd, "reopen_history_partition");
+ }
+ mysql_mutex_unlock(&table->s->LOCK_share);
+ ot_ctx->request_backoff_action(action, table_arg);
+ return true;
+ }
+
+ return false;
+}
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
+
+
/**
Open a base table.
@@ -1811,6 +1950,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
DBUG_PRINT("info",("Using locked table"));
#ifdef WITH_PARTITION_STORAGE_ENGINE
part_names_error= set_partitions_as_used(table_list, table);
+ if (!part_names_error
+ && table->vers_switch_partition(thd, table_list, ot_ctx))
+ DBUG_RETURN(true);
#endif
goto reset;
}
@@ -2068,6 +2210,16 @@ retry_share:
from_share= true;
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (!part_names_error &&
+ table->vers_switch_partition(thd, table_list, ot_ctx))
+ {
+ MYSQL_UNBIND_TABLE(table->file);
+ tc_release_table(table);
+ DBUG_RETURN(true);
+ }
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
+
if (!(flags & MYSQL_OPEN_HAS_MDL_LOCK) &&
table->s->table_category < TABLE_CATEGORY_INFORMATION)
{
@@ -2145,6 +2297,7 @@ retry_share:
table->init(thd, table_list);
+ DBUG_ASSERT(table != thd->open_tables);
table->next= thd->open_tables; /* Link into simple list */
thd->set_open_tables(table);
@@ -2613,7 +2766,7 @@ unlink_all_closed_tables(THD *thd, MYSQL_LOCK *lock, size_t reopen_count)
This is only needed when LOCK TABLES is active
*/
-void Locked_tables_list::mark_table_for_reopen(THD *thd, TABLE *table)
+void Locked_tables_list::mark_table_for_reopen(TABLE *table)
{
TABLE_SHARE *share= table->s;
@@ -2626,11 +2779,13 @@ void Locked_tables_list::mark_table_for_reopen(THD *thd, TABLE *table)
close_all_tables_for_name().
*/
if (table_list->table && table_list->table->s == share)
+ {
table_list->table->internal_set_needs_reopen(true);
+ some_table_marked_for_reopen= 1;
+ }
}
/* This is needed in the case where lock tables where not used */
table->internal_set_needs_reopen(true);
- some_table_marked_for_reopen= 1;
}
@@ -3088,7 +3243,8 @@ Open_table_context::Open_table_context(THD *thd, uint flags)
m_flags(flags),
m_action(OT_NO_ACTION),
m_has_locks(thd->mdl_context.has_locks()),
- m_has_protection_against_grl(0)
+ m_has_protection_against_grl(0),
+ vers_create_count(0)
{}
@@ -3168,13 +3324,15 @@ request_backoff_action(enum_open_table_action action_arg,
*/
if (table)
{
- DBUG_ASSERT(action_arg == OT_DISCOVER || action_arg == OT_REPAIR);
+ DBUG_ASSERT(action_arg == OT_DISCOVER || action_arg == OT_REPAIR ||
+ action_arg == OT_ADD_HISTORY_PARTITION);
m_failed_table= (TABLE_LIST*) m_thd->alloc(sizeof(TABLE_LIST));
if (m_failed_table == NULL)
return TRUE;
m_failed_table->init_one_table(&table->db, &table->table_name, &table->alias, TL_WRITE);
m_failed_table->open_strategy= table->open_strategy;
m_failed_table->mdl_request.set_type(MDL_EXCLUSIVE);
+ m_failed_table->vers_skip_create= table->vers_skip_create;
}
m_action= action_arg;
return FALSE;
@@ -3235,13 +3393,50 @@ Open_table_context::recover_from_failed_open()
break;
case OT_DISCOVER:
case OT_REPAIR:
- if ((result= lock_table_names(m_thd, m_thd->lex->create_info,
- m_failed_table, NULL,
- get_timeout(), 0)))
+ case OT_ADD_HISTORY_PARTITION:
+ DEBUG_SYNC(m_thd, "add_history_partition");
+ if (!m_thd->locked_tables_mode)
+ result= lock_table_names(m_thd, m_thd->lex->create_info, m_failed_table,
+ NULL, get_timeout(), 0);
+ else
+ {
+ DBUG_ASSERT(!result);
+ DBUG_ASSERT(m_action == OT_ADD_HISTORY_PARTITION);
+ }
+ /*
+ We are now under MDL_EXCLUSIVE mode. Other threads have no table share
+ acquired: they are blocked either at open_table_get_mdl_lock() in
+ open_table() or at lock_table_names() here.
+ */
+ if (result)
+ {
+ if (m_action == OT_ADD_HISTORY_PARTITION)
+ {
+ TABLE_SHARE *share= tdc_acquire_share(m_thd, m_failed_table,
+ GTS_TABLE, NULL);
+ if (share)
+ {
+ share->vers_skip_auto_create= false;
+ tdc_release_share(share);
+ }
+ if (m_thd->get_stmt_da()->sql_errno() == ER_LOCK_WAIT_TIMEOUT)
+ {
+ // MDEV-23642 Locking timeout caused by auto-creation affects original DML
+ m_thd->clear_error();
+ vers_create_count= 0;
+ result= false;
+ }
+ }
break;
+ }
- tdc_remove_table(m_thd, m_failed_table->db.str,
- m_failed_table->table_name.str);
+ /*
+ We don't need to remove share under OT_ADD_HISTORY_PARTITION.
+ Moreover fast_alter_partition_table() works with TABLE instance.
+ */
+ if (m_action != OT_ADD_HISTORY_PARTITION)
+ tdc_remove_table(m_thd, m_failed_table->db.str,
+ m_failed_table->table_name.str);
switch (m_action)
{
@@ -3269,6 +3464,72 @@ Open_table_context::recover_from_failed_open()
case OT_REPAIR:
result= auto_repair_table(m_thd, m_failed_table);
break;
+ case OT_ADD_HISTORY_PARTITION:
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ {
+ result= false;
+ TABLE *table= open_ltable(m_thd, m_failed_table, TL_WRITE,
+ MYSQL_OPEN_HAS_MDL_LOCK | MYSQL_OPEN_IGNORE_LOGGING_FORMAT);
+ if (table == NULL)
+ {
+ m_thd->clear_error();
+ break;
+ }
+
+ DBUG_ASSERT(vers_create_count);
+ result= vers_create_partitions(m_thd, m_failed_table, vers_create_count);
+ vers_create_count= 0;
+ if (!m_thd->transaction->stmt.is_empty())
+ trans_commit_stmt(m_thd);
+ DBUG_ASSERT(!result ||
+ !m_thd->locked_tables_mode ||
+ m_thd->lock->lock_count);
+ if (result)
+ break;
+ if (!m_thd->locked_tables_mode)
+ {
+ /*
+ alter_partition_lock_handling() does mysql_lock_remove() but
+ does not clear thd->lock completely.
+ */
+ DBUG_ASSERT(m_thd->lock->lock_count == 0);
+ if (!(m_thd->lock->flags & GET_LOCK_ON_THD))
+ my_free(m_thd->lock);
+ m_thd->lock= NULL;
+ }
+ else if (m_thd->locked_tables_mode == LTM_PRELOCKED)
+ {
+ MYSQL_LOCK *lock;
+ MYSQL_LOCK *merged_lock;
+
+ /*
+ In LTM_LOCK_TABLES table was reopened via locked_tables_list,
+ but not in prelocked environment where we have to reopen
+ the table manually.
+ */
+ Open_table_context ot_ctx(m_thd, MYSQL_OPEN_REOPEN);
+ if (open_table(m_thd, m_failed_table, &ot_ctx))
+ {
+ result= true;
+ break;
+ }
+ TABLE *table= m_failed_table->table;
+ table->reginfo.lock_type= m_thd->update_lock_default;
+ m_thd->in_lock_tables= 1;
+ lock= mysql_lock_tables(m_thd, &table, 1,
+ MYSQL_OPEN_REOPEN | MYSQL_LOCK_USE_MALLOC);
+ m_thd->in_lock_tables= 0;
+ if (lock == NULL ||
+ !(merged_lock= mysql_lock_merge(m_thd->lock, lock, m_thd)))
+ {
+ result= true;
+ break;
+ }
+ m_thd->lock= merged_lock;
+ }
+ break;
+ }
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
case OT_BACKOFF_AND_RETRY:
case OT_REOPEN_TABLES:
case OT_NO_ACTION:
@@ -4243,6 +4504,7 @@ bool open_tables(THD *thd, const DDL_options_st &options,
}
thd->current_tablenr= 0;
+
restart:
/*
Close HANDLER tables which are marked for flush or against which there
@@ -4323,6 +4585,9 @@ restart:
/*
For every table in the list of tables to open, try to find or open
a table.
+
+ NOTE: there can be duplicates in the list. F.ex. table specified in
+ LOCK TABLES and prelocked via another table (like when used in a trigger).
*/
for (tables= *table_to_open; tables;
table_to_open= &tables->next_global, tables= tables->next_global)
@@ -4415,8 +4680,11 @@ restart:
if (unlikely(error))
{
+ /* F.ex. deadlock happened */
if (ot_ctx.can_recover_from_failed_open())
{
+ DBUG_ASSERT(ot_ctx.get_action() !=
+ Open_table_context::OT_ADD_HISTORY_PARTITION);
close_tables_for_reopen(thd, start,
ot_ctx.start_of_statement_svp());
if (ot_ctx.recover_from_failed_open())
@@ -5190,16 +5458,14 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
if (table_list->table)
DBUG_RETURN(table_list->table);
- /* should not be used in a prelocked_mode context, see NOTE above */
- DBUG_ASSERT(thd->locked_tables_mode < LTM_PRELOCKED);
-
THD_STAGE_INFO(thd, stage_opening_tables);
thd->current_tablenr= 0;
/* open_ltable can be used only for BASIC TABLEs */
table_list->required_type= TABLE_TYPE_NORMAL;
/* This function can't properly handle requests for such metadata locks. */
- DBUG_ASSERT(table_list->mdl_request.type < MDL_SHARED_UPGRADABLE);
+ DBUG_ASSERT(lock_flags & MYSQL_OPEN_HAS_MDL_LOCK ||
+ table_list->mdl_request.type < MDL_SHARED_UPGRADABLE);
while ((error= open_table(thd, table_list, &ot_ctx)) &&
ot_ctx.can_recover_from_failed_open())
@@ -8933,6 +9199,8 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
continue;
value=v++;
+ /* Ensure the end of the list of values is not reached */
+ DBUG_ASSERT(value);
bool vers_sys_field= table->versioned() && field->vers_sys_field();
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 0bfef1ca7ee..bd439166a0f 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -161,6 +161,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
const LEX_CSTRING *db_name,
const LEX_CSTRING *table_name);
int close_thread_tables(THD *thd);
+int close_thread_tables_for_query(THD *thd);
void switch_to_nullable_trigger_fields(List<Item> &items, TABLE *);
void switch_defaults_to_nullable_trigger_fields(TABLE *table);
bool fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
@@ -532,7 +533,8 @@ public:
OT_BACKOFF_AND_RETRY,
OT_REOPEN_TABLES,
OT_DISCOVER,
- OT_REPAIR
+ OT_REPAIR,
+ OT_ADD_HISTORY_PARTITION
};
Open_table_context(THD *thd, uint flags);
@@ -559,6 +561,11 @@ public:
return m_timeout;
}
+ enum_open_table_action get_action() const
+ {
+ return m_action;
+ }
+
uint get_flags() const { return m_flags; }
/**
@@ -605,6 +612,9 @@ private:
protection against global read lock.
*/
mdl_bitmap_t m_has_protection_against_grl;
+
+public:
+ uint vers_create_count;
};
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 3858cbfca45..532696345a7 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -56,6 +56,7 @@
#include "sp_rcontext.h"
#include "sp_cache.h"
#include "sql_show.h" // append_identifier
+#include "sql_db.h" // get_default_db_collation
#include "transaction.h"
#include "sql_select.h" /* declares create_tmp_table() */
#include "debug_sync.h"
@@ -848,7 +849,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */
#endif
/* Call to init() below requires fully initialized Open_tables_state. */
- reset_open_tables_state(this);
+ reset_open_tables_state();
init();
debug_sync_init_thread(this);
@@ -4615,7 +4616,7 @@ void THD::reset_n_backup_open_tables_state(Open_tables_backup *backup)
DBUG_ENTER("reset_n_backup_open_tables_state");
backup->set_open_tables_state(this);
backup->mdl_system_tables_svp= mdl_context.mdl_savepoint();
- reset_open_tables_state(this);
+ reset_open_tables_state();
state_flags|= Open_tables_state::BACKUPS_AVAIL;
DBUG_VOID_RETURN;
}
@@ -7402,6 +7403,26 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional)
}
+/*
+ DML that doesn't change the table normally is not logged,
+ but it needs to be logged if it auto-created a partition as a side effect.
+*/
+bool THD::binlog_for_noop_dml(bool transactional_table)
+{
+ if (mysql_bin_log.is_open() && log_current_statement())
+ {
+ reset_unsafe_warnings();
+ if (binlog_query(THD::STMT_QUERY_TYPE, query(), query_length(),
+ transactional_table, FALSE, FALSE, 0) > 0)
+ {
+ my_error(ER_ERROR_ON_WRITE, MYF(0), "binary log", -1);
+ return true;
+ }
+ }
+ return false;
+}
+
+
#if defined(DBUG_TRACE) && !defined(_lint)
static const char *
show_query_type(THD::enum_binlog_query_type qtype)
@@ -8338,3 +8359,27 @@ THD_list_iterator *THD_list_iterator::iterator()
{
return &server_threads;
}
+
+
+Charset_collation_context
+THD::charset_collation_context_alter_db(const char *db)
+{
+ return Charset_collation_context(variables.collation_server,
+ get_default_db_collation(this, db));
+}
+
+
+Charset_collation_context
+THD::charset_collation_context_create_table_in_db(const char *db)
+{
+ CHARSET_INFO *cs= get_default_db_collation(this, db);
+ return Charset_collation_context(cs, cs);
+}
+
+
+Charset_collation_context
+THD::charset_collation_context_alter_table(const TABLE_SHARE *s)
+{
+ return Charset_collation_context(get_default_db_collation(this, s->db.str),
+ s->table_charset);
+}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index c5085590511..5e5c0128a05 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -198,6 +198,8 @@ enum enum_binlog_row_image {
#define OLD_MODE_NO_PROGRESS_INFO (1 << 1)
#define OLD_MODE_ZERO_DATE_TIME_CAST (1 << 2)
#define OLD_MODE_UTF8_IS_UTF8MB3 (1 << 3)
+#define OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN (1 << 4)
+#define OLD_MODE_COMPAT_5_1_CHECKSUM (1 << 5)
extern char internal_table_name[2];
extern char empty_c_string[1];
@@ -1628,6 +1630,10 @@ enum enum_locked_tables_mode
LTM_NONE= 0,
LTM_LOCK_TABLES,
LTM_PRELOCKED,
+ /*
+ TODO: remove LTM_PRELOCKED_UNDER_LOCK_TABLES: it is never used apart from
+ LTM_LOCK_TABLES.
+ */
LTM_PRELOCKED_UNDER_LOCK_TABLES,
LTM_always_last
};
@@ -1810,7 +1816,7 @@ public:
*this= *state;
}
- void reset_open_tables_state(THD *thd)
+ void reset_open_tables_state()
{
open_tables= 0;
temporary_tables= 0;
@@ -2173,7 +2179,7 @@ public:
bool restore_lock(THD *thd, TABLE_LIST *dst_table_list, TABLE *table,
MYSQL_LOCK *lock);
void add_back_last_deleted_lock(TABLE_LIST *dst_table_list);
- void mark_table_for_reopen(THD *thd, TABLE *table);
+ void mark_table_for_reopen(TABLE *table);
};
@@ -2988,6 +2994,14 @@ public:
int binlog_flush_pending_rows_event(bool stmt_end, bool is_transactional);
int binlog_remove_pending_rows_event(bool clear_maps, bool is_transactional);
+ bool binlog_need_stmt_format(bool is_transactional) const
+ {
+ return log_current_statement() &&
+ !binlog_get_pending_rows_event(is_transactional);
+ }
+
+ bool binlog_for_noop_dml(bool transactional_table);
+
/**
Determine the binlog format of the current statement.
@@ -3641,8 +3655,10 @@ public:
/* set during loop of derived table processing */
bool derived_tables_processing;
bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */
- /* True if we have to log the current statement */
- bool log_current_statement;
+ bool log_current_statement() const
+ {
+ return variables.option_bits & OPTION_BINLOG_THIS_STMT;
+ }
/**
True if a slave error. Causes the slave to stop. Not the same
as the statement execution error (is_error()), since
@@ -5559,6 +5575,19 @@ public:
MY_UTF8_IS_UTF8MB3 : 0);
}
+ Charset_collation_context
+ charset_collation_context_create_db() const
+ {
+ return Charset_collation_context(variables.collation_server,
+ variables.collation_server);
+ }
+ Charset_collation_context
+ charset_collation_context_alter_db(const char *db);
+ Charset_collation_context
+ charset_collation_context_create_table_in_db(const char *db);
+ Charset_collation_context
+ charset_collation_context_alter_table(const TABLE_SHARE *s);
+
/**
Save current lex to the output parameter and reset it to point to
main_lex. This method is called from mysql_client_binlog_statement()
@@ -6178,6 +6207,7 @@ public:
m_plock(NULL), exit_done(0),
saved_tmp_table_share(0)
{
+ DBUG_ASSERT(create_info->default_table_charset);
bzero(&ddl_log_state_create, sizeof(ddl_log_state_create));
bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm));
}
@@ -7856,24 +7886,25 @@ public:
void dbug_serve_apcs(THD *thd, int n_calls);
#endif
-class ScopedStatementReplication
+class StatementBinlog
{
+ const enum_binlog_format saved_binlog_format;
+ THD *const thd;
+
public:
- ScopedStatementReplication(THD *thd) :
- saved_binlog_format(thd
- ? thd->set_current_stmt_binlog_format_stmt()
- : BINLOG_FORMAT_MIXED),
+ StatementBinlog(THD *thd, bool need_stmt) :
+ saved_binlog_format(thd->get_current_stmt_binlog_format()),
thd(thd)
- {}
- ~ScopedStatementReplication()
{
- if (thd)
- thd->restore_stmt_binlog_format(saved_binlog_format);
+ if (need_stmt && saved_binlog_format != BINLOG_FORMAT_STMT)
+ {
+ thd->set_current_stmt_binlog_format_stmt();
+ }
+ }
+ ~StatementBinlog()
+ {
+ thd->set_current_stmt_binlog_format(saved_binlog_format);
}
-
-private:
- const enum_binlog_format saved_binlog_format;
- THD *const thd;
};
diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h
index 6554fc78f27..2623b3703d3 100644
--- a/sql/sql_cmd.h
+++ b/sql/sql_cmd.h
@@ -88,7 +88,8 @@ enum enum_sql_command {
SQLCOM_SHOW_RELAYLOG_EVENTS,
SQLCOM_GET_DIAGNOSTICS,
SQLCOM_SLAVE_ALL_START, SQLCOM_SLAVE_ALL_STOP,
- SQLCOM_SHOW_EXPLAIN, SQLCOM_SHUTDOWN,
+ SQLCOM_SHOW_EXPLAIN,
+ SQLCOM_SHOW_ANALYZE, SQLCOM_SHUTDOWN,
SQLCOM_CREATE_ROLE, SQLCOM_DROP_ROLE, SQLCOM_GRANT_ROLE, SQLCOM_REVOKE_ROLE,
SQLCOM_COMPOUND,
SQLCOM_SHOW_GENERIC,
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index c5defc1959c..9da1ac5ca77 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -943,6 +943,7 @@ exit:
int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
const Schema_specification_st *create_info)
{
+ DBUG_ASSERT(create_info->default_table_charset);
/*
As mysql_create_db_internal() may modify Db_create_info structure passed
to it, we need to use a copy to make execution prepared statement- safe.
@@ -958,6 +959,7 @@ int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
bool mysql_alter_db(THD *thd, const LEX_CSTRING *db,
const Schema_specification_st *create_info)
{
+ DBUG_ASSERT(create_info->default_table_charset);
/*
As mysql_alter_db_internal() may modify Db_create_info structure passed
to it, we need to use a copy to make execution prepared statement- safe.
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 41e2892be5f..ccef8b42f74 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -450,6 +450,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
*/
has_triggers= table->triggers && table->triggers->has_delete_triggers();
+ transactional_table= table->file->has_transactions_and_rollback();
if (!returning && !using_limit && const_cond_result &&
(!thd->is_current_stmt_binlog_format_row() && !has_triggers)
@@ -508,6 +509,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (thd->lex->describe || thd->lex->analyze_stmt)
goto produce_explain_and_leave;
+ if (thd->binlog_for_noop_dml(transactional_table))
+ DBUG_RETURN(1);
+
my_ok(thd, 0);
DBUG_RETURN(0);
}
@@ -538,6 +542,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
*/
if (unlikely(thd->is_error()))
DBUG_RETURN(TRUE);
+
+ if (thd->binlog_for_noop_dml(transactional_table))
+ DBUG_RETURN(1);
+
my_ok(thd, 0);
DBUG_RETURN(0); // Nothing to delete
}
@@ -920,14 +928,14 @@ cleanup:
deltempfile=NULL;
delete select;
select= NULL;
- transactional_table= table->file->has_transactions_and_rollback();
if (!transactional_table && deleted > 0)
thd->transaction->stmt.modified_non_trans_table=
thd->transaction->all.modified_non_trans_table= TRUE;
/* See similar binlogging code in sql_update.cc, for comments */
- if (likely((error < 0) || thd->transaction->stmt.modified_non_trans_table))
+ if (likely((error < 0) || thd->transaction->stmt.modified_non_trans_table
+ || thd->log_current_statement()))
{
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
@@ -937,8 +945,8 @@ cleanup:
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
- ScopedStatementReplication scoped_stmt_rpl(
- table->versioned(VERS_TRX_ID) ? thd : NULL);
+ StatementBinlog stmt_binlog(thd, table->versioned(VERS_TRX_ID) ||
+ thd->binlog_need_stmt_format(transactional_table));
/*
[binlog]: If 'handler::delete_all_rows()' was called and the
storage engine does not inject the rows itself, we replicate
@@ -1446,13 +1454,15 @@ void multi_delete::abort_result_set()
DBUG_VOID_RETURN;
}
- if (thd->transaction->stmt.modified_non_trans_table)
+ if (thd->transaction->stmt.modified_non_trans_table ||
+ thd->log_current_statement())
{
/*
there is only side effects; to binlog with the error
*/
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
+ StatementBinlog stmt_binlog(thd, thd->binlog_need_stmt_format(transactional_tables));
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
/* possible error of writing binary log is ignored deliberately */
(void) thd->binlog_query(THD::ROW_QUERY_TYPE,
@@ -1626,7 +1636,8 @@ bool multi_delete::send_eof()
query_cache_invalidate3(thd, delete_tables, 1);
}
if (likely((local_error == 0) ||
- thd->transaction->stmt.modified_non_trans_table))
+ thd->transaction->stmt.modified_non_trans_table) ||
+ thd->log_current_statement())
{
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
@@ -1636,6 +1647,7 @@ bool multi_delete::send_eof()
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
thd->thread_specific_used= TRUE;
+ StatementBinlog stmt_binlog(thd, thd->binlog_need_stmt_format(transactional_tables));
if (unlikely(thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
transactional_tables, FALSE, FALSE,
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index e49ba0da11c..67af0a5dab6 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -39,12 +39,12 @@ const char *unit_operation_text[4]=
const char *pushed_derived_text= "PUSHED DERIVED";
const char *pushed_select_text= "PUSHED SELECT";
-static void write_item(Json_writer *writer, Item *item);
-static void append_item_to_str(String *out, Item *item);
+static void write_item(Json_writer *writer, Item *item, bool no_tmp_tbl);
+static void append_item_to_str(String *out, Item *item, bool no_tmp_tbl);
Explain_query::Explain_query(THD *thd_arg, MEM_ROOT *root) :
mem_root(root), upd_del_plan(nullptr), insert_plan(nullptr),
- unions(root), selects(root), thd(thd_arg), apc_enabled(false),
+ unions(root), selects(root), stmt_thd(thd_arg), apc_enabled(false),
operations(0)
{
}
@@ -65,7 +65,7 @@ static void print_json_array(Json_writer *writer,
Explain_query::~Explain_query()
{
if (apc_enabled)
- thd->apc_target.disable();
+ stmt_thd->apc_target.disable();
delete upd_del_plan;
delete insert_plan;
@@ -155,10 +155,32 @@ void Explain_query::add_upd_del_plan(Explain_update *upd_del_plan_arg)
void Explain_query::query_plan_ready()
{
if (!apc_enabled)
- thd->apc_target.enable();
+ stmt_thd->apc_target.enable();
apc_enabled= true;
+#ifndef DBUG_OFF
+ can_print_json= true;
+#endif
+}
+
+
+void Explain_query::notify_tables_are_closed()
+{
+ /*
+ Disable processing of SHOW EXPLAIN|ANALYZE. The query is about to close
+ the tables it is using, which will make it impossible to print Item*
+ values. See sql_explain.h:ExplainDataStructureLifetime for details.
+ */
+ if (apc_enabled)
+ {
+ stmt_thd->apc_target.disable();
+ apc_enabled= false;
+#ifndef DBUG_OFF
+ can_print_json= false;
+#endif
+ }
}
+
/*
Send EXPLAIN output to the client.
*/
@@ -174,7 +196,7 @@ int Explain_query::send_explain(THD *thd, bool extended)
int res= 0;
if (thd->lex->explain_json)
- print_explain_json(result, thd->lex->analyze_stmt);
+ print_explain_json(result, thd->lex->analyze_stmt, false /*is_show_cmd*/);
else
{
res= print_explain(result, lex->describe, thd->lex->analyze_stmt);
@@ -230,23 +252,48 @@ int Explain_query::print_explain(select_result_sink *output,
}
-void Explain_query::print_explain_json(select_result_sink *output,
- bool is_analyze)
+/*
+ @param is_show_cmd TRUE<=> This is a SHOW EXPLAIN|ANALYZE command.
+ (These commands may be called at late stage in
+ the query processing, we need to pass no_tmp_tbl=true
+ to other print functions)
+*/
+
+int Explain_query::print_explain_json(select_result_sink *output,
+ bool is_analyze,
+ bool is_show_cmd,
+ ulonglong query_time_in_progress_ms)
{
Json_writer writer;
+
+#ifndef DBUG_OFF
+ DBUG_ASSERT(can_print_json);
+#endif
+
writer.start_object();
+ if (is_analyze && query_time_in_progress_ms > 0)
+ writer.add_member("r_query_time_in_progress_ms").
+ add_ull(query_time_in_progress_ms);
+
+ /*
+ If we are printing ANALYZE FORMAT=JSON output, take into account that
+ query's temporary tables have already been freed. See sql_explain.h,
+ sql_explain.h:ExplainDataStructureLifetime for details.
+ */
+ if (is_analyze)
+ is_show_cmd= true;
if (upd_del_plan)
- upd_del_plan->print_explain_json(this, &writer, is_analyze);
+ upd_del_plan->print_explain_json(this, &writer, is_analyze, is_show_cmd);
else if (insert_plan)
- insert_plan->print_explain_json(this, &writer, is_analyze);
+ insert_plan->print_explain_json(this, &writer, is_analyze, is_show_cmd);
else
{
/* Start printing from node with id=1 */
Explain_node *node= get_node(1);
if (!node)
- return; /* No query plan */
- node->print_explain_json(this, &writer, is_analyze);
+ return 1; /* No query plan */
+ node->print_explain_json(this, &writer, is_analyze, is_show_cmd);
}
writer.end_object();
@@ -254,10 +301,12 @@ void Explain_query::print_explain_json(select_result_sink *output,
CHARSET_INFO *cs= system_charset_info;
List<Item> item_list;
const String *buf= writer.output.get_string();
+ THD *thd= output->thd;
item_list.push_back(new (thd->mem_root)
Item_string(thd, buf->ptr(), buf->length(), cs),
thd->mem_root);
output->send_data(item_list);
+ return 0;
}
@@ -607,7 +656,8 @@ int Explain_union::print_explain(Explain_query *query,
void Explain_union::print_explain_json(Explain_query *query,
- Json_writer *writer, bool is_analyze)
+ Json_writer *writer, bool is_analyze,
+ bool no_tmp_tbl)
{
Json_writer_nesting_guard guard(writer);
char table_name_buffer[SAFE_NAME_LEN];
@@ -652,12 +702,12 @@ void Explain_union::print_explain_json(Explain_query *query,
//writer->add_member("dependent").add_str("TODO");
//writer->add_member("cacheable").add_str("TODO");
Explain_select *sel= query->get_select(union_members.at(i));
- sel->print_explain_json(query, writer, is_analyze);
+ sel->print_explain_json(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
writer->end_array();
- print_explain_json_for_children(query, writer, is_analyze);
+ print_explain_json_for_children(query, writer, is_analyze, no_tmp_tbl);
writer->end_object(); // union_result
writer->end_object(); // query_block
@@ -719,7 +769,8 @@ bool is_connection_printable_in_json(enum Explain_node::explain_connection_type
void Explain_node::print_explain_json_for_children(Explain_query *query,
Json_writer *writer,
- bool is_analyze)
+ bool is_analyze,
+ bool no_tmp_tbl)
{
Json_writer_nesting_guard guard(writer);
@@ -746,7 +797,7 @@ void Explain_node::print_explain_json_for_children(Explain_query *query,
}
writer->start_object();
- node->print_explain_json(query, writer, is_analyze);
+ node->print_explain_json(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
@@ -926,7 +977,8 @@ void Explain_select::add_linkage(Json_writer *writer)
}
void Explain_select::print_explain_json(Explain_query *query,
- Json_writer *writer, bool is_analyze)
+ Json_writer *writer, bool is_analyze,
+ bool no_tmp_tbl)
{
Json_writer_nesting_guard guard(writer);
@@ -948,7 +1000,7 @@ void Explain_select::print_explain_json(Explain_query *query,
message);
writer->end_object();
- print_explain_json_for_children(query, writer, is_analyze);
+ print_explain_json_for_children(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
else
@@ -960,23 +1012,27 @@ void Explain_select::print_explain_json(Explain_query *query,
if (is_analyze && time_tracker.get_loops())
{
writer->add_member("r_loops").add_ll(time_tracker.get_loops());
- writer->add_member("r_total_time_ms").add_double(time_tracker.get_time_ms());
+ if (time_tracker.has_timed_statistics())
+ {
+ writer->add_member("r_total_time_ms").
+ add_double(time_tracker.get_time_ms());
+ }
}
if (exec_const_cond)
{
writer->add_member("const_condition");
- write_item(writer, exec_const_cond);
+ write_item(writer, exec_const_cond, no_tmp_tbl);
}
if (outer_ref_cond)
{
writer->add_member("outer_ref_condition");
- write_item(writer, outer_ref_cond);
+ write_item(writer, outer_ref_cond, no_tmp_tbl);
}
if (pseudo_bits_cond)
{
writer->add_member("pseudo_bits_condition");
- write_item(writer, pseudo_bits_cond);
+ write_item(writer, pseudo_bits_cond, no_tmp_tbl);
}
/* we do not print HAVING which always evaluates to TRUE */
@@ -984,7 +1040,7 @@ void Explain_select::print_explain_json(Explain_query *query,
{
writer->add_member("having_condition");
if (likely(having))
- write_item(writer, having);
+ write_item(writer, having, no_tmp_tbl);
else
{
/* Normally we should not go this branch, left just for safety */
@@ -1007,7 +1063,8 @@ void Explain_select::print_explain_json(Explain_query *query,
case AGGR_OP_FILESORT:
{
writer->add_member("filesort").start_object();
- ((Explain_aggr_filesort*)node)->print_json_members(writer, is_analyze);
+ auto aggr_node= (Explain_aggr_filesort*)node;
+ aggr_node->print_json_members(writer, is_analyze, no_tmp_tbl);
break;
}
case AGGR_OP_REMOVE_DUPLICATES:
@@ -1017,7 +1074,8 @@ void Explain_select::print_explain_json(Explain_query *query,
{
//TODO: make print_json_members virtual?
writer->add_member("window_functions_computation").start_object();
- ((Explain_aggr_window_funcs*)node)->print_json_members(writer, is_analyze);
+ auto aggr_node= (Explain_aggr_window_funcs*)node;
+ aggr_node->print_json_members(writer, is_analyze, no_tmp_tbl);
break;
}
default:
@@ -1026,7 +1084,8 @@ void Explain_select::print_explain_json(Explain_query *query,
started_objects++;
}
- Explain_basic_join::print_explain_json_interns(query, writer, is_analyze);
+ Explain_basic_join::print_explain_json_interns(query, writer, is_analyze,
+ no_tmp_tbl);
for (;started_objects; started_objects--)
writer->end_object();
@@ -1055,7 +1114,8 @@ Explain_aggr_filesort::Explain_aggr_filesort(MEM_ROOT *mem_root,
void Explain_aggr_filesort::print_json_members(Json_writer *writer,
- bool is_analyze)
+ bool is_analyze,
+ bool no_tmp_tbl)
{
char item_buf[256];
String str(item_buf, sizeof(item_buf), &my_charset_bin);
@@ -1075,7 +1135,7 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer,
{
str.append(STRING_WITH_LEN(", "));
}
- append_item_to_str(&str, item);
+ append_item_to_str(&str, item, no_tmp_tbl);
if (*direction == ORDER::ORDER_DESC)
str.append(STRING_WITH_LEN(" desc"));
}
@@ -1088,7 +1148,8 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer,
void Explain_aggr_window_funcs::print_json_members(Json_writer *writer,
- bool is_analyze)
+ bool is_analyze,
+ bool no_tmp_tbl)
{
Explain_aggr_filesort *srt;
List_iterator<Explain_aggr_filesort> it(sorts);
@@ -1097,19 +1158,19 @@ void Explain_aggr_window_funcs::print_json_members(Json_writer *writer,
{
Json_writer_object sort(writer);
Json_writer_object filesort(writer, "filesort");
- srt->print_json_members(writer, is_analyze);
+ srt->print_json_members(writer, is_analyze, no_tmp_tbl);
}
}
void Explain_basic_join::print_explain_json(Explain_query *query,
Json_writer *writer,
- bool is_analyze)
+ bool is_analyze, bool no_tmp_tbl)
{
writer->add_member("query_block").start_object();
writer->add_member("select_id").add_ll(select_id);
- print_explain_json_interns(query, writer, is_analyze);
+ print_explain_json_interns(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
@@ -1118,7 +1179,7 @@ void Explain_basic_join::print_explain_json(Explain_query *query,
void Explain_basic_join::
print_explain_json_interns(Explain_query *query,
Json_writer *writer,
- bool is_analyze)
+ bool is_analyze, bool no_tmp_tbl)
{
{
Json_writer_array loop(writer, "nested_loop");
@@ -1131,7 +1192,7 @@ print_explain_json_interns(Explain_query *query,
writer->start_array();
}
- join_tabs[i]->print_explain_json(query, writer, is_analyze);
+ join_tabs[i]->print_explain_json(query, writer, is_analyze, no_tmp_tbl);
if (join_tabs[i]->end_dups_weedout)
{
@@ -1140,7 +1201,7 @@ print_explain_json_interns(Explain_query *query,
}
}
} // "nested_loop"
- print_explain_json_for_children(query, writer, is_analyze);
+ print_explain_json_for_children(query, writer, is_analyze, no_tmp_tbl);
}
@@ -1299,7 +1360,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
uint select_id, const char *select_type,
bool using_temporary, bool using_filesort)
{
- THD *thd= output->thd;
+ THD *thd= output->thd; // note: for SHOW EXPLAIN, this is target thd.
MEM_ROOT *mem_root= thd->mem_root;
List<Item> item_list;
@@ -1540,7 +1601,7 @@ const char *String_list::append_str(MEM_ROOT *mem_root, const char *str)
}
-static void write_item(Json_writer *writer, Item *item)
+static void write_item(Json_writer *writer, Item *item, bool no_tmp_tbl)
{
THD *thd= current_thd;
char item_buf[256];
@@ -1550,23 +1611,27 @@ static void write_item(Json_writer *writer, Item *item)
ulonglong save_option_bits= thd->variables.option_bits;
thd->variables.option_bits &= ~OPTION_QUOTE_SHOW_CREATE;
- item->print(&str, QT_EXPLAIN);
+ auto qtype= QT_EXPLAIN | (no_tmp_tbl? QT_DONT_ACCESS_TMP_TABLES : 0);
+ item->print(&str, (enum_query_type)qtype);
thd->variables.option_bits= save_option_bits;
writer->add_str(str.c_ptr_safe());
}
-static void append_item_to_str(String *out, Item *item)
+static void append_item_to_str(String *out, Item *item, bool no_tmp_tbl)
{
THD *thd= current_thd;
ulonglong save_option_bits= thd->variables.option_bits;
thd->variables.option_bits &= ~OPTION_QUOTE_SHOW_CREATE;
- item->print(out, QT_EXPLAIN);
+ auto qtype= QT_EXPLAIN | (no_tmp_tbl? QT_DONT_ACCESS_TMP_TABLES : 0);
+ item->print(out, (enum_query_type)qtype);
thd->variables.option_bits= save_option_bits;
}
-void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_tag tag)
+void Explain_table_access::tag_to_json(Json_writer *writer,
+ enum explain_extra_tag tag,
+ bool no_tmp_tbl)
{
switch (tag)
{
@@ -1590,11 +1655,11 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
break;
case ET_USING_INDEX_CONDITION:
writer->add_member("index_condition");
- write_item(writer, pushed_index_cond);
+ write_item(writer, pushed_index_cond, no_tmp_tbl);
break;
case ET_USING_INDEX_CONDITION_BKA:
writer->add_member("index_condition_bka");
- write_item(writer, pushed_index_cond);
+ write_item(writer, pushed_index_cond, no_tmp_tbl);
break;
case ET_USING_WHERE:
{
@@ -1608,7 +1673,7 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
if (item)
{
writer->add_member("attached_condition");
- write_item(writer, item);
+ write_item(writer, item, no_tmp_tbl);
}
}
break;
@@ -1722,7 +1787,7 @@ void Explain_rowid_filter::print_explain_json(Explain_query *query,
void Explain_table_access::print_explain_json(Explain_query *query,
Json_writer *writer,
- bool is_analyze)
+ bool is_analyze, bool no_tmp_tbl)
{
Json_writer_object jsobj(writer);
@@ -1753,7 +1818,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
}
}
writer->add_member("filesort").start_object();
- pre_join_sort->print_json_members(writer, is_analyze);
+ pre_join_sort->print_json_members(writer, is_analyze, no_tmp_tbl);
}
if (bka_type.is_using_jbuf())
@@ -1890,7 +1955,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
for (int i=0; i < (int)extra_tags.elements(); i++)
{
- tag_to_json(writer, extra_tags.at(i));
+ tag_to_json(writer, extra_tags.at(i), no_tmp_tbl);
}
if (full_scan_on_null_key)
@@ -1911,7 +1976,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
if (where_cond)
{
writer->add_member("attached_condition");
- write_item(writer, where_cond);
+ write_item(writer, where_cond, no_tmp_tbl);
}
if (is_analyze)
@@ -1958,7 +2023,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
{
writer->add_member("lateral").add_ll(1);
}
- node->print_explain_json(query, writer, is_analyze);
+ node->print_explain_json(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
if (non_merged_sjm_number)
@@ -1968,7 +2033,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
writer->add_member("unique").add_ll(1);
Explain_node *node= query->get_node(non_merged_sjm_number);
node->connection_type= Explain_node::EXPLAIN_NODE_NON_MERGED_SJ;
- node->print_explain_json(query, writer, is_analyze);
+ node->print_explain_json(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
if (sjm_nest)
@@ -1976,7 +2041,7 @@ void Explain_table_access::print_explain_json(Explain_query *query,
/* This is a non-merged semi-join table. Print its contents here */
writer->add_member("materialized").start_object();
writer->add_member("unique").add_ll(1);
- sjm_nest->print_explain_json(query, writer, is_analyze);
+ sjm_nest->print_explain_json(query, writer, is_analyze, no_tmp_tbl);
writer->end_object();
}
@@ -2282,7 +2347,8 @@ int Explain_delete::print_explain(Explain_query *query,
void Explain_delete::print_explain_json(Explain_query *query,
Json_writer *writer,
- bool is_analyze)
+ bool is_analyze,
+ bool no_tmp_tbl)
{
Json_writer_nesting_guard guard(writer);
@@ -2297,7 +2363,7 @@ void Explain_delete::print_explain_json(Explain_query *query,
writer->end_object(); // query_block
return;
}
- Explain_update::print_explain_json(query, writer, is_analyze);
+ Explain_update::print_explain_json(query, writer, is_analyze, no_tmp_tbl);
}
@@ -2400,7 +2466,8 @@ int Explain_update::print_explain(Explain_query *query,
void Explain_update::print_explain_json(Explain_query *query,
Json_writer *writer,
- bool is_analyze)
+ bool is_analyze,
+ bool no_tmp_tbl)
{
Json_writer_nesting_guard guard(writer);
@@ -2408,7 +2475,7 @@ void Explain_update::print_explain_json(Explain_query *query,
writer->add_member("select_id").add_ll(1);
/* This is the total time it took to do the UPDATE/DELETE */
- if (is_analyze && command_tracker.get_loops())
+ if (is_analyze && command_tracker.has_timed_statistics())
{
writer->add_member("r_total_time_ms").
add_double(command_tracker.get_time_ms());
@@ -2555,7 +2622,7 @@ void Explain_update::print_explain_json(Explain_query *query,
writer->add_member("r_filtered").add_double(r_filtered);
}
- if (table_tracker.get_loops())
+ if (table_tracker.has_timed_statistics())
{
writer->add_member("r_total_time_ms").
add_double(table_tracker.get_time_ms());
@@ -2565,7 +2632,7 @@ void Explain_update::print_explain_json(Explain_query *query,
if (where_cond)
{
writer->add_member("attached_condition");
- write_item(writer, where_cond);
+ write_item(writer, where_cond, no_tmp_tbl);
}
/*** The part of plan that is before the buffering/sorting ends here ***/
@@ -2577,7 +2644,7 @@ void Explain_update::print_explain_json(Explain_query *query,
writer->end_object(); // table
- print_explain_json_for_children(query, writer, is_analyze);
+ print_explain_json_for_children(query, writer, is_analyze, no_tmp_tbl);
writer->end_object(); // query_block
}
@@ -2607,7 +2674,8 @@ int Explain_insert::print_explain(Explain_query *query,
}
void Explain_insert::print_explain_json(Explain_query *query,
- Json_writer *writer, bool is_analyze)
+ Json_writer *writer, bool is_analyze,
+ bool no_tmp_tbl)
{
Json_writer_nesting_guard guard(writer);
@@ -2616,7 +2684,7 @@ void Explain_insert::print_explain_json(Explain_query *query,
writer->add_member("table").start_object();
writer->add_member("table_name").add_str(table_name.c_ptr());
writer->end_object(); // table
- print_explain_json_for_children(query, writer, is_analyze);
+ print_explain_json_for_children(query, writer, is_analyze, no_tmp_tbl);
writer->end_object(); // query_block
}
diff --git a/sql/sql_explain.h b/sql/sql_explain.h
index 7639df4604a..a0f137bb561 100644
--- a/sql/sql_explain.h
+++ b/sql/sql_explain.h
@@ -27,9 +27,8 @@ Query optimization produces two data structures:
produce output of SHOW EXPLAIN, EXPLAIN [FORMAT=JSON], or
ANALYZE [FORMAT=JSON], without accessing the execution data structures.
-(the only exception is that Explain data structures keep Item* pointers,
-and we require that one might call item->print(QT_EXPLAIN) when printing
-FORMAT=JSON output)
+The exception is that Explain data structures have Item* pointers. See
+ExplainDataStructureLifetime below for details.
=== ANALYZE data ===
EXPLAIN data structures have embedded ANALYZE data structures. These are
@@ -135,12 +134,13 @@ public:
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze)=0;
virtual void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze)= 0;
+ bool is_analyze, bool no_tmp_tbl)= 0;
int print_explain_for_children(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json_for_children(Explain_query *query,
- Json_writer *writer, bool is_analyze);
+ Json_writer *writer, bool is_analyze,
+ bool no_tmp_tbl);
bool print_explain_json_cache(Json_writer *writer, bool is_analyze);
virtual ~Explain_node() = default;
};
@@ -174,10 +174,10 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
void print_explain_json_interns(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
/* A flat array of Explain structs for tables. */
Explain_table_access** join_tabs;
@@ -261,7 +261,7 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
Table_access_tracker *get_using_temporary_read_tracker()
{
@@ -304,7 +304,8 @@ public:
Explain_aggr_filesort(MEM_ROOT *mem_root, bool is_analyze,
Filesort *filesort);
- void print_json_members(Json_writer *writer, bool is_analyze);
+ void print_json_members(Json_writer *writer, bool is_analyze,
+ bool no_tmp_tbl);
};
class Explain_aggr_tmp_table : public Explain_aggr_node
@@ -325,7 +326,8 @@ class Explain_aggr_window_funcs : public Explain_aggr_node
public:
enum_explain_aggr_node_type get_type() { return AGGR_OP_WINDOW_FUNCS; }
- void print_json_members(Json_writer *writer, bool is_analyze);
+ void print_json_members(Json_writer *writer, bool is_analyze,
+ bool no_tmp_tbl);
friend class Window_funcs_computation;
};
@@ -336,7 +338,7 @@ extern const char *pushed_derived_text;
extern const char *pushed_select_text;
/*
- Explain structure for a UNION.
+ Explain structure for a UNION [ALL].
A UNION may or may not have "Using filesort".
*/
@@ -378,7 +380,7 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
const char *fake_select_type;
bool using_filesort;
@@ -417,36 +419,54 @@ class Explain_insert;
/*
Explain structure for a query (i.e. a statement).
- This should be able to survive when the query plan was deleted. Currently,
- we do not intend for it survive until after query's MEM_ROOT is freed. It
- does surivive freeing of query's items.
-
- For reference, the process of post-query cleanup is as follows:
+ This should be able to survive when the query plan was deleted. Currently,
+ we do not intend for it survive until after query's MEM_ROOT is freed.
+
+ == ExplainDataStructureLifetime ==
>dispatch_command
| >mysql_parse
- | | ...
- | | lex_end()
- | | ...
- | | >THD::cleanup_after_query
- | | | ...
- | | | free_items()
- | | | ...
- | | <THD::cleanup_after_query
+ | | ...
+ | |
+ | | explain->query_plan_ready(); // (1)
+ | |
+ | | some_join->cleanup(); // (2)
+ | |
+ | | explain->notify_tables_are_closed(); // (3)
+ | | close_thread_tables(); // (4)
+ | | ...
+ | | free_items(); // (5)
+ | | ...
| |
| <mysql_parse
|
- | log_slow_statement()
- |
+ | log_slow_statement() // (6)
+ |
| free_root()
- |
+ |
>dispatch_command
-
- That is, the order of actions is:
- - free query's Items
- - write to slow query log
- - free query's MEM_ROOT
-
+
+ (1) - Query plan construction is finished and it is available for reading.
+
+ (2) - Temporary tables are freed. After this point,
+ we need to pass QT_DONT_ACCESS_TMP_TABLES to item->print(). Since
+ we don't track when #2 happens for each temp.table, we pass this
+ flag whenever we're printing the query plan for a SHOW command.
+ Also, we pass it when printing ANALYZE (?)
+
+ (3) - Notification about (4).
+ (4) - Tables used by the query are closed. One known consequence of this is
+ that the values of the const tables' fields are not available anymore.
+ We could use the same approach as in QT_DONT_ACCESS_TMP_TABLES to work
+ around that, but instead we disallow producing FORMAT=JSON output at
+ step #3. We also processing of SHOW command. The rationale is that
+ query is close to finish anyway.
+
+ (5) - Item objects are freed. After this, it's certainly not possible to
+ print them into FORMAT=JSON output.
+
+ (6) - We may decide to log tabular EXPLAIN output to the slow query log.
+
*/
class Explain_query : public Sql_alloc
@@ -478,12 +498,15 @@ public:
/* Return tabular EXPLAIN output as a text string */
bool print_explain_str(THD *thd, String *out_str, bool is_analyze);
- void print_explain_json(select_result_sink *output, bool is_analyze);
+ int print_explain_json(select_result_sink *output, bool is_analyze,
+ bool is_show_cmd,
+ ulonglong query_time_in_progress_ms= 0);
/* If true, at least part of EXPLAIN can be printed */
bool have_query_plan() { return insert_plan || upd_del_plan|| get_node(1) != NULL; }
void query_plan_ready();
+ void notify_tables_are_closed();
MEM_ROOT *mem_root;
@@ -498,7 +521,7 @@ private:
Dynamic_array<Explain_union*> unions;
Dynamic_array<Explain_select*> selects;
- THD *thd; // for APC start/stop
+ THD *stmt_thd; // for APC start/stop
bool apc_enabled;
/*
Debugging aid: count how many times add_node() was called. Ideally, it
@@ -507,6 +530,9 @@ private:
is unacceptable.
*/
longlong operations;
+#ifndef DBUG_OFF
+ bool can_print_json= false;
+#endif
};
@@ -865,14 +891,15 @@ public:
uint select_id, const char *select_type,
bool using_temporary, bool using_filesort);
void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
private:
void append_tag_name(String *str, enum explain_extra_tag tag);
void fill_key_str(String *key_str, bool is_json) const;
void fill_key_len_str(String *key_len_str, bool is_json) const;
double get_r_filtered();
- void tag_to_json(Json_writer *writer, enum explain_extra_tag tag);
+ void tag_to_json(Json_writer *writer, enum explain_extra_tag tag,
+ bool no_tmp_tbl);
};
@@ -955,7 +982,7 @@ public:
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
virtual void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
};
@@ -981,7 +1008,7 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
};
@@ -1008,7 +1035,7 @@ public:
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
virtual void print_explain_json(Explain_query *query, Json_writer *writer,
- bool is_analyze);
+ bool is_analyze, bool no_tmp_tbl);
};
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 3a5bf9edbe2..d7673f70395 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1227,6 +1227,7 @@ values_loop_end:
if (error <= 0 ||
thd->transaction->stmt.modified_non_trans_table ||
+ thd->log_current_statement() ||
was_insert_delayed)
{
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
@@ -1249,8 +1250,8 @@ values_loop_end:
else
errcode= query_error_code(thd, thd->killed == NOT_KILLED);
- ScopedStatementReplication scoped_stmt_rpl(
- table->versioned(VERS_TRX_ID) ? thd : NULL);
+ StatementBinlog stmt_binlog(thd, table->versioned(VERS_TRX_ID) ||
+ thd->binlog_need_stmt_format(transactional_table));
/* bug#22725:
A query which per-row-loop can not be interrupted with
@@ -4276,7 +4277,8 @@ bool select_insert::prepare_eof()
ha_autocommit_or_rollback() is issued below.
*/
if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) &&
- (likely(!error) || thd->transaction->stmt.modified_non_trans_table))
+ (likely(!error) || thd->transaction->stmt.modified_non_trans_table ||
+ thd->log_current_statement()))
{
int errcode= 0;
int res;
@@ -4284,6 +4286,8 @@ bool select_insert::prepare_eof()
thd->clear_error();
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
+ StatementBinlog stmt_binlog(thd, !can_rollback_data() &&
+ thd->binlog_need_stmt_format(trans_table));
res= thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
trans_table, FALSE, FALSE, errcode);
@@ -4397,13 +4401,15 @@ void select_insert::abort_result_set()
changed= (info.copied || info.deleted || info.updated);
transactional_table= table->file->has_transactions_and_rollback();
if (thd->transaction->stmt.modified_non_trans_table ||
- thd->log_current_statement)
+ thd->log_current_statement())
{
if (!can_rollback_data())
thd->transaction->all.modified_non_trans_table= TRUE;
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
+ StatementBinlog stmt_binlog(thd, !can_rollback_data() &&
+ thd->binlog_need_stmt_format(transactional_table));
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
int res;
/* error of writing binary log is ignored */
@@ -5289,7 +5295,7 @@ void select_create::abort_result_set()
drop_open_table(thd, table, &create_table->db, &create_table->table_name);
table=0; // Safety
- if (thd->log_current_statement)
+ if (thd->log_current_statement())
{
if (mysql_bin_log.is_open())
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 807fcd3ba12..50e214b0e57 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -546,36 +546,10 @@ bool LEX::add_alter_list(LEX_CSTRING name, LEX_CSTRING new_name, bool exists)
void LEX::init_last_field(Column_definition *field,
- const LEX_CSTRING *field_name,
- const CHARSET_INFO *cs)
+ const LEX_CSTRING *field_name)
{
last_field= field;
-
field->field_name= *field_name;
-
- /* reset LEX fields that are used in Create_field::set_and_check() */
- charset= cs;
-}
-
-
-bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin)
-{
- /*
- if charset is NULL - we're parsing a field declaration.
- we cannot call find_bin_collation for a field here, because actual
- field charset is determined in get_sql_field_charset() much later.
- so we only set a flag.
- */
- if (!charset)
- {
- charset= cs;
- last_field->flags|= bin ? BINCMP_FLAG : 0;
- return false;
- }
-
- charset= bin ? find_bin_collation(cs ? cs : charset)
- : cs ? cs : charset;
- return charset == NULL;
}
@@ -5831,17 +5805,33 @@ bool st_select_lex::is_merged_child_of(st_select_lex *ancestor)
}
/*
- This is used by SHOW EXPLAIN. It assuses query plan has been already
+ This is used by SHOW EXPLAIN|ANALYZE. It assumes query plan has been already
collected into QPF structures and we only need to print it out.
*/
int LEX::print_explain(select_result_sink *output, uint8 explain_flags,
- bool is_analyze, bool *printed_anything)
+ bool is_analyze, bool is_json_format,
+ bool *printed_anything)
{
int res;
if (explain && explain->have_query_plan())
{
- res= explain->print_explain(output, explain_flags, is_analyze);
+ if (is_json_format)
+ {
+ auto now= microsecond_interval_timer();
+ auto start_time= thd->start_utime;
+ auto query_time_in_progress_ms= 0ULL;
+ if (likely(now > start_time))
+ query_time_in_progress_ms=
+ (now - start_time) / (HRTIME_RESOLUTION / 1000);
+ res= explain->print_explain_json(output, is_analyze,
+ true /* is_show_cmd */,
+ query_time_in_progress_ms);
+ }
+ else
+ {
+ res= explain->print_explain(output, explain_flags, is_analyze);
+ }
*printed_anything= true;
}
else
@@ -6382,8 +6372,7 @@ sp_variable *LEX::sp_param_init(LEX_CSTRING *name)
return NULL;
}
sp_variable *spvar= spcont->add_variable(thd, name);
- init_last_field(&spvar->field_def, name,
- thd->variables.collation_database);
+ init_last_field(&spvar->field_def, name);
return spvar;
}
@@ -6392,8 +6381,7 @@ bool LEX::sp_param_fill_definition(sp_variable *spvar,
const Lex_field_type_st &def)
{
return
- last_field->set_attributes(thd, def, charset,
- COLUMN_DEFINITION_ROUTINE_PARAM) ||
+ last_field->set_attributes(thd, def, COLUMN_DEFINITION_ROUTINE_PARAM) ||
sphead->fill_spvar_definition(thd, last_field, &spvar->name);
}
@@ -6401,8 +6389,7 @@ bool LEX::sp_param_fill_definition(sp_variable *spvar,
bool LEX::sf_return_fill_definition(const Lex_field_type_st &def)
{
return
- last_field->set_attributes(thd, def, charset,
- COLUMN_DEFINITION_FUNCTION_RETURN) ||
+ last_field->set_attributes(thd, def, COLUMN_DEFINITION_FUNCTION_RETURN) ||
sphead->fill_field_definition(thd, last_field);
}
@@ -6482,8 +6469,7 @@ void LEX::sp_variable_declarations_init(THD *thd, int nvars)
sphead->reset_lex(thd);
spcont->declare_var_boundary(nvars);
- thd->lex->init_last_field(&spvar->field_def, &spvar->name,
- thd->variables.collation_database);
+ thd->lex->init_last_field(&spvar->field_def, &spvar->name);
}
@@ -9762,7 +9748,11 @@ bool LEX::part_values_history(THD *thd)
}
else
{
- part_info->vers_init_info(thd);
+ if (unlikely(part_info->vers_init_info(thd)))
+ {
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ return true;
+ }
elem->id= UINT_MAX32;
}
DBUG_ASSERT(part_info->vers_info);
@@ -11520,16 +11510,15 @@ Spvar_definition *LEX::row_field_name(THD *thd, const Lex_ident_sys_st &name)
}
if (unlikely(!(res= new (thd->mem_root) Spvar_definition())))
return NULL;
- init_last_field(res, &name, thd->variables.collation_database);
+ init_last_field(res, &name);
return res;
}
Item *
-Lex_cast_type_st::create_typecast_item_or_error(THD *thd, Item *item,
- CHARSET_INFO *cs) const
+Lex_cast_type_st::create_typecast_item_or_error(THD *thd, Item *item) const
{
- Item *tmp= create_typecast_item(thd, item, cs);
+ Item *tmp= create_typecast_item(thd, item);
if (!tmp)
{
Name name= m_type_handler->name();
@@ -11543,14 +11532,42 @@ Lex_cast_type_st::create_typecast_item_or_error(THD *thd, Item *item,
}
-void Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
- const char *length,
- uint32 flags)
+void
+Lex_length_and_dec_st::set(const char *plength, const char *pdec)
+{
+ reset();
+
+ if ((m_has_explicit_length= (plength != nullptr)))
+ {
+ int err;
+ ulonglong tmp= my_strtoll10(plength, NULL, &err);
+ if ((m_length_overflowed= (tmp > UINT_MAX32 || err)))
+ m_length= UINT_MAX32;
+ else
+ m_length= (uint32) tmp;
+ }
+
+ if ((m_has_explicit_dec= (pdec != nullptr)))
+ {
+ int err;
+ ulonglong tmp= my_strtoll10(pdec, NULL, &err);
+ if ((m_dec_overflowed= (tmp > 255 || err)))
+ m_dec= 255;
+ else
+ m_dec= (uint8) tmp;
+ }
+}
+
+
+void
+Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
+ const Lex_length_and_dec_st &attr,
+ uint32 flags)
{
DBUG_ASSERT(!handler->is_unsigned());
+ set(handler, attr);
if (flags & UNSIGNED_FLAG)
- handler= handler->type_handler_unsigned();
- set(handler, length, NULL);
+ m_handler= m_handler->type_handler_unsigned();
}
@@ -11561,8 +11578,7 @@ bool LEX::set_field_type_udt(Lex_field_type_st *type,
const Type_handler *h;
if (!(h= Type_handler::handler_by_name_or_error(thd, name)))
return true;
- type->set(h, attr);
- charset= &my_charset_bin;
+ type->set(h, attr, &my_charset_bin);
return false;
}
@@ -11574,7 +11590,6 @@ bool LEX::set_cast_type_udt(Lex_cast_type_st *type,
if (!(h= Type_handler::handler_by_name_or_error(thd, name)))
return true;
type->set(h);
- charset= NULL;
return false;
}
@@ -11820,6 +11835,21 @@ bool LEX::sp_create_set_password_instr(THD *thd,
}
+bool LEX::set_names(const char *pos,
+ const Lex_exact_charset_opt_extended_collate &cscl,
+ bool no_lookahead)
+{
+ if (sp_create_assignment_lex(thd, pos))
+ return true;
+ CHARSET_INFO *ci= cscl.collation().charset_info();
+ set_var_collation_client *var;
+ var= new (thd->mem_root) set_var_collation_client(ci, ci, ci);
+ return unlikely(var == NULL) ||
+ unlikely(thd->lex->var_list.push_back(var, thd->mem_root)) ||
+ unlikely(sp_create_assignment_instr(thd, no_lookahead));
+}
+
+
bool LEX::map_data_type(const Lex_ident_sys_st &schema_name,
Lex_field_type_st *type) const
{
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index c9a1f8678d8..53510fb913b 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -3191,8 +3191,6 @@ public:
/* Query Plan Footprint of a currently running select */
Explain_query *explain;
- // type information
- CHARSET_INFO *charset;
/*
LEX which represents current statement (conventional, SP or PS)
@@ -3815,17 +3813,16 @@ public:
bool save_prep_leaf_tables();
int print_explain(select_result_sink *output, uint8 explain_flags,
- bool is_analyze, bool *printed_anything);
+ bool is_analyze, bool is_json_format,
+ bool *printed_anything);
bool restore_set_statement_var();
- void init_last_field(Column_definition *field, const LEX_CSTRING *name,
- const CHARSET_INFO *cs);
+ void init_last_field(Column_definition *field, const LEX_CSTRING *name);
bool last_field_generated_always_as_row_start_or_end(Lex_ident *p,
const char *type,
uint flags);
bool last_field_generated_always_as_row_start();
bool last_field_generated_always_as_row_end();
- bool set_bincmp(CHARSET_INFO *cs, bool bin);
bool new_sp_instr_stmt(THD *, const LEX_CSTRING &prefix,
const LEX_CSTRING &suffix);
@@ -3839,6 +3836,9 @@ public:
int case_stmt_action_then();
bool setup_select_in_parentheses();
+ bool set_names(const char *pos,
+ const Lex_exact_charset_opt_extended_collate &cs,
+ bool no_lookahead);
bool set_trigger_new_row(const LEX_CSTRING *name, Item *val);
bool set_trigger_field(const LEX_CSTRING *name1, const LEX_CSTRING *name2,
Item *val);
@@ -4408,6 +4408,23 @@ public:
bool add_alter_list(LEX_CSTRING par_name, Virtual_column_info *expr,
bool par_exists);
bool add_alter_list(LEX_CSTRING name, LEX_CSTRING new_name, bool exists);
+ bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs)
+ {
+ if (create_info.add_table_option_convert_charset(cs))
+ return true;
+ alter_info.flags|= ALTER_CONVERT_TO;
+ return false;
+ }
+ bool
+ add_alter_list_item_convert_to_charset(CHARSET_INFO *cs,
+ const Lex_extended_collation_st &cl)
+ {
+ if (create_info.add_table_option_convert_charset(cs) ||
+ create_info.add_table_option_convert_collation(cl))
+ return true;
+ alter_info.flags|= ALTER_CONVERT_TO;
+ return false;
+ }
void set_command(enum_sql_command command,
DDL_options_st options)
{
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 9fe2506bbae..7589dc51a12 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -43,9 +43,7 @@
// mysql_alter_db,
// check_db_dir_existence,
// my_dbopt_cleanup
-#include "sql_table.h" // mysql_create_like_table,
- // mysql_create_table,
- // mysql_alter_table,
+#include "sql_table.h" // mysql_alter_table,
// mysql_backup_table,
// mysql_restore_table
#include "sql_reload.h" // reload_acl_and_cache
@@ -84,6 +82,7 @@
#include "events.h"
#include "sql_trigger.h"
#include "transaction.h"
+#include "sql_alter.h"
#include "sql_audit.h"
#include "sql_prepare.h"
#include "sql_cte.h"
@@ -665,6 +664,7 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_SHOW_ENGINE_MUTEX]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_ENGINE_LOGS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_EXPLAIN]= CF_STATUS_COMMAND;
+ sql_command_flags[SQLCOM_SHOW_ANALYZE]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_GRANTS]= CF_STATUS_COMMAND;
sql_command_flags[SQLCOM_SHOW_CREATE_USER]= CF_STATUS_COMMAND;
@@ -3867,6 +3867,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
break;
}
case SQLCOM_SHOW_EXPLAIN:
+ case SQLCOM_SHOW_ANALYZE:
{
if (!thd->security_ctx->priv_user[0] &&
check_global_access(thd, PRIV_STMT_SHOW_EXPLAIN))
@@ -4191,7 +4192,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
*/
{
/* Prepare stack copies to be re-execution safe */
- HA_CREATE_INFO create_info;
+ Table_specification_st create_info;
Alter_info alter_info(lex->alter_info, thd->mem_root);
if (unlikely(thd->is_fatal_error)) /* out of memory creating alter_info */
@@ -4201,10 +4202,9 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
if (check_one_table_access(thd, INDEX_ACL, all_tables))
goto error; /* purecov: inspected */
- bzero((char*) &create_info, sizeof(create_info));
+ create_info.init();
create_info.db_type= 0;
create_info.row_type= ROW_TYPE_NOT_USED;
- create_info.default_table_charset= thd->variables.collation_database;
create_info.alter_info= &alter_info;
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
@@ -4931,7 +4931,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
status_var_increment(thd->status_var.com_drop_tmp_table);
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
- thd->variables.option_bits|= OPTION_KEEP_LOG;
+ thd->variables.option_bits|= OPTION_BINLOG_THIS_TRX;
}
/*
If we are a slave, we should add IF EXISTS if the query executed
@@ -5177,6 +5177,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
&lex->name))
break;
+ if ((res= lex->create_info.resolve_to_charset_collation_context(thd,
+ thd->charset_collation_context_create_db())))
+ break;
+
WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL);
res= mysql_create_db(thd, &lex->name,
@@ -5238,6 +5242,10 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
if (prepare_db_action(thd, ALTER_ACL, db))
break;
+ if ((res= lex->create_info.resolve_to_charset_collation_context(thd,
+ thd->charset_collation_context_alter_db(lex->name.str))))
+ break;
+
WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL);
res= mysql_alter_db(thd, db, &lex->create_info);
@@ -6069,8 +6077,7 @@ finish:
}
/* Free tables. Set stage 'closing tables' */
- close_thread_tables(thd);
-
+ close_thread_tables_for_query(thd);
#ifndef DBUG_OFF
if (lex->sql_command != SQLCOM_SET_OPTION && ! thd->in_sub_stmt)
@@ -6218,7 +6225,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
result->remove_offset_limit();
if (lex->explain_json)
{
- lex->explain->print_explain_json(result, lex->analyze_stmt);
+ lex->explain->print_explain_json(result, lex->analyze_stmt,
+ false /* is_show_cmd */);
}
else
{
@@ -7570,9 +7578,10 @@ void THD::reset_for_next_command(bool do_clear_error)
global_system_variables.auto_increment_increment;
}
#endif /* WITH_WSREP */
+
query_start_sec_part_used= 0;
is_fatal_error= time_zone_used= 0;
- log_current_statement= 0;
+ variables.option_bits&= ~OPTION_BINLOG_THIS_STMT;
/*
Clear the status flag that are expected to be cleared at the
@@ -7581,12 +7590,12 @@ void THD::reset_for_next_command(bool do_clear_error)
server_status&= ~SERVER_STATUS_CLEAR_SET;
/*
If in autocommit mode and not in a transaction, reset
- OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG to not get warnings
+ OPTION_STATUS_NO_TRANS_UPDATE | OPTION_BINLOG_THIS_TRX to not get warnings
in ha_rollback_trans() about some tables couldn't be rolled back.
*/
if (!in_multi_stmt_transaction_mode())
{
- variables.option_bits&= ~OPTION_KEEP_LOG;
+ variables.option_bits&= ~OPTION_BINLOG_THIS_TRX;
transaction->all.reset();
}
DBUG_ASSERT(security_ctx== &main_security_ctx);
@@ -10481,58 +10490,6 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
*/
-
-/**
- Check and merge "CHARACTER SET cs [ COLLATE cl ]" clause
-
- @param cs character set pointer.
- @param cl collation pointer.
-
- Check if collation "cl" is applicable to character set "cs".
-
- If "cl" is NULL (e.g. when COLLATE clause is not specified),
- then simply "cs" is returned.
-
- @return Error status.
- @retval NULL, if "cl" is not applicable to "cs".
- @retval pointer to merged CHARSET_INFO on success.
-*/
-
-
-CHARSET_INFO*
-merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl)
-{
- if (cl)
- {
- if (!my_charset_same(cs, cl))
- {
- my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), cl->coll_name.str,
- cs->cs_name.str);
- return NULL;
- }
- return cl;
- }
- return cs;
-}
-
-/** find a collation with binary comparison rules
-*/
-CHARSET_INFO *find_bin_collation(CHARSET_INFO *cs)
-{
- const char *csname= cs->cs_name.str;
- THD *thd= current_thd;
- myf utf8_flag= thd->get_utf8_flag();
-
- cs= get_charset_by_csname(csname, MY_CS_BINSORT, MYF(utf8_flag));
- if (!cs)
- {
- char tmp[65];
- strxnmov(tmp, sizeof(tmp)-1, csname, "_bin", NULL);
- my_error(ER_UNKNOWN_COLLATION, MYF(0), tmp);
- }
- return cs;
-}
-
void LEX::mark_first_table_as_inserting()
{
TABLE_LIST *t= first_select_lex()->table_list.first;
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index ebe3fe97114..d3cf83b6e08 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -78,8 +78,6 @@ bool check_string_char_length(const LEX_CSTRING *str, uint err_msg,
size_t max_char_length, CHARSET_INFO *cs,
bool no_error);
bool check_ident_length(const LEX_CSTRING *ident);
-CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
-CHARSET_INFO *find_bin_collation(CHARSET_INFO *cs);
bool check_host_name(LEX_CSTRING *str);
bool check_identifier_name(LEX_CSTRING *str, uint max_char_length,
uint err_code, const char *param_for_err_msg);
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 9c7f25e8808..ba9a370a068 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -2643,11 +2643,17 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info,
err+= str.append('\'');
}
}
- if (vers_info->limit)
+ else if (vers_info->limit)
{
err+= str.append(STRING_WITH_LEN("LIMIT "));
err+= str.append_ulonglong(vers_info->limit);
}
+ if (vers_info->auto_hist)
+ {
+ DBUG_ASSERT(vers_info->interval.is_set() ||
+ vers_info->limit);
+ err+= str.append(STRING_WITH_LEN(" AUTO"));
+ }
}
else if (part_info->part_expr)
{
@@ -5114,6 +5120,10 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
+ /*
+ Adding history partitions to non-history partitioning or
+ non-history parittions to history partitioning is prohibited.
+ */
else if (thd->work_part_info->part_type == VERSIONING_PARTITION ||
tab_part_info->part_type == VERSIONING_PARTITION)
{
@@ -5389,11 +5399,14 @@ that are reorganised.
{
if (el->type == partition_element::CURRENT)
{
+ /* now_part is always last partition, we add it to the end of partitions list. */
it.remove();
now_part= el;
}
}
- if (*fast_alter_table && tab_part_info->vers_info->interval.is_set())
+ if (*fast_alter_table &&
+ !(alter_info->partition_flags & ALTER_PARTITION_AUTO_HIST) &&
+ tab_part_info->vers_info->interval.is_set())
{
partition_element *hist_part= tab_part_info->vers_info->hist_part;
if (hist_part->range_value <= thd->query_start())
@@ -6016,11 +6029,36 @@ the generated partition syntax in a correct manner.
{
partition_info *part_info= thd->work_part_info;
bool is_native_partitioned= FALSE;
+ if (tab_part_info && tab_part_info->part_type == VERSIONING_PARTITION &&
+ tab_part_info != part_info && part_info->part_type == VERSIONING_PARTITION &&
+ part_info->num_parts == 0)
+ {
+ if (part_info->vers_info->interval.is_set() && (
+ !tab_part_info->vers_info->interval.is_set() ||
+ /* TODO: equivalent intervals like 1 hour and 60 mins should be considered equal */
+ memcmp(&part_info->vers_info->interval,
+ &tab_part_info->vers_info->interval,
+ sizeof(Vers_part_info::interval))))
+ {
+ /* If interval is changed we can not do fast alter */
+ tab_part_info= tab_part_info->get_clone(thd);
+ }
+ else
+ {
+ /* NOTE: fast_alter_partition_table() works on existing TABLE data. */
+ *fast_alter_table= true;
+ table->mark_table_for_reopen();
+ }
+ *tab_part_info->vers_info= *part_info->vers_info;
+ thd->work_part_info= part_info= tab_part_info;
+ *partition_changed= true;
+ }
+
/*
Need to cater for engine types that can handle partition without
using the partition handler.
*/
- if (part_info != tab_part_info)
+ else if (part_info != tab_part_info)
{
if (part_info->fix_parser_data(thd))
{
@@ -6105,7 +6143,7 @@ err:
records are added
*/
-static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
+static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt, bool copy_data)
{
char path[FN_REFLEN+1];
int error;
@@ -6115,7 +6153,7 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
build_table_filename(path, sizeof(path) - 1, lpt->db.str, lpt->table_name.str, "", 0);
- if(mysql_trans_prepare_alter_copy_data(thd))
+ if(copy_data && mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(TRUE);
/* TODO: test if bulk_insert would increase the performance */
@@ -6129,7 +6167,9 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
file->print_error(error, MYF(error != ER_OUTOFMEMORY ? 0 : ME_FATAL));
}
- if (mysql_trans_commit_alter_copy_data(thd))
+ DBUG_ASSERT(copy_data || (!lpt->copied && !lpt->deleted));
+
+ if (copy_data && mysql_trans_commit_alter_copy_data(thd))
error= 1; /* The error has been reported */
DBUG_RETURN(MY_TEST(error));
@@ -7429,7 +7469,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
thd->variables.option_bits|= OPTION_IF_EXISTS;
if (table->file->alter_table_flags(alter_info->flags) &
- HA_PARTITION_ONE_PHASE)
+ HA_PARTITION_ONE_PHASE &&
+ !(alter_info->partition_flags & ALTER_PARTITION_AUTO_HIST))
{
/*
In the case where the engine supports one phase online partition
@@ -7471,7 +7512,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
2) Perform the change within the handler
*/
if (mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
- mysql_change_partitions(lpt))
+ mysql_change_partitions(lpt, true))
{
goto err;
}
@@ -7664,9 +7705,14 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT("convert_partition_11"))
goto err;
}
+ /*
+ TODO: would be good if adding new empty VERSIONING partitions would always
+ go this way, auto or not.
+ */
else if ((alter_info->partition_flags & ALTER_PARTITION_ADD) &&
(part_info->part_type == RANGE_PARTITION ||
- part_info->part_type == LIST_PARTITION))
+ part_info->part_type == LIST_PARTITION ||
+ alter_info->partition_flags & ALTER_PARTITION_AUTO_HIST))
{
DBUG_ASSERT(!(alter_info->partition_flags & ALTER_PARTITION_CONVERT_IN));
/*
@@ -7707,7 +7753,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT("add_partition_3") ||
write_log_add_change_partition(lpt) ||
ERROR_INJECT("add_partition_4") ||
- mysql_change_partitions(lpt) ||
+ mysql_change_partitions(lpt, false) ||
ERROR_INJECT("add_partition_5") ||
alter_close_table(lpt) ||
ERROR_INJECT("add_partition_6") ||
@@ -7794,7 +7840,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
ERROR_INJECT("change_partition_2") ||
write_log_add_change_partition(lpt) ||
ERROR_INJECT("change_partition_3") ||
- mysql_change_partitions(lpt) ||
+ mysql_change_partitions(lpt, true) ||
ERROR_INJECT("change_partition_4") ||
wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED) ||
ERROR_INJECT("change_partition_5") ||
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index fcc08b69af4..d290d0f5534 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -196,7 +196,8 @@ static bool check_exchange_partition(TABLE *table, TABLE *part_table)
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;
+ HA_CREATE_INFO table_create_info;
+ Table_specification_st part_create_info;
Alter_info part_alter_info;
Alter_table_ctx part_alter_ctx; // Not used
DBUG_ENTER("compare_table_with_partition");
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 4ff5a679ffd..6b337eae8d1 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -4444,7 +4444,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
/* No need to commit statement transaction, it's not started. */
DBUG_ASSERT(thd->transaction->stmt.is_empty());
- close_thread_tables(thd);
+ close_thread_tables_for_query(thd);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
/*
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 2f1f7166432..9f3849ef0b9 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -134,7 +134,7 @@
#define OPTION_BEGIN (1ULL << 20) // THD, intern
#define OPTION_TABLE_LOCK (1ULL << 21) // THD, intern
#define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE)
-#define OPTION_KEEP_LOG (1ULL << 23) // THD, user
+#define OPTION_BINLOG_THIS_TRX (1ULL << 23) // THD
#define OPTION_EXPLICIT_DEF_TIMESTAMP (1ULL << 24) // THD, user
#define OPTION_GTID_BEGIN (1ULL << 25) // GTID BEGIN found in log
@@ -174,6 +174,9 @@
*/
#define OPTION_MASTER_SQL_ERROR (1ULL << 35)
+#define OPTION_BINLOG_THIS_STMT (1ULL << 36) // THD
+#define OPTION_BINLOG_THIS (OPTION_BINLOG_THIS_STMT | OPTION_BINLOG_THIS_TRX)
+
#define OPTION_SKIP_REPLICATION (1ULL << 37) // THD, user
#define OPTION_RPL_SKIP_PARALLEL (1ULL << 38)
#define OPTION_NO_QUERY_CACHE (1ULL << 39) // SELECT, user
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 683f72d4457..beeaf1f689f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -376,6 +376,33 @@ bool dbug_user_var_equals_int(THD *thd, const char *name, int value)
}
return FALSE;
}
+
+/*
+ Debugging : check if @name= value, comparing as string
+
+ Intended usage :
+
+ DBUG_EXECUTE_IF("log_slow_statement_end",
+ if (dbug_user_var_equals_str(thd, "show_explain_probe_query",
+ thd->query()))
+ dbug_serve_apcs(thd, 1);
+ );
+*/
+
+bool dbug_user_var_equals_str(THD *thd, const char *name, const char* value)
+{
+ user_var_entry *var;
+ LEX_CSTRING varname= {name, strlen(name)};
+ if ((var= get_variable(&thd->user_vars, &varname, FALSE)))
+ {
+ bool null_value;
+ String str;
+ auto var_value= var->val_str(&null_value, &str, 10)->ptr();
+ if (!null_value && !strncmp(var_value, value, strlen(value)))
+ return TRUE;
+ }
+ return FALSE;
+}
#endif /* DBUG_OFF */
/*
@@ -16174,7 +16201,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++))
{
- if (item_equal->fix_length_and_dec())
+ if (item_equal->fix_length_and_dec(thd))
return NULL;
item_equal->update_used_tables();
set_if_bigger(thd->lex->current_select->max_equal_elems,
@@ -19471,8 +19498,9 @@ bool Create_tmp_table::add_fields(THD *thd,
thd->mem_root= mem_root_save;
if (!(tmp_item= new (thd->mem_root)
- Item_temptable_field(thd, new_field)))
+ Item_field(thd, new_field)))
goto err;
+ ((Item_field*) tmp_item)->set_refers_to_temp_table(true);
arg= sum_item->set_arg(i, thd, tmp_item);
thd->mem_root= &table->mem_root;
@@ -26716,9 +26744,10 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
*/
Item_func_set_user_var* suv=
new (thd->mem_root) Item_func_set_user_var(thd, (Item_func_set_user_var*) item);
- Item_field *new_field= new (thd->mem_root) Item_temptable_field(thd, field);
+ Item_field *new_field= new (thd->mem_root) Item_field(thd, field);
if (!suv || !new_field)
DBUG_RETURN(true); // Fatal error
+ new_field->set_refers_to_temp_table(true);
List<Item> list;
list.push_back(new_field, thd->mem_root);
suv->set_arguments(thd, list);
@@ -26730,9 +26759,15 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
else if ((field= item->get_tmp_table_field()))
{
if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
+ {
item_field= ((Item_sum*) item)->result_item(thd, field);
+ }
else
- item_field= (Item *) new (thd->mem_root) Item_temptable_field(thd, field);
+ {
+ item_field= (Item*) new (thd->mem_root) Item_field(thd, field);
+ if (item_field)
+ ((Item_field*) item_field)->set_refers_to_temp_table(true);
+ }
if (!item_field)
DBUG_RETURN(true); // Fatal error
@@ -27550,6 +27585,7 @@ int print_explain_message_line(select_result_sink *result,
ha_rows *rows,
const char *message)
{
+ /* Note: for SHOW EXPLAIN, this is caller thread's THD */
THD *thd= result->thd;
MEM_ROOT *mem_root= thd->mem_root;
Item *item_null= new (mem_root) Item_null(thd);
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 88e6fd4e30f..d5ca921d8d5 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -2534,4 +2534,5 @@ void propagate_new_equalities(THD *thd, Item *cond,
COND_EQUAL *inherited,
bool *is_simplifiable_cond);
+bool dbug_user_var_equals_str(THD *thd, const char *name, const char *value);
#endif /* SQL_SELECT_INCLUDED */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 0cc05ebdfcc..6baa82ca963 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2917,8 +2917,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
Item_empty_string(thd, "Info", arg.max_query_length),
mem_root);
field->set_maybe_null();;
- if (!thd->variables.old_mode &&
- !(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
+ if (!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
{
field_list.push_back(field= new (mem_root)
Item_float(thd, "Progress", 0.0, 3, 7),
@@ -2960,8 +2959,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->query_string.charset());
else
protocol->store_null();
- if (!thd->variables.old_mode &&
- !(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
+ if (!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
protocol->store_double(thd_info->progress, 3);
if (protocol->write())
break; /* purecov: inspected */
@@ -2995,13 +2993,18 @@ void Show_explain_request::call_in_target_thread()
target_thd->query_charset());
DBUG_ASSERT(current_thd == target_thd);
- set_current_thd(request_thd);
+
+ /*
+ When producing JSON output, one should not change current_thd.
+ (If one does that, they will hit an assert when printing constant item
+ fields).
+ */
if (target_thd->lex->print_explain(explain_buf, 0 /* explain flags*/,
- false /*TODO: analyze? */, &printed_anything))
+ is_analyze, is_json_format,
+ &printed_anything))
{
failed_to_produce= TRUE;
}
- set_current_thd(target_thd);
if (!printed_anything)
failed_to_produce= TRUE;
@@ -3020,6 +3023,8 @@ int select_result_explain_buffer::send_data(List<Item> &items)
Switch to the receiveing thread, so that we correctly count memory used
by it. This is needed as it's the receiving thread that will free the
memory.
+ (TODO: Now that we don't change current_thd in
+ Show_explain_request::call_in_target_thread, is this necessary anymore?)
*/
set_current_thd(thd);
fill_record(thd, dst_table, dst_table->field, items, TRUE, FALSE);
@@ -3115,15 +3120,16 @@ void select_result_text_buffer::save_to(String *res)
/*
- Store the SHOW EXPLAIN output in the temporary table.
+ Store the SHOW EXPLAIN/SHOW ANALYZE output in the temporary table.
*/
-int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
+int fill_show_explain_or_analyze(THD *thd, TABLE_LIST *table, COND *cond,
+ bool json_format, bool is_analyze)
{
const char *calling_user;
THD *tmp;
my_thread_id thread_id;
- DBUG_ENTER("fill_show_explain");
+ DBUG_ENTER("fill_show_explain_or_analyze");
DBUG_ASSERT(cond==NULL);
thread_id= thd->lex->value_list.head()->val_int();
@@ -3135,10 +3141,10 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
Security_context *tmp_sctx= tmp->security_ctx;
/*
If calling_user==NULL, calling thread has SUPER or PROCESS
- privilege, and so can do SHOW EXPLAIN on any user.
+ privilege, and so can do SHOW EXPLAIN/SHOW ANALYZE on any user.
- if calling_user!=NULL, he's only allowed to view SHOW EXPLAIN on
- his own threads.
+ if calling_user!=NULL, he's only allowed to view
+ SHOW EXPLAIN/SHOW ANALYZE on his own threads.
*/
if (calling_user && (!tmp_sctx->user || strcmp(calling_user,
tmp_sctx->user)))
@@ -3158,15 +3164,17 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
bool bres;
/*
Ok we've found the thread of interest and it won't go away because
- we're holding its LOCK_thd_kill. Post it a SHOW EXPLAIN request.
+ we're holding its LOCK_thd_kill. Post it a SHOW EXPLAIN/SHOW ANALYZE request.
*/
bool timed_out;
int timeout_sec= 30;
Show_explain_request explain_req;
+ explain_req.is_json_format= json_format;
select_result_explain_buffer *explain_buf;
explain_buf= new select_result_explain_buffer(thd, table->table);
+ explain_req.is_analyze= is_analyze;
explain_req.explain_buf= explain_buf;
explain_req.target_thd= tmp;
explain_req.request_thd= thd;
@@ -3225,6 +3233,34 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
}
+int fill_show_explain_tabular(THD *thd, TABLE_LIST *table, COND *cond)
+{
+ return fill_show_explain_or_analyze(
+ thd, table, cond, FALSE /* json_format */, FALSE /* is_analyze */);
+}
+
+
+int fill_show_explain_json(THD *thd, TABLE_LIST *table, COND *cond)
+{
+ return fill_show_explain_or_analyze(
+ thd, table, cond, TRUE /* json_format */, FALSE /* is_analyze */);
+}
+
+
+int fill_show_analyze_tabular(THD * thd, TABLE_LIST * table, COND * cond)
+{
+ return fill_show_explain_or_analyze(
+ thd, table, cond, FALSE /* json_format */, TRUE /* is_analyze */);
+}
+
+
+int fill_show_analyze_json(THD * thd, TABLE_LIST * table, COND * cond)
+{
+ return fill_show_explain_or_analyze(
+ thd, table, cond, TRUE /* json_format */, TRUE /* is_analyze */);
+}
+
+
struct processlist_callback_arg
{
processlist_callback_arg(THD *thd_arg, TABLE *table_arg):
@@ -9665,7 +9701,30 @@ ST_FIELD_INFO keycache_fields_info[]=
};
-ST_FIELD_INFO show_explain_fields_info[]=
+ST_FIELD_INFO show_explain_tabular_fields_info[]=
+{
+ Column("id", SLonglong(3), NULLABLE, "id"),
+ Column("select_type", Varchar(19), NOT_NULL, "select_type"),
+ Column("table", Name(), NULLABLE, "table"),
+ Column("type", Varchar(15), NULLABLE, "type"),
+ Column("possible_keys",Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "possible_keys"),
+ Column("key", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key"),
+ Column("key_len", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key_len"),
+ Column("ref", Varchar(NAME_CHAR_LEN*MAX_REF_PARTS),NULLABLE, "ref"),
+ Column("rows", SLonglong(10), NULLABLE, "rows"),
+ Column("Extra", Varchar(255), NOT_NULL, "Extra"),
+ CEnd()
+};
+
+
+ST_FIELD_INFO show_explain_json_fields_info[]=
+{
+ Column("EXPLAIN", Longtext(MAX_FIELD_VARCHARLENGTH), NOT_NULL, "SHOW EXPLAIN"),
+ CEnd()
+};
+
+
+ST_FIELD_INFO show_analyze_tabular_fields_info[]=
{
Column("id", SLonglong(3), NULLABLE, "id"),
Column("select_type", Varchar(19), NOT_NULL, "select_type"),
@@ -9676,11 +9735,23 @@ ST_FIELD_INFO show_explain_fields_info[]=
Column("key_len", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key_len"),
Column("ref", Varchar(NAME_CHAR_LEN*MAX_REF_PARTS),NULLABLE, "ref"),
Column("rows", SLonglong(10), NULLABLE, "rows"),
+ Column("r_rows", Varchar(NAME_CHAR_LEN), NULLABLE, "r_rows"),
+
+ /* Fields of type DECIMAL(5,2) to represent percentage.
+ See Show::Type::decimal_precision() and Show::Type::decimal_scale() to learn
+ how 502 converts to precision and scale (5 and 2)*/
+ Column("filtered", Decimal(502), NULLABLE, "filtered"),
+ Column("r_filtered", Decimal(502), NULLABLE, "r_filtered"),
Column("Extra", Varchar(255), NOT_NULL, "Extra"),
CEnd()
};
+ST_FIELD_INFO show_analyze_json_fields_info[]= {
+ Column("ANALYZE", Longtext(MAX_FIELD_VARCHARLENGTH), NOT_NULL, "SHOW ANALYZE"),
+ CEnd()};
+
+
ST_FIELD_INFO check_constraints_fields_info[]=
{
Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
@@ -9741,8 +9812,18 @@ ST_SCHEMA_TABLE schema_tables[]=
{"EVENTS", Show::events_fields_info, 0,
0, make_old_format, 0, -1, -1, 0, 0},
#endif
- {"EXPLAIN", Show::show_explain_fields_info, 0, fill_show_explain,
- make_old_format, 0, -1, -1, TRUE /*hidden*/ , 0},
+ {"EXPLAIN", Show::show_explain_tabular_fields_info, 0,
+ fill_show_explain_tabular, make_old_format, 0, -1, -1,
+ TRUE /*hidden*/ , 0},
+ {"EXPLAIN_JSON", Show::show_explain_json_fields_info, 0,
+ fill_show_explain_json, make_old_format, 0, -1, -1,
+ TRUE /*hidden*/ , 0},
+ {"ANALYZE", Show::show_analyze_tabular_fields_info, 0,
+ fill_show_analyze_tabular, make_old_format, 0, -1, -1,
+ TRUE /*hidden*/, 0},
+ {"ANALYZE_JSON", Show::show_analyze_json_fields_info, 0,
+ fill_show_analyze_json, make_old_format, 0, -1, -1,
+ TRUE /*hidden*/, 0},
{"FILES", Show::files_fields_info, 0,
hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
{"GLOBAL_STATUS", Show::variables_fields_info, 0,
diff --git a/sql/sql_show.h b/sql/sql_show.h
index 3d7a4d1146c..9a269b49f11 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -155,28 +155,37 @@ THD *find_thread_by_id(longlong id, bool query_id= false);
class select_result_explain_buffer;
/*
- SHOW EXPLAIN request object.
+ SHOW EXPLAIN/SHOW ANALYZE request object.
*/
class Show_explain_request : public Apc_target::Apc_call
{
public:
- THD *target_thd; /* thd that we're running SHOW EXPLAIN for */
- THD *request_thd; /* thd that run SHOW EXPLAIN command */
-
+ THD *target_thd; /* thd that we're running SHOW EXPLAIN/ANALYZE for */
+ THD *request_thd; /* thd that run SHOW EXPLAIN/ANALYZE command */
+
+ /*
+ Set to TRUE if you need the result in JSON format,
+ FALSE - in traditional tabular
+ */
+ bool is_json_format= false;
+
+ /* FALSE for SHOW EXPLAIN, TRUE - for SHOW ANALYZE*/
+ bool is_analyze;
+
/* If true, there was some error when producing EXPLAIN output. */
bool failed_to_produce;
- /* SHOW EXPLAIN will be stored here */
+ /* SHOW EXPLAIN/ANALYZE will be stored here */
select_result_explain_buffer *explain_buf;
- /* Query that we've got SHOW EXPLAIN for */
+ /* Query that we've got SHOW EXPLAIN/ANALYZE for */
String query_str;
- /* Overloaded virtual function */
- void call_in_target_thread();
+ void call_in_target_thread() override;
};
+
/**
Condition pushdown used for INFORMATION_SCHEMA / SHOW queries.
This structure is to implement an optimization when
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 88b29d2b59e..f94e81cc3f7 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2192,12 +2192,27 @@ bool check_duplicates_in_interval(const char *set_or_name,
}
+/*
+ Resolves the column collation if:
+ - it was not typed at all, or
+ - it was contextually typed
+ according to the table level character set.
+ Generates an error to the diagnostics area in case of a failure.
+*/
bool Column_definition::
prepare_charset_for_string(const Column_derived_attributes *dattr)
{
- if (!charset)
- charset= dattr->charset();
- return (flags & BINCMP_FLAG) && !(charset= find_bin_collation(charset));
+ CHARSET_INFO *tmp= charset_collation_attrs().
+ resolved_to_character_set(dattr->charset());
+ if (!tmp)
+ return true;
+ charset= tmp;
+ /*
+ Remove the "is contextually typed collation" indicator on success,
+ for safety.
+ */
+ flags&= ~CONTEXT_COLLATION_FLAG;
+ return false;
}
@@ -2380,17 +2395,16 @@ static void check_duplicate_key(THD *thd, const Key *key, const KEY *key_info,
bool Column_definition::prepare_stage1_typelib(THD *thd,
MEM_ROOT *mem_root,
- handler *file,
- ulonglong table_flags)
+ column_definition_type_t deftype)
{
/*
Pass the last parameter to prepare_interval_field() as follows:
- - If we are preparing for an SP variable (file is NULL), we pass "false",
+ - If we are preparing for an SP variable, we pass "false",
to force allocation and full copying of TYPELIB values on the given
mem_root, even if no character set conversion is needed. This is needed
because a life cycle of an SP variable is longer than the current query.
- - If we are preparing for a CREATE TABLE, (file != NULL), we pass "true".
+ - If we are preparing for a CREATE TABLE, we pass "true".
This will create the typelib in runtime memory - we will free the
occupied memory at the same time when we free this
sql_field -- at the end of execution.
@@ -2398,11 +2412,11 @@ bool Column_definition::prepare_stage1_typelib(THD *thd,
values in "interval" in cases when no character conversion is needed,
to avoid extra copying.
*/
- if (prepare_interval_field(mem_root, file != NULL))
+ if (prepare_interval_field(mem_root,
+ deftype == COLUMN_DEFINITION_TABLE_FIELD))
return true; // E.g. wrong values with commas: SET('a,b')
create_length_to_internal_length_typelib();
- DBUG_ASSERT(file || !default_value); // SP variables have no default_value
if (default_value && default_value->expr->basic_const_item())
{
if ((charset != default_value->expr->collation.collation &&
@@ -2415,14 +2429,11 @@ bool Column_definition::prepare_stage1_typelib(THD *thd,
bool Column_definition::prepare_stage1_string(THD *thd,
- MEM_ROOT *mem_root,
- handler *file,
- ulonglong table_flags)
+ MEM_ROOT *mem_root)
{
create_length_to_internal_length_string();
if (prepare_blob_field(thd))
return true;
- DBUG_ASSERT(file || !default_value); // SP variables have no default_value
/*
Convert the default value from client character
set into the column character set if necessary.
@@ -2442,13 +2453,9 @@ bool Column_definition::prepare_stage1_string(THD *thd,
bool Column_definition::prepare_stage1_bit(THD *thd,
- MEM_ROOT *mem_root,
- handler *file,
- ulonglong table_flags)
+ MEM_ROOT *mem_root)
{
pack_flag= FIELDFLAG_NUMBER;
- if (!(table_flags & HA_CAN_BIT_FIELD))
- pack_flag|= FIELDFLAG_TREAT_BIT_AS_CHAR;
create_length_to_internal_length_bit();
return false;
}
@@ -2456,14 +2463,15 @@ bool Column_definition::prepare_stage1_bit(THD *thd,
bool Column_definition::prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t deftype,
const Column_derived_attributes
*derived_attr)
{
+ // SP variables have no default_value
+ DBUG_ASSERT(deftype == COLUMN_DEFINITION_TABLE_FIELD || !default_value);
+
return type_handler()->Column_definition_prepare_stage1(thd, mem_root,
- this, file,
- table_flags,
+ this, deftype,
derived_attr);
}
@@ -2687,10 +2695,77 @@ key_add_part_check_null(const handler *file, KEY *key_info,
/*
- Preparation for table creation
+ Prepare for a table creation.
+ Stage 1: prepare the field list.
+*/
+static bool mysql_prepare_create_table_stage1(THD *thd,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info)
+{
+ DBUG_ENTER("mysql_prepare_create_table_stage1");
+ const Column_derived_attributes dattr(create_info->default_table_charset);
+ const Column_bulk_alter_attributes
+ battr(create_info->alter_table_convert_to_charset);
+ Create_field *sql_field;
+ List_iterator_fast<Create_field> it(alter_info->create_list);
+
+ DBUG_EXECUTE_IF("test_pseudo_invisible",{
+ mysql_add_invisible_field(thd, &alter_info->create_list,
+ "invisible", &type_handler_slong, INVISIBLE_SYSTEM,
+ new (thd->mem_root)Item_int(thd, 9));
+ });
+ DBUG_EXECUTE_IF("test_completely_invisible",{
+ mysql_add_invisible_field(thd, &alter_info->create_list,
+ "invisible", &type_handler_slong, INVISIBLE_FULL,
+ new (thd->mem_root)Item_int(thd, 9));
+ });
+ DBUG_EXECUTE_IF("test_invisible_index",{
+ LEX_CSTRING temp;
+ temp.str= "invisible";
+ temp.length= strlen("invisible");
+ mysql_add_invisible_index(thd, &alter_info->key_list
+ , &temp, Key::MULTIPLE);
+ });
+
+
+ for ( ; (sql_field=it++) ; )
+ {
+ /* Virtual fields are always NULL */
+ if (sql_field->vcol_info)
+ sql_field->flags&= ~NOT_NULL_FLAG;
+
+ /*
+ Initialize length from its original value (number of characters),
+ which was set in the parser. This is necessary if we're
+ executing a prepared statement for the second time.
+ */
+ sql_field->length= sql_field->char_length;
+
+ if (sql_field->bulk_alter(&dattr, &battr))
+ DBUG_RETURN(true);
+
+ if (sql_field->prepare_stage1(thd, thd->mem_root,
+ COLUMN_DEFINITION_TABLE_FIELD,
+ &dattr))
+ DBUG_RETURN(true);
+
+ DBUG_ASSERT(sql_field->charset);
+
+ if (check_column_name(sql_field->field_name.str))
+ {
+ my_error(ER_WRONG_COLUMN_NAME, MYF(0), sql_field->field_name.str);
+ DBUG_RETURN(TRUE);
+ }
+ }
+ DBUG_RETURN(false);
+}
+
+
+/*
+ Preparation for table creation, final stage.
SYNOPSIS
- mysql_prepare_create_table()
+ mysql_prepare_create_table_finalize()
thd Thread object.
create_info Create information (like MAX_ROWS).
alter_info List of columns and indexes to create
@@ -2713,11 +2788,12 @@ key_add_part_check_null(const handler *file, KEY *key_info,
*/
static int
-mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
- Alter_info *alter_info, uint *db_options,
- handler *file, KEY **key_info_buffer,
- uint *key_count, int create_table_mode,
- const LEX_CSTRING db, const LEX_CSTRING table_name)
+mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info,
+ Alter_info *alter_info, uint *db_options,
+ handler *file, KEY **key_info_buffer,
+ uint *key_count, int create_table_mode,
+ const LEX_CSTRING db,
+ const LEX_CSTRING table_name)
{
const char *key_name;
Create_field *sql_field,*dup_field;
@@ -2733,28 +2809,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
bool tmp_table= create_table_mode == C_ALTER_TABLE;
const bool create_simple= thd->lex->create_simple();
bool is_hash_field_needed= false;
- const Column_derived_attributes dattr(create_info->default_table_charset);
- const Column_bulk_alter_attributes
- battr(create_info->alter_table_convert_to_charset);
DBUG_ENTER("mysql_prepare_create_table");
- DBUG_EXECUTE_IF("test_pseudo_invisible",{
- mysql_add_invisible_field(thd, &alter_info->create_list,
- "invisible", &type_handler_slong, INVISIBLE_SYSTEM,
- new (thd->mem_root)Item_int(thd, 9));
- });
- DBUG_EXECUTE_IF("test_completely_invisible",{
- mysql_add_invisible_field(thd, &alter_info->create_list,
- "invisible", &type_handler_slong, INVISIBLE_FULL,
- new (thd->mem_root)Item_int(thd, 9));
- });
- DBUG_EXECUTE_IF("test_invisible_index",{
- LEX_CSTRING temp;
- temp.str= "invisible";
- temp.length= strlen("invisible");
- mysql_add_invisible_index(thd, &alter_info->key_list
- , &temp, Key::MULTIPLE);
- });
LEX_CSTRING* connect_string = &create_info->connect_string;
if (connect_string->length != 0 &&
connect_string->length > CONNECT_STRING_MAXLEN &&
@@ -2789,42 +2845,16 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(TRUE);
}
+
for (field_no=0; (sql_field=it++) ; field_no++)
{
- /* Virtual fields are always NULL */
- if (sql_field->vcol_info)
- sql_field->flags&= ~NOT_NULL_FLAG;
-
- /*
- Initialize length from its original value (number of characters),
- which was set in the parser. This is necessary if we're
- executing a prepared statement for the second time.
- */
- sql_field->length= sql_field->char_length;
-
- if (sql_field->bulk_alter(&dattr, &battr))
- DBUG_RETURN(true);
-
- if (sql_field->prepare_stage1(thd, thd->mem_root,
- file, file->ha_table_flags(),
- &dattr))
- DBUG_RETURN(true);
-
- DBUG_ASSERT(sql_field->charset);
+ if (!(sql_field->flags & NOT_NULL_FLAG))
+ null_fields++;
if (sql_field->real_field_type() == MYSQL_TYPE_BIT &&
file->ha_table_flags() & HA_CAN_BIT_FIELD)
total_uneven_bit_length+= sql_field->length & 7;
- if (!(sql_field->flags & NOT_NULL_FLAG))
- null_fields++;
-
- if (check_column_name(sql_field->field_name.str))
- {
- my_error(ER_WRONG_COLUMN_NAME, MYF(0), sql_field->field_name.str);
- DBUG_RETURN(TRUE);
- }
-
/* Check if we have used the same field name before */
for (dup_no=0; (dup_field=it2++) != sql_field; dup_no++)
{
@@ -3812,6 +3842,49 @@ without_overlaps_err:
DBUG_RETURN(FALSE);
}
+
+/*
+ Preparation for table creation
+
+ SYNOPSIS
+ mysql_prepare_create_table()
+ thd Thread object.
+ create_info Create information (like MAX_ROWS).
+ alter_info List of columns and indexes to create
+ db_options INOUT Table options (like HA_OPTION_PACK_RECORD).
+ file The handler for the new table.
+ key_info_buffer OUT An array of KEY structs for the indexes.
+ key_count OUT The number of elements in the array.
+ create_table_mode C_ORDINARY_CREATE, C_ALTER_TABLE,
+ C_CREATE_SELECT, C_ASSISTED_DISCOVERY
+
+ DESCRIPTION
+ Prepares the table and key structures for table creation.
+
+ NOTES
+ sets create_info->varchar if the table has a varchar
+
+ RETURN VALUES
+ FALSE OK
+ TRUE error
+*/
+
+static int
+mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
+ Alter_info *alter_info, uint *db_options,
+ handler *file, KEY **key_info_buffer,
+ uint *key_count, int create_table_mode,
+ const LEX_CSTRING db,
+ const LEX_CSTRING table_name)
+{
+ return mysql_prepare_create_table_stage1(thd, create_info, alter_info) ||
+ mysql_prepare_create_table_finalize(thd, create_info, alter_info,
+ db_options, file, key_info_buffer,
+ key_count, create_table_mode,
+ db, table_name);
+}
+
+
/**
check comment length of table, column, index and partition
@@ -3870,38 +3943,6 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len,
/*
- Set table default charset, if not set
-
- SYNOPSIS
- set_table_default_charset()
- create_info Table create information
-
- DESCRIPTION
- If the table character set was not given explicitly,
- let's fetch the database default character set and
- apply it to the table.
-*/
-
-static void set_table_default_charset(THD *thd, HA_CREATE_INFO *create_info,
- const LEX_CSTRING &db)
-{
- /*
- If the table character set was not given explicitly,
- let's fetch the database default character set and
- apply it to the table.
- */
- if (!create_info->default_table_charset)
- {
- Schema_specification_st db_info;
-
- load_db_opt_by_name(thd, db.str, &db_info);
-
- create_info->default_table_charset= db_info.default_table_charset;
- }
-}
-
-
-/*
Extend long VARCHAR fields to blob & prepare field if it's a blob
SYNOPSIS
@@ -3971,9 +4012,9 @@ bool Column_definition::prepare_blob_field(THD *thd)
bool Column_definition::sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root)
{
- DBUG_ASSERT(charset);
- const Column_derived_attributes dattr(&my_charset_bin);
- return prepare_stage1(thd, mem_root, NULL, HA_CAN_GEOMETRY, &dattr) ||
+ const Column_derived_attributes dattr(thd->variables.collation_database);
+ return prepare_stage1(thd, mem_root,
+ COLUMN_DEFINITION_ROUTINE_LOCAL, &dattr) ||
prepare_stage2(NULL, HA_CAN_GEOMETRY);
}
@@ -4060,13 +4101,16 @@ handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db,
handler *file;
DBUG_ENTER("mysql_create_frm_image");
+ DBUG_ASSERT(create_info->default_table_charset);
+
if (!alter_info->create_list.elements)
{
my_error(ER_TABLE_MUST_HAVE_COLUMNS, MYF(0));
DBUG_RETURN(NULL);
}
- set_table_default_charset(thd, create_info, db);
+ if (mysql_prepare_create_table_stage1(thd, create_info, alter_info))
+ DBUG_RETURN(NULL);
db_options= create_info->table_options_with_row_type();
@@ -4284,9 +4328,10 @@ handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db,
}
#endif
- if (mysql_prepare_create_table(thd, create_info, alter_info, &db_options,
- file, key_info, key_count,
- create_table_mode, db, table_name))
+ if (mysql_prepare_create_table_finalize(thd, create_info,
+ alter_info, &db_options,
+ file, key_info, key_count,
+ create_table_mode, db, table_name))
goto err;
create_info->table_options=db_options;
@@ -4341,6 +4386,7 @@ 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,
@@ -4361,6 +4407,8 @@ int create_table_impl(THD *thd,
DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s",
db.str, table_name.str, internal_tmp_table, path.str));
+ DBUG_ASSERT(create_info->default_table_charset);
+
/* Easy check for ddl logging if we are creating a temporary table */
if (create_info->tmp_table())
{
@@ -4433,8 +4481,7 @@ int create_table_impl(THD *thd,
*/
if (table_creation_was_logged)
{
- thd->variables.option_bits|= OPTION_KEEP_LOG;
- thd->log_current_statement= 1;
+ thd->variables.option_bits|= OPTION_BINLOG_THIS;
create_info->table_was_deleted= 1;
}
}
@@ -4492,8 +4539,7 @@ int create_table_impl(THD *thd,
We have to log this query, even if it failed later to ensure the
drop is done.
*/
- thd->variables.option_bits|= OPTION_KEEP_LOG;
- thd->log_current_statement= 1;
+ thd->variables.option_bits|= OPTION_BINLOG_THIS;
create_info->table_was_deleted= 1;
lex_string_set(&create_info->org_storage_engine_name,
ha_resolve_storage_engine_name(db_type));
@@ -4516,9 +4562,9 @@ int create_table_impl(THD *thd,
*/
/* Log CREATE IF NOT EXISTS on slave for distributed engines */
- if (thd->slave_thread && (db_type && db_type->flags &
- HTON_IGNORE_UPDATES))
- thd->log_current_statement= 1;
+ if (thd->slave_thread && db_type &&
+ db_type->flags & HTON_IGNORE_UPDATES)
+ thd->variables.option_bits|= OPTION_BINLOG_THIS;
goto warn;
}
else
@@ -4701,6 +4747,8 @@ int mysql_create_table_no_lock(THD *thd,
LEX_CSTRING cpath;
LEX_CUSTRING frm= {0,0};
+ DBUG_ASSERT(create_info->default_table_charset);
+
if (create_info->tmp_table())
path_length= build_tmptable_filename(thd, path, sizeof(path));
else
@@ -4769,6 +4817,8 @@ int mysql_create_table_no_lock(THD *thd,
close of thread tables.
*/
+
+static
bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
Table_specification_st *create_info,
Alter_info *alter_info)
@@ -4782,6 +4832,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
bool result;
DBUG_ENTER("mysql_create_table");
+ DBUG_ASSERT(create_info->default_table_charset);
+
DBUG_ASSERT(create_table == thd->lex->query_tables);
bzero(&ddl_log_state_create, sizeof(ddl_log_state_create));
@@ -4883,7 +4935,7 @@ err:
thd->transaction->stmt.mark_created_temp_table();
/* Write log if no error or if we already deleted a table */
- if (likely(!result) || thd->log_current_statement)
+ if (!result || thd->log_current_statement())
{
if (unlikely(result) && create_info->table_was_deleted &&
pos_in_locked_tables)
@@ -5220,6 +5272,7 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
TRUE error
*/
+static
bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
TABLE_LIST* src_table,
Table_specification_st *create_info)
@@ -5295,6 +5348,14 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
local_create_info.db_type= src_table->table->s->db_type();
local_create_info.row_type= src_table->table->s->row_type;
local_create_info.alter_info= &local_alter_info;
+ /*
+ This statement:
+ CREATE TABLE t1 LIKE t2
+ does not support table charset/collation clauses.
+ No needs to copy. Assert they are empty.
+ */
+ DBUG_ASSERT(create_info->default_charset_collation.is_empty());
+ DBUG_ASSERT(create_info->convert_charset_collation.is_empty());
if (mysql_prepare_alter_table(thd, src_table->table, &local_create_info,
&local_alter_info, &local_alter_ctx))
goto err;
@@ -5350,7 +5411,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
&is_trans, C_ORDINARY_CREATE,
table)) > 0);
/* Remember to log if we deleted something */
- do_logging= thd->log_current_statement;
+ do_logging= thd->log_current_statement();
if (res)
goto err;
@@ -7965,7 +8026,7 @@ void rename_field_in_list(Create_field *field, List<const char> *field_list)
bool
mysql_prepare_alter_table(THD *thd, TABLE *table,
- HA_CREATE_INFO *create_info,
+ Table_specification_st *create_info,
Alter_info *alter_info,
Alter_table_ctx *alter_ctx)
{
@@ -8031,8 +8092,11 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
create_info->max_rows= table->s->max_rows;
if (!(used_fields & HA_CREATE_USED_AVG_ROW_LENGTH))
create_info->avg_row_length= table->s->avg_row_length;
- if (!(used_fields & HA_CREATE_USED_DEFAULT_CHARSET))
- create_info->default_table_charset= table->s->table_charset;
+
+ if (create_info->resolve_to_charset_collation_context(thd,
+ thd->charset_collation_context_alter_table(table->s)))
+ DBUG_RETURN(true);
+
if (!(used_fields & HA_CREATE_USED_AUTO) && table->found_next_number_field)
{
/* Table has an autoincrement, copy value to new table */
@@ -9820,7 +9884,7 @@ static uint64 get_start_alter_id(THD *thd)
bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
const LEX_CSTRING *new_name,
- HA_CREATE_INFO *create_info,
+ Table_specification_st *create_info,
TABLE_LIST *table_list,
Recreate_info *recreate_info,
Alter_info *alter_info,
@@ -10418,7 +10482,7 @@ do_continue:;
DBUG_RETURN(true);
}
- set_table_default_charset(thd, create_info, alter_ctx.db);
+ DBUG_ASSERT(create_info->default_table_charset);
/*
The ALTER related code cannot alter partitions and change column data types
@@ -11854,7 +11918,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
Recreate_info *recreate_info, bool table_copy)
{
- HA_CREATE_INFO create_info;
+ Table_specification_st create_info;
Alter_info alter_info;
TABLE_LIST *next_table= table_list->next_global;
DBUG_ENTER("mysql_recreate_table");
@@ -11866,9 +11930,8 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
/* hide following tables from open_tables() */
table_list->next_global= NULL;
- bzero((char*) &create_info, sizeof(create_info));
+ create_info.init();
create_info.row_type=ROW_TYPE_NOT_USED;
- create_info.default_table_charset=default_charset_info;
create_info.alter_info= &alter_info;
/* Force alter table to recreate table */
alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE);
@@ -11980,8 +12043,10 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
{
/* Call ->checksum() if the table checksum matches 'old_mode' settings */
if (!(check_opt->flags & T_EXTEND) &&
- (((t->file->ha_table_flags() & HA_HAS_OLD_CHECKSUM) && thd->variables.old_mode) ||
- ((t->file->ha_table_flags() & HA_HAS_NEW_CHECKSUM) && !thd->variables.old_mode)))
+ (((t->file->ha_table_flags() & HA_HAS_OLD_CHECKSUM) &&
+ (thd->variables.old_behavior & OLD_MODE_COMPAT_5_1_CHECKSUM)) ||
+ ((t->file->ha_table_flags() & HA_HAS_NEW_CHECKSUM) &&
+ !(thd->variables.old_behavior & OLD_MODE_COMPAT_5_1_CHECKSUM))))
{
if (t->file->info(HA_STATUS_VARIABLE) || t->file->stats.checksum_null)
protocol->store_null();
@@ -12126,6 +12191,11 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
const bool used_engine= lex->create_info.used_fields & HA_CREATE_USED_ENGINE;
DBUG_ASSERT((m_storage_engine_name.str != NULL) == used_engine);
+
+ if (lex->create_info.resolve_to_charset_collation_context(thd,
+ thd->charset_collation_context_create_table_in_db(first_table->db.str)))
+ DBUG_RETURN(true);
+
if (used_engine)
{
if (resolve_storage_engine_with_error(thd, &lex->create_info.db_type,
@@ -12198,19 +12268,9 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
*/
if (!(create_info.used_fields & HA_CREATE_USED_ENGINE))
create_info.use_default_db_type(thd);
- /*
- If we are using SET CHARSET without DEFAULT, add an implicit
- DEFAULT to not confuse old users. (This may change).
- */
- if ((create_info.used_fields &
- (HA_CREATE_USED_DEFAULT_CHARSET | HA_CREATE_USED_CHARSET)) ==
- HA_CREATE_USED_CHARSET)
- {
- create_info.used_fields&= ~HA_CREATE_USED_CHARSET;
- create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
- create_info.default_table_charset= create_info.alter_table_convert_to_charset;
- create_info.alter_table_convert_to_charset= 0;
- }
+
+ DBUG_ASSERT(!(create_info.used_fields & HA_CREATE_USED_CHARSET));
+ DBUG_ASSERT(create_info.convert_charset_collation.is_empty());
/*
If we are a slave, we should add OR REPLACE if we don't have
@@ -12375,7 +12435,7 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
if (!(res= handle_select(thd, lex, result, 0)))
{
if (create_info.tmp_table())
- thd->variables.option_bits|= OPTION_KEEP_LOG;
+ thd->variables.option_bits|= OPTION_BINLOG_THIS_TRX;
}
delete result;
}
@@ -12435,7 +12495,7 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
{
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
if (create_info.tmp_table())
- thd->variables.option_bits|= OPTION_KEEP_LOG;
+ thd->variables.option_bits|= OPTION_BINLOG_THIS_TRX;
/* in case of create temp tables if @@session_track_state_change is
ON then send session state notification in OK packet */
if (create_info.options & HA_LEX_CREATE_TMP_TABLE)
@@ -12449,3 +12509,46 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
end_with_restore_list:
DBUG_RETURN(res);
}
+
+
+bool HA_CREATE_INFO::
+ resolve_to_charset_collation_context(THD *thd,
+ const Lex_table_charset_collation_attrs_st &default_cscl_arg,
+ const Lex_table_charset_collation_attrs_st &convert_cscl,
+ const Charset_collation_context &ctx)
+{
+ /*
+ If CONVERT TO clauses are specified only (without table default clauses),
+ then we copy CONVERT TO clauses to default clauses, so e.g:
+ CONVERT TO CHARACTER SET utf8mb4
+ means
+ CONVERT TO CHARACTER SET utf8mb4, DEFAULT CHARACTER SET utf8mb4
+ */
+ Lex_table_charset_collation_attrs_st default_cscl=
+ !convert_cscl.is_empty() && default_cscl_arg.is_empty() ?
+ convert_cscl : default_cscl_arg;
+
+ if (default_cscl.is_empty())
+ default_table_charset= ctx.collate_default().charset_info();
+ else
+ {
+ // Make sure we don't do double resolution in direct SQL execution
+ DBUG_ASSERT(!default_table_charset || thd->stmt_arena->is_stmt_execute());
+ if (!(default_table_charset=
+ default_cscl.resolved_to_context(ctx)))
+ return true;
+ }
+
+ if (convert_cscl.is_empty())
+ alter_table_convert_to_charset= NULL;
+ else
+ {
+ // Make sure we don't do double resolution in direct SQL execution
+ DBUG_ASSERT(!alter_table_convert_to_charset ||
+ thd->stmt_arena->is_stmt_execute());
+ if (!(alter_table_convert_to_charset=
+ convert_cscl.resolved_to_context(ctx)))
+ return true;
+ }
+ return false;
+}
diff --git a/sql/sql_table.h b/sql/sql_table.h
index 0f9a73c848a..ccde7d87120 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -19,6 +19,7 @@
#include <my_sys.h> // pthread_mutex_t
#include "m_string.h" // LEX_CUSTRING
+#include "lex_charset.h"
#define ERROR_INJECT(code) \
((DBUG_IF("crash_" code) && (DBUG_SUICIDE(), 0)) || \
@@ -90,9 +91,6 @@ void build_lower_case_table_filename(char *buff, size_t bufflen,
const LEX_CSTRING *table,
uint flags);
uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen);
-bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
- Table_specification_st *create_info,
- Alter_info *alter_info);
bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword,
const LEX_CSTRING *add);
@@ -156,14 +154,14 @@ int mysql_discard_or_import_tablespace(THD *thd,
bool discard);
bool mysql_prepare_alter_table(THD *thd, TABLE *table,
- HA_CREATE_INFO *create_info,
+ Table_specification_st *create_info,
Alter_info *alter_info,
Alter_table_ctx *alter_ctx);
bool mysql_trans_prepare_alter_copy_data(THD *thd);
bool mysql_trans_commit_alter_copy_data(THD *thd);
bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
const LEX_CSTRING *new_name,
- HA_CREATE_INFO *create_info,
+ Table_specification_st *create_info,
TABLE_LIST *table_list,
class Recreate_info *recreate_info,
Alter_info *alter_info,
@@ -175,9 +173,6 @@ bool mysql_compare_tables(TABLE *table,
bool *metadata_equal);
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
class Recreate_info *recreate_info, bool table_copy);
-bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
- TABLE_LIST *src_table,
- Table_specification_st *create_info);
bool mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
const LEX_CSTRING *old_name, const LEX_CSTRING *new_db,
const LEX_CSTRING *new_name, LEX_CUSTRING *id,
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 479d4289406..9163d8fc0e4 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -698,6 +698,10 @@ void print_keyuse_array_for_trace(THD *thd, DYNAMIC_ARRAY *keyuse_array)
KEYUSE *keyuse= (KEYUSE*)dynamic_array_ptr(keyuse_array, i);
Json_writer_object keyuse_elem(thd);
keyuse_elem.add_table_name(keyuse->table->reginfo.join_tab);
+ if (keyuse->keypart != FT_KEYPART && !keyuse->is_for_hash_join())
+ {
+ keyuse_elem.add("index", keyuse->table->key_info[keyuse->key].name);
+ }
keyuse_elem.add("field", (keyuse->keypart == FT_KEYPART) ? "<fulltext>":
(keyuse->is_for_hash_join() ?
keyuse->table->field[keyuse->keypart]
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index c6af72c5979..a0ef89ff0f5 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -511,7 +511,7 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
(HTON_REQUIRES_CLOSE_AFTER_TRUNCATE |
HTON_TRUNCATE_REQUIRES_EXCLUSIVE_USE)))
{
- thd->locked_tables_list.mark_table_for_reopen(thd, table_ref->table);
+ thd->locked_tables_list.mark_table_for_reopen(table_ref->table);
if (unlikely(thd->locked_tables_list.reopen_tables(thd, false)))
thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
}
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index f3c0a8404db..926a13cbf1a 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -2715,11 +2715,10 @@ bool
Type_handler::Column_definition_set_attributes(THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type)
const
{
- def->charset= cs;
+ def->set_charset_collation_attrs(attr.charset_collation_attrs());
def->set_length_and_dec(attr);
return false;
}
@@ -2748,12 +2747,11 @@ Type_handler_string::Column_definition_set_attributes(
THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type)
const
{
- Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
- if (attr.length())
+ Type_handler::Column_definition_set_attributes(thd, def, attr, type);
+ if (attr.has_explicit_length())
return false;
switch (type) {
case COLUMN_DEFINITION_ROUTINE_PARAM:
@@ -2780,12 +2778,11 @@ Type_handler_varchar::Column_definition_set_attributes(
THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type)
const
{
- Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
- if (attr.length())
+ Type_handler::Column_definition_set_attributes(thd, def, attr, type);
+ if (attr.has_explicit_length())
return false;
switch (type) {
case COLUMN_DEFINITION_ROUTINE_PARAM:
@@ -3011,8 +3008,7 @@ bool Type_handler::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
@@ -3025,8 +3021,7 @@ bool Type_handler_null::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
@@ -3040,8 +3035,7 @@ bool Type_handler_row::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
@@ -3055,8 +3049,7 @@ bool Type_handler_temporal_result::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
@@ -3070,8 +3063,7 @@ bool Type_handler_numeric::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
@@ -3084,8 +3076,7 @@ bool Type_handler_newdecimal::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
@@ -3099,28 +3090,26 @@ bool Type_handler_bit::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
{
def->charset= &my_charset_numeric;
- return def->prepare_stage1_bit(thd, mem_root, file, table_flags);
+ return def->prepare_stage1_bit(thd, mem_root);
}
bool Type_handler_typelib::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
{
return def->prepare_charset_for_string(derived_attr) ||
- def->prepare_stage1_typelib(thd, mem_root, file, table_flags);
+ def->prepare_stage1_typelib(thd, mem_root, type);
}
@@ -3128,14 +3117,13 @@ bool Type_handler_string_result::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const
{
return def->prepare_charset_for_string(derived_attr) ||
- def->prepare_stage1_string(thd, mem_root, file, table_flags);
+ def->prepare_stage1_string(thd, mem_root);
}
@@ -3158,7 +3146,7 @@ bool Type_handler_general_purpose_string::
Change character sets for all varchar/char/text columns,
but do not touch varbinary/binary/blob columns.
*/
- if (defcs != &my_charset_bin)
+ if (!(def->flags & CONTEXT_COLLATION_FLAG) && defcs != &my_charset_bin)
def->charset= bulk_alter_attr->alter_table_convert_to_charset();
return false;
};
@@ -3346,10 +3334,11 @@ bool Type_handler_bit::
handler *file,
ulonglong table_flags) const
{
- /*
- We have sql_field->pack_flag already set here, see
- mysql_prepare_create_table().
- */
+ if (!(table_flags & HA_CAN_BIT_FIELD))
+ {
+ def->pack_flag|= FIELDFLAG_TREAT_BIT_AS_CHAR;
+ def->create_length_to_internal_length_bit();
+ }
return false;
}
@@ -7687,11 +7676,10 @@ static const char* item_name(Item *a, String *str)
}
-static void wrong_precision_error(uint errcode, Item *a,
- ulonglong number, uint maximum)
+static void wrong_precision_error(uint errcode, Item *a, uint maximum)
{
StringBuffer<1024> buf(system_charset_info);
- my_error(errcode, MYF(0), number, item_name(a, &buf), maximum);
+ my_error(errcode, MYF(0), item_name(a, &buf), maximum);
}
@@ -7710,12 +7698,12 @@ bool get_length_and_scale(ulonglong length, ulonglong decimals,
{
if (length > (ulonglong) max_precision)
{
- wrong_precision_error(ER_TOO_BIG_PRECISION, a, length, max_precision);
+ wrong_precision_error(ER_TOO_BIG_PRECISION, a, max_precision);
return 1;
}
if (decimals > (ulonglong) max_scale)
{
- wrong_precision_error(ER_TOO_BIG_SCALE, a, decimals, max_scale);
+ wrong_precision_error(ER_TOO_BIG_SCALE, a, max_scale);
return 1;
}
@@ -7758,8 +7746,7 @@ Item *Type_handler_time_common::
{
if (attr.decimals() > MAX_DATETIME_PRECISION)
{
- wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
- MAX_DATETIME_PRECISION);
+ wrong_precision_error(ER_TOO_BIG_PRECISION, item, MAX_DATETIME_PRECISION);
return 0;
}
return new (thd->mem_root)
@@ -7773,8 +7760,7 @@ Item *Type_handler_datetime_common::
{
if (attr.decimals() > MAX_DATETIME_PRECISION)
{
- wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
- MAX_DATETIME_PRECISION);
+ wrong_precision_error(ER_TOO_BIG_PRECISION, item, MAX_DATETIME_PRECISION);
return 0;
}
return new (thd->mem_root)
@@ -7852,8 +7838,7 @@ Item *Type_handler_interval_DDhhmmssff::
{
if (attr.decimals() > MAX_DATETIME_PRECISION)
{
- wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
- MAX_DATETIME_PRECISION);
+ wrong_precision_error(ER_TOO_BIG_PRECISION, item, MAX_DATETIME_PRECISION);
return 0;
}
return new (thd->mem_root) Item_interval_DDhhmmssff_typecast(thd, item,
diff --git a/sql/sql_type.h b/sql/sql_type.h
index b082449639b..52c17d61d2e 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -3358,28 +3358,21 @@ class Type_cast_attributes
bool m_length_specified;
bool m_decimals_specified;
public:
- Type_cast_attributes(const char *c_len, const char *c_dec, CHARSET_INFO *cs)
+ Type_cast_attributes(const Lex_length_and_dec_st &length_and_dec,
+ CHARSET_INFO *cs)
:m_charset(cs), m_length(0), m_decimals(0),
m_length_specified(false), m_decimals_specified(false)
{
- set_length_and_dec(c_len, c_dec);
+ m_length= length_and_dec.length_overflowed() ? (ulonglong) UINT_MAX32 + 1 :
+ length_and_dec.length();
+ m_decimals= length_and_dec.dec();
+ m_length_specified= length_and_dec.has_explicit_length();
+ m_decimals_specified= length_and_dec.has_explicit_dec();
}
Type_cast_attributes(CHARSET_INFO *cs)
:m_charset(cs), m_length(0), m_decimals(0),
m_length_specified(false), m_decimals_specified(false)
{ }
- void set_length_and_dec(const char *c_len, const char *c_dec)
- {
- int error;
- /*
- We don't have to check for error here as sql_yacc.yy has guaranteed
- that the values are in range of ulonglong
- */
- if ((m_length_specified= (c_len != NULL)))
- m_length= (ulonglong) my_strtoll10(c_len, NULL, &error);
- if ((m_decimals_specified= (c_dec != NULL)))
- m_decimals= (ulonglong) my_strtoll10(c_dec, NULL, &error);
- }
CHARSET_INFO *charset() const { return m_charset; }
bool length_specified() const { return m_length_specified; }
bool decimals_specified() const { return m_decimals_specified; }
@@ -3953,7 +3946,6 @@ public:
virtual bool Column_definition_set_attributes(THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type)
const;
// Fix attributes after the parser
@@ -3970,8 +3962,7 @@ public:
virtual bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const;
@@ -4449,8 +4440,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -4764,8 +4754,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -5318,8 +5307,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -5422,8 +5410,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -5955,8 +5942,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -6799,8 +6785,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -6857,8 +6842,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
@@ -6928,7 +6912,6 @@ public:
bool Column_definition_set_attributes(THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type)
const override;
bool Column_definition_fix_attributes(Column_definition *c) const override;
@@ -7026,7 +7009,6 @@ public:
bool Column_definition_set_attributes(THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
- CHARSET_INFO *cs,
column_definition_type_t type)
const override;
bool Column_definition_fix_attributes(Column_definition *c) const override;
@@ -7296,8 +7278,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
diff --git a/sql/sql_type_fixedbin.h b/sql/sql_type_fixedbin.h
index 093587c4deb..852ec1269eb 100644
--- a/sql/sql_type_fixedbin.h
+++ b/sql/sql_type_fixedbin.h
@@ -382,8 +382,8 @@ public:
}
bool Column_definition_prepare_stage1(THD *thd, MEM_ROOT *mem_root,
- Column_definition *def, handler *file,
- ulonglong table_flags,
+ Column_definition *def,
+ column_definition_type_t type,
const Column_derived_attributes *derived_attr)
const override
{
@@ -1532,7 +1532,7 @@ public:
str->append(type_handler_fbt()->name().lex_cstring());
str->append(')');
}
- bool fix_length_and_dec() override
+ bool fix_length_and_dec(THD *thd) override
{
Type_std_attributes::operator=(Type_std_attributes_fbt());
if (Fbt::fix_fields_maybe_null_on_conversion_to_fbt(args[0]))
diff --git a/sql/sql_type_geom.cc b/sql/sql_type_geom.cc
index 5732ae47217..3bdc34b4d65 100644
--- a/sql/sql_type_geom.cc
+++ b/sql/sql_type_geom.cc
@@ -280,8 +280,7 @@ bool Type_handler_geometry::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr) const
{
diff --git a/sql/sql_type_geom.h b/sql/sql_type_geom.h
index 3bc25808bc3..db951297519 100644
--- a/sql/sql_type_geom.h
+++ b/sql/sql_type_geom.h
@@ -108,8 +108,7 @@ public:
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
- handler *file,
- ulonglong table_flags,
+ column_definition_type_t type,
const Column_derived_attributes
*derived_attr)
const override;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 7dfde55ec7c..68de349a78f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -556,6 +556,7 @@ int mysql_update(THD *thd,
// Don't count on usage of 'only index' when calculating which key to use
table->covering_keys.clear_all();
+ transactional_table= table->file->has_transactions_and_rollback();
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (prune_partitions(thd, table, conds))
@@ -568,6 +569,9 @@ int mysql_update(THD *thd,
if (thd->is_error())
DBUG_RETURN(1);
+ if (thd->binlog_for_noop_dml(transactional_table))
+ DBUG_RETURN(1);
+
my_ok(thd); // No matching records
DBUG_RETURN(0);
}
@@ -597,6 +601,10 @@ int mysql_update(THD *thd,
{
DBUG_RETURN(1); // Error in where
}
+
+ if (thd->binlog_for_noop_dml(transactional_table))
+ DBUG_RETURN(1);
+
my_ok(thd); // No matching records
DBUG_RETURN(0);
}
@@ -961,7 +969,6 @@ update_begin:
thd->count_cuted_fields= CHECK_FIELD_WARN;
thd->cuted_fields=0L;
- transactional_table= table->file->has_transactions_and_rollback();
thd->abort_on_warning= !ignore && thd->is_strict_mode();
if (do_direct_update)
@@ -1300,7 +1307,8 @@ update_end:
Sometimes we want to binlog even if we updated no rows, in case user used
it to be sure master and slave are in same state.
*/
- if (likely(error < 0) || thd->transaction->stmt.modified_non_trans_table)
+ if (likely(error < 0) || thd->transaction->stmt.modified_non_trans_table ||
+ thd->log_current_statement())
{
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
@@ -1310,9 +1318,8 @@ update_end:
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
- ScopedStatementReplication scoped_stmt_rpl(
- table->versioned(VERS_TRX_ID) ? thd : NULL);
-
+ StatementBinlog stmt_binlog(thd, table->versioned(VERS_TRX_ID) ||
+ thd->binlog_need_stmt_format(transactional_table));
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
transactional_table, FALSE, FALSE, errcode) > 0)
@@ -2733,7 +2740,8 @@ void multi_update::abort_result_set()
(void) do_updates();
}
}
- if (thd->transaction->stmt.modified_non_trans_table)
+ if (thd->transaction->stmt.modified_non_trans_table ||
+ thd->log_current_statement())
{
/*
The query has to binlog because there's a modified non-transactional table
@@ -2741,6 +2749,7 @@ void multi_update::abort_result_set()
*/
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
+ StatementBinlog stmt_binlog(thd, thd->binlog_need_stmt_format(transactional_tables));
/*
THD::killed status might not have been set ON at time of an error
got caught and if happens later the killed error is written
@@ -3069,7 +3078,8 @@ bool multi_update::send_eof()
(thd->transaction->stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
if (likely(local_error == 0 ||
- thd->transaction->stmt.modified_non_trans_table))
+ thd->transaction->stmt.modified_non_trans_table) ||
+ thd->log_current_statement())
{
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
@@ -3079,25 +3089,21 @@ bool multi_update::send_eof()
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
- bool force_stmt= false;
- for (TABLE *table= all_tables->table; table; table= table->next)
- {
- if (table->versioned(VERS_TRX_ID))
+ bool force_stmt= thd->binlog_need_stmt_format(transactional_tables);
+ if (!force_stmt)
+ for (TABLE *table= all_tables->table; table; table= table->next)
{
- force_stmt= true;
- break;
+ if (table->versioned(VERS_TRX_ID))
+ {
+ force_stmt= true;
+ break;
+ }
}
- }
- enum_binlog_format save_binlog_format;
- save_binlog_format= thd->get_current_stmt_binlog_format();
- if (force_stmt)
- thd->set_current_stmt_binlog_format_stmt();
-
+ StatementBinlog stmt_binlog(thd, force_stmt);
if (thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
thd->query_length(), transactional_tables, FALSE,
FALSE, errcode) > 0)
local_error= 1; // Rollback update
- thd->set_current_stmt_binlog_format(save_binlog_format);
}
}
DBUG_ASSERT(trans_safe || !updated ||
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 3e94dfbe6b9..8716b596914 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -3119,8 +3119,10 @@ bool Window_funcs_sort::setup(THD *thd, SQL_SELECT *sel,
*/
ORDER *order= (ORDER *)alloc_root(thd->mem_root, sizeof(ORDER));
memset(order, 0, sizeof(*order));
- Item *item= new (thd->mem_root) Item_temptable_field(thd,
- join_tab->table->field[0]);
+ Item_field *item=
+ new (thd->mem_root) Item_field(thd, join_tab->table->field[0]);
+ if (item)
+ item->set_refers_to_temp_table(true);
order->item= (Item **)alloc_root(thd->mem_root, 2 * sizeof(Item *));
order->item[1]= NULL;
order->item[0]= item;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index b6ab30cc86d..de963a95c2c 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -193,14 +193,6 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
#endif
-#define bincmp_collation(X,Y) \
- do \
- { \
- if (unlikely(Lex->set_bincmp(X,Y))) \
- MYSQL_YYABORT; \
- } while(0)
-
-
%}
%union {
int num;
@@ -221,6 +213,9 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
Lex_length_and_dec_st Lex_length_and_dec;
Lex_cast_type_st Lex_cast_type;
Lex_field_type_st Lex_field_type;
+ Lex_exact_charset_extended_collation_attrs_st
+ Lex_exact_charset_extended_collation_attrs;
+ Lex_extended_collation_st Lex_extended_collation;
Lex_dyncol_type_st Lex_dyncol_type;
Lex_for_loop_st for_loop;
Lex_for_loop_bounds_st for_loop_bounds;
@@ -1390,7 +1385,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
wild_and_where
%type <const_simple_string>
- field_length opt_field_length
+ field_length_str
opt_compression_method
%type <string>
@@ -1411,6 +1406,19 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
field_type_misc
json_table_field_type
+%type <Lex_exact_charset_extended_collation_attrs>
+ binary
+ opt_binary
+ opt_binary_and_compression
+ attribute
+ attribute_list
+ field_def
+
+%type <Lex_extended_collation>
+ collation_name
+ collation_name_or_default
+
+
%type <Lex_dyncol_type> opt_dyncol_type dyncol_type
numeric_dyncol_type temporal_dyncol_type string_dyncol_type
@@ -1522,6 +1530,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
condition_number
opt_versioning_interval_start
+%type <num> opt_vers_auto_part
+
%type <item_param> param_marker
%type <item_num>
@@ -1591,6 +1601,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <Lex_cast_type> cast_type cast_type_numeric cast_type_temporal
%type <Lex_length_and_dec> precision opt_precision float_options
+ field_length opt_field_length
+ field_scale opt_field_scale
%type <lex_user> user grant_user grant_role user_or_role current_role
admin_option_for_role user_maybe_role
@@ -1599,15 +1611,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
text_or_password
%type <charset>
- opt_collate
- collate
charset_name
charset_or_alias
charset_name_or_default
old_or_new_charset_name
old_or_new_charset_name_or_default
- collation_name
- collation_name_or_default
opt_load_data_charset
UNDERSCORE_CHARSET
@@ -1682,14 +1690,13 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
delete_limit_clause fields opt_values values
no_braces_with_names opt_values_with_names values_with_names
procedure_list procedure_list2 procedure_item
- field_def handler opt_generated_always
+ handler opt_generated_always
opt_ignore opt_column opt_restrict
grant revoke set lock unlock string_list
- opt_binary table_lock_list table_lock
+ table_lock_list table_lock
ref_list opt_match_clause opt_on_update_delete use
opt_delete_options opt_delete_option varchar nchar nvarchar
opt_outer table_list table_name table_alias_ref_list table_alias_ref
- attribute attribute_list
compressed_deprecated_data_type_attribute
compressed_deprecated_column_attribute
grant_list
@@ -1716,6 +1723,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
normal_key_options normal_key_opts all_key_opt
spatial_key_options fulltext_key_options normal_key_opt
fulltext_key_opt spatial_key_opt fulltext_key_opts spatial_key_opts
+ explain_for_connection
keep_gcc_happy
key_using_alg
part_column_list
@@ -1967,6 +1975,7 @@ verb_clause:
| do
| drop
| execute
+ | explain_for_connection
| flush
| get_diagnostics
| grant
@@ -2388,7 +2397,6 @@ create:
If the table exists, we should either not create it or replace it
*/
lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB;
- lex->create_info.default_table_charset= NULL;
lex->name= null_clex_str;
lex->create_last_non_select_table= lex->last_table();
lex->inc_select_stack_outer_barrier();
@@ -2531,9 +2539,7 @@ create:
}
| create_or_replace DATABASE opt_if_not_exists ident
{
- Lex->create_info.default_table_charset= NULL;
- Lex->create_info.schema_comment= NULL;
- Lex->create_info.used_fields= 0;
+ Lex->create_info.init();
}
opt_create_database_options
{
@@ -3175,7 +3181,7 @@ optionally_qualified_column_ident:
row_field_definition:
row_field_name field_type
{
- Lex->last_field->set_attributes(thd, $2, Lex->charset,
+ Lex->last_field->set_attributes(thd, $2,
COLUMN_DEFINITION_ROUTINE_LOCAL);
}
;
@@ -3208,7 +3214,7 @@ sp_decl_variable_list:
sp_decl_idents_init_vars
field_type
{
- Lex->last_field->set_attributes(thd, $2, Lex->charset,
+ Lex->last_field->set_attributes(thd, $2,
COLUMN_DEFINITION_ROUTINE_LOCAL);
}
sp_opt_default
@@ -5148,24 +5154,21 @@ server_part_option:
opt_versioning_rotation:
/* empty */ {}
| { Lex->clause_that_disallows_subselect= "INTERVAL"; }
- INTERVAL_SYM expr interval opt_versioning_interval_start
+ INTERVAL_SYM expr interval opt_versioning_interval_start opt_vers_auto_part
{
partition_info *part_info= Lex->part_info;
const char *table_name= Lex->create_last_non_select_table->table_name.str;
- if (unlikely(part_info->vers_set_interval(thd, $3, $4, $5, table_name)))
+ if (unlikely(part_info->vers_set_interval(thd, $3, $4, $5, $6,
+ table_name)))
MYSQL_YYABORT;
}
- | LIMIT ulonglong_num
- {
- partition_info *part_info= Lex->part_info;
- if (unlikely(part_info->vers_set_limit($2)))
+ | LIMIT ulonglong_num opt_vers_auto_part
{
- my_error(ER_PART_WRONG_VALUE, MYF(0),
- Lex->create_last_non_select_table->table_name.str,
- "LIMIT");
- MYSQL_YYABORT;
+ partition_info *part_info= Lex->part_info;
+ const char *table_name= Lex->create_last_non_select_table->table_name.str;
+ if (unlikely(part_info->vers_set_limit($2, $3, table_name)))
+ MYSQL_YYABORT;
}
- }
;
@@ -5180,6 +5183,16 @@ opt_versioning_interval_start:
}
;
+opt_vers_auto_part:
+ /* empty */
+ {
+ $$= 0;
+ }
+ | AUTO_SYM
+ {
+ $$= 1;
+ }
+ ;
/*
End of partition parser part
*/
@@ -5553,15 +5566,9 @@ default_charset:
default_collation:
opt_default COLLATE_SYM opt_equal collation_name_or_default
{
- HA_CREATE_INFO *cinfo= &Lex->create_info;
- if (unlikely((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
- cinfo->default_table_charset && $4 &&
- !($4= merge_charset_and_collation(cinfo->default_table_charset,
- $4))))
+ Table_specification_st *cinfo= &Lex->create_info;
+ if (unlikely(cinfo->add_table_option_default_collation($4)))
MYSQL_YYABORT;
-
- Lex->create_info.default_table_charset= $4;
- Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
}
;
@@ -5779,7 +5786,7 @@ field_spec:
if (unlikely(!f))
MYSQL_YYABORT;
- lex->init_last_field(f, &$1, NULL);
+ lex->init_last_field(f, &$1);
$<create_field>$= f;
lex->parsing_options.lookup_keywords_after_qualifier= true;
}
@@ -5807,10 +5814,16 @@ field_spec:
field_type_or_serial:
qualified_field_type
{
- Lex->last_field->set_attributes(thd, $1, Lex->charset,
+ Lex->last_field->set_attributes(thd, $1,
COLUMN_DEFINITION_TABLE_FIELD);
}
field_def
+ {
+ auto tmp= $1.charset_collation_attrs();
+ if (tmp.merge_column_charset_clause_and_collate_clause($3))
+ MYSQL_YYABORT;
+ Lex->last_field->set_charset_collation_attrs(tmp);
+ }
| SERIAL_SYM
{
Lex->last_field->set_handler(&type_handler_ulonglong);
@@ -5842,24 +5855,33 @@ opt_asrow_attribute_list:
;
field_def:
- /* empty */ { }
+ /* empty */ { $$.init(); }
| attribute_list
- | attribute_list compressed_deprecated_column_attribute
+ | attribute_list compressed_deprecated_column_attribute { $$= $1; }
| attribute_list compressed_deprecated_column_attribute attribute_list
+ {
+ if (($$= $1).merge_column_collate_clause_and_collate_clause($3))
+ MYSQL_YYABORT;
+ }
| opt_generated_always AS virtual_column_func
{
Lex->last_field->vcol_info= $3;
}
vcol_opt_specifier vcol_opt_attribute
+ {
+ $$.init();
+ }
| opt_generated_always AS ROW_SYM START_SYM opt_asrow_attribute
{
if (Lex->last_field_generated_always_as_row_start())
MYSQL_YYABORT;
+ $$.init();
}
| opt_generated_always AS ROW_SYM END opt_asrow_attribute
{
if (Lex->last_field_generated_always_as_row_end())
MYSQL_YYABORT;
+ $$.init();
}
;
@@ -6032,14 +6054,12 @@ field_type_numeric:
| FLOAT_SYM float_options last_field_options
{
$$.set(&type_handler_float, $2);
- if ($2.length() && !$2.dec())
+ if ($2.has_explicit_length() && !$2.has_explicit_dec())
{
- int err;
- ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err);
- if (unlikely(err || tmp_length > PRECISION_FOR_DOUBLE))
+ if (unlikely($2.length() > PRECISION_FOR_DOUBLE))
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
Lex->last_field->field_name.str));
- if (tmp_length > PRECISION_FOR_FLOAT)
+ if ($2.length() > PRECISION_FOR_FLOAT)
$$.set(&type_handler_double);
else
$$.set(&type_handler_float);
@@ -6051,17 +6071,17 @@ field_type_numeric:
}
| BOOL_SYM
{
- $$.set(&type_handler_stiny, "1");
+ $$.set_handler_length(&type_handler_stiny, 1);
}
| BOOLEAN_SYM
{
- $$.set(&type_handler_stiny, "1");
+ $$.set_handler_length(&type_handler_stiny, 1);
}
| DECIMAL_SYM float_options last_field_options
{ $$.set(&type_handler_newdecimal, $2);}
| NUMBER_ORACLE_SYM float_options last_field_options
{
- if ($2.length() != 0)
+ if ($2.has_explicit_length())
$$.set(&type_handler_newdecimal, $2);
else
$$.set(&type_handler_double);
@@ -6074,63 +6094,58 @@ field_type_numeric:
opt_binary_and_compression:
- /* empty */
- | binary
- | binary compressed_deprecated_data_type_attribute
- | compressed opt_binary
+ /* empty */ { $$.init(); }
+ | binary { $$= $1; }
+ | binary compressed_deprecated_data_type_attribute { $$= $1; }
+ | compressed opt_binary { $$= $2; }
;
field_type_string:
char opt_field_length opt_binary
{
- $$.set(&type_handler_string, $2);
+ $$.set(&type_handler_string, $2, $3);
}
| nchar opt_field_length opt_bin_mod
{
- $$.set(&type_handler_string, $2);
- bincmp_collation(national_charset_info, $3);
+ $$.set(&type_handler_string, $2,
+ Lex_exact_charset_extended_collation_attrs::national($3));
}
| BINARY opt_field_length
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_string, $2);
+ $$.set(&type_handler_string, $2, &my_charset_bin);
}
| varchar opt_field_length opt_binary_and_compression
{
- $$.set(&type_handler_varchar, $2);
+ $$.set(&type_handler_varchar, $2, $3);
}
| VARCHAR2_ORACLE_SYM opt_field_length opt_binary_and_compression
{
- $$.set(&type_handler_varchar, $2);
+ $$.set(&type_handler_varchar, $2, $3);
}
| nvarchar opt_field_length opt_compressed opt_bin_mod
{
- $$.set(&type_handler_varchar, $2);
- bincmp_collation(national_charset_info, $4);
+ $$.set(&type_handler_varchar, $2,
+ Lex_exact_charset_extended_collation_attrs::national($4));
}
| VARBINARY opt_field_length opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_varchar, $2);
+ $$.set(&type_handler_varchar, $2, &my_charset_bin);
}
| RAW_ORACLE_SYM opt_field_length opt_compressed
{
- Lex->charset= &my_charset_bin;
- $$.set(&type_handler_varchar, $2);
+ $$.set(&type_handler_varchar, $2, &my_charset_bin);
}
;
field_type_temporal:
YEAR_SYM opt_field_length last_field_options
{
- if ($2)
+ if ($2.has_explicit_length())
{
- errno= 0;
- ulong length= strtoul($2, NULL, 10);
- if (errno == 0 && length <= MAX_FIELD_BLOBLENGTH && length != 4)
+ if ($2.length() != 4)
{
char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
- my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
+ my_snprintf(buff, sizeof(buff), "YEAR(%u)", (uint) $2.length());
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_WARN_DEPRECATED_SYNTAX,
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX),
@@ -6164,65 +6179,57 @@ field_type_temporal:
field_type_lob:
TINYBLOB opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_tiny_blob);
+ $$.set(&type_handler_tiny_blob, &my_charset_bin);
}
| BLOB_MARIADB_SYM opt_field_length opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_blob, $2);
+ $$.set(&type_handler_blob, $2, &my_charset_bin);
}
| BLOB_ORACLE_SYM field_length opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_blob, $2);
+ $$.set(&type_handler_blob, $2, &my_charset_bin);
}
| BLOB_ORACLE_SYM opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_long_blob);
+ $$.set(&type_handler_long_blob, &my_charset_bin);
}
| MEDIUMBLOB opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_medium_blob);
+ $$.set(&type_handler_medium_blob, &my_charset_bin);
}
| LONGBLOB opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_long_blob);
+ $$.set(&type_handler_long_blob, &my_charset_bin);
}
| LONG_SYM VARBINARY opt_compressed
{
- Lex->charset=&my_charset_bin;
- $$.set(&type_handler_medium_blob);
+ $$.set(&type_handler_medium_blob, &my_charset_bin);
}
| LONG_SYM varchar opt_binary_and_compression
- { $$.set(&type_handler_medium_blob); }
+ { $$.set(&type_handler_medium_blob, $3); }
| TINYTEXT opt_binary_and_compression
- { $$.set(&type_handler_tiny_blob); }
+ { $$.set(&type_handler_tiny_blob, $2); }
| TEXT_SYM opt_field_length opt_binary_and_compression
- { $$.set(&type_handler_blob, $2); }
+ { $$.set(&type_handler_blob, $2, $3); }
| MEDIUMTEXT opt_binary_and_compression
- { $$.set(&type_handler_medium_blob); }
+ { $$.set(&type_handler_medium_blob, $2); }
| LONGTEXT opt_binary_and_compression
- { $$.set(&type_handler_long_blob); }
+ { $$.set(&type_handler_long_blob, $2); }
| CLOB_ORACLE_SYM opt_binary_and_compression
- { $$.set(&type_handler_long_blob); }
+ { $$.set(&type_handler_long_blob, $2); }
| LONG_SYM opt_binary_and_compression
- { $$.set(&type_handler_medium_blob); }
+ { $$.set(&type_handler_medium_blob, $2); }
| JSON_SYM opt_compressed
{
- Lex->charset= &my_charset_utf8mb4_bin;
- $$.set(&type_handler_long_blob_json);
+ $$.set(&type_handler_long_blob_json, &my_charset_utf8mb4_bin);
}
;
field_type_misc:
ENUM '(' string_list ')' opt_binary
- { $$.set(&type_handler_enum); }
+ { $$.set(&type_handler_enum, $5); }
| SET '(' string_list ')' opt_binary
- { $$.set(&type_handler_set); }
+ { $$.set(&type_handler_set, $5); }
;
char:
@@ -6277,9 +6284,9 @@ srid_option:
;
float_options:
- /* empty */ { $$.set(0, 0); }
- | field_length { $$.set($1, 0); }
- | precision { $$= $1; }
+ /* empty */ { $$.reset(); }
+ | field_length
+ | precision
;
precision:
@@ -6299,26 +6306,43 @@ last_field_options:
field_options { Lex->last_field->flags|= ($$= $1); }
;
-field_length:
+field_length_str:
'(' LONG_NUM ')' { $$= $2.str; }
| '(' ULONGLONG_NUM ')' { $$= $2.str; }
| '(' DECIMAL_NUM ')' { $$= $2.str; }
| '(' NUM ')' { $$= $2.str; }
;
+field_length: field_length_str { $$.set($1, NULL); }
+ ;
+
+
+field_scale: field_length_str { $$.set(NULL, $1); }
+ ;
+
+
opt_field_length:
- /* empty */ { $$= (char*) 0; /* use default length */ }
- | field_length { $$= $1; }
+ /* empty */ { $$.reset(); /* use default length */ }
+ | field_length
+ ;
+
+opt_field_scale:
+ /* empty */ { $$.reset(); }
+ | field_scale
;
opt_precision:
- /* empty */ { $$.set(0, 0); }
+ /* empty */ { $$.reset(); }
| precision { $$= $1; }
;
attribute_list:
- attribute_list attribute {}
+ attribute_list attribute
+ {
+ if (($$= $1).merge_column_collate_clause_and_collate_clause($2))
+ MYSQL_YYABORT;
+ }
| attribute
;
@@ -6327,30 +6351,34 @@ attribute:
{
Lex->last_field->flags&= ~NOT_NULL_FLAG;
Lex->last_field->explicitly_nullable= true;
+ $$.init();
+ }
+ | DEFAULT column_default_expr
+ {
+ Lex->last_field->default_value= $2;
+ $$.init();
}
- | DEFAULT column_default_expr { Lex->last_field->default_value= $2; }
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
{
Item *item= new (thd->mem_root) Item_func_now_local(thd, $4);
if (unlikely(item == NULL))
MYSQL_YYABORT;
Lex->last_field->on_update= item;
+ $$.init();
}
- | AUTO_INC { Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
+ | AUTO_INC { Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; $$.init(); }
| SERIAL_SYM DEFAULT VALUE_SYM
{
LEX *lex=Lex;
lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG;
lex->alter_info.flags|= ALTER_ADD_INDEX;
+ $$.init();
}
| COLLATE_SYM collation_name
{
- if (unlikely(Lex->charset && !my_charset_same(Lex->charset,$2)))
- my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
- $2->coll_name.str, Lex->charset->cs_name.str));
- Lex->last_field->charset= $2;
+ $$= Lex_exact_charset_extended_collation_attrs($2);
}
- | serial_attribute
+ | serial_attribute { $$.init(); }
;
opt_compression_method:
@@ -6488,20 +6516,17 @@ old_or_new_charset_name_or_default:
collation_name:
ident_or_text
{
- if (unlikely(!($$= mysqld_collation_get_by_name($1.str,
+ CHARSET_INFO *cs;
+ if (unlikely(!(cs= mysqld_collation_get_by_name($1.str,
thd->get_utf8_flag()))))
MYSQL_YYABORT;
+ $$= Lex_extended_collation(Lex_exact_collation(cs));
}
;
-opt_collate:
- /* empty */ { $$=NULL; }
- | COLLATE_SYM collation_name_or_default { $$=$2; }
- ;
-
collation_name_or_default:
collation_name { $$=$1; }
- | DEFAULT { $$=NULL; }
+ | DEFAULT { $$.set_collate_default(); }
;
opt_default:
@@ -6519,32 +6544,49 @@ charset_or_alias:
}
;
-collate: COLLATE_SYM collation_name_or_default { $$= $2; }
- ;
-
opt_binary:
- /* empty */ { bincmp_collation(NULL, false); }
- | binary {}
+ /* empty */ { $$.init(); }
+ | binary
;
binary:
- BYTE_SYM { bincmp_collation(&my_charset_bin, false); }
- | charset_or_alias opt_bin_mod { bincmp_collation($1, $2); }
- | BINARY { bincmp_collation(NULL, true); }
- | BINARY charset_or_alias { bincmp_collation($2, true); }
- | charset_or_alias collate
- {
- if (!$2)
- Lex->charset= $1; // CHARACTER SET cs COLLATE DEFAULT
- else
- {
- if (!my_charset_same($2, $1))
- my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
- $2->coll_name.str, $1->cs_name.str));
- Lex->charset= $2;
- }
+ BYTE_SYM
+ {
+ $$.set_charset(Lex_exact_charset(&my_charset_bin));
+ }
+ | charset_or_alias
+ {
+ $$.set_charset(Lex_exact_charset($1));
+ }
+ | charset_or_alias BINARY
+ {
+ if ($$.set_charset_collate_binary(Lex_exact_charset($1)))
+ MYSQL_YYABORT;
+ }
+ | BINARY { $$.set_contextually_typed_binary_style(); }
+ | BINARY charset_or_alias
+ {
+ if ($$.set_charset_collate_binary(Lex_exact_charset($2)))
+ MYSQL_YYABORT;
+ }
+ | charset_or_alias COLLATE_SYM DEFAULT
+ {
+ $$.set_charset_collate_default(Lex_exact_charset($1));
+ }
+ | charset_or_alias COLLATE_SYM collation_name
+ {
+ if ($3.merge_exact_charset(Lex_exact_charset($1)))
+ MYSQL_YYABORT;
+ $$= Lex_exact_charset_extended_collation_attrs($3);
+ }
+ | COLLATE_SYM collation_name
+ {
+ $$= Lex_exact_charset_extended_collation_attrs($2);
+ }
+ | COLLATE_SYM DEFAULT
+ {
+ $$.set_collate_default();
}
- | collate { Lex->charset= $1; }
;
opt_bin_mod:
@@ -6952,9 +6994,7 @@ alter:
}
| ALTER DATABASE ident_or_empty
{
- Lex->create_info.default_table_charset= NULL;
- Lex->create_info.schema_comment= NULL;
- Lex->create_info.used_fields= 0;
+ Lex->create_info.init();
if (Lex->main_select_push(true))
MYSQL_YYABORT;
}
@@ -6970,8 +7010,7 @@ alter:
}
| ALTER DATABASE COMMENT_SYM opt_equal TEXT_STRING_sys
{
- Lex->create_info.default_table_charset= NULL;
- Lex->create_info.used_fields= 0;
+ Lex->create_info.init();
Lex->create_info.schema_comment= thd->make_clex_string($5);
Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT;
}
@@ -7614,19 +7653,16 @@ alter_list_item:
lex->alter_info.alter_rename_key_list.push_back(ak);
lex->alter_info.flags|= ALTER_RENAME_INDEX;
}
- | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
+ | CONVERT_SYM TO_SYM charset charset_name_or_default
{
- if (!$4)
- {
- $4= thd->variables.collation_database;
- }
- $5= $5 ? $5 : $4;
- if (unlikely(!my_charset_same($4,$5)))
- my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
- $5->coll_name.str, $4->cs_name.str));
- if (unlikely(Lex->create_info.add_alter_list_item_convert_to_charset($5)))
+ if (Lex->add_alter_list_item_convert_to_charset($4))
+ MYSQL_YYABORT;
+ }
+ | CONVERT_SYM TO_SYM charset charset_name_or_default
+ COLLATE_SYM collation_name_or_default
+ {
+ if (Lex->add_alter_list_item_convert_to_charset($4, $6))
MYSQL_YYABORT;
- Lex->alter_info.flags|= ALTER_CONVERT_TO;
}
| create_table_options_space_separated
{
@@ -9472,15 +9508,14 @@ opt_dyncol_type:
/* empty */
{
$$.set(DYN_COL_NULL); /* automatic type */
- Lex->charset= NULL;
}
| AS dyncol_type { $$= $2; }
;
dyncol_type:
- numeric_dyncol_type { $$= $1; Lex->charset= NULL; }
- | temporal_dyncol_type { $$= $1; Lex->charset= NULL; }
- | string_dyncol_type { $$= $1; }
+ numeric_dyncol_type
+ | temporal_dyncol_type
+ | string_dyncol_type
;
numeric_dyncol_type:
@@ -9494,28 +9529,25 @@ numeric_dyncol_type:
temporal_dyncol_type:
DATE_SYM { $$.set(DYN_COL_DATE); }
- | TIME_SYM opt_field_length { $$.set(DYN_COL_TIME, 0, $2); }
- | DATETIME opt_field_length { $$.set(DYN_COL_DATETIME, 0, $2); }
+ | TIME_SYM opt_field_scale { $$.set(DYN_COL_TIME, $2); }
+ | DATETIME opt_field_scale { $$.set(DYN_COL_DATETIME, $2); }
;
string_dyncol_type:
- char
- { Lex->charset= thd->variables.collation_connection; }
- opt_binary
+ char opt_binary
{
- $$.set(DYN_COL_STRING);
+ if ($$.set(DYN_COL_STRING, $2, thd->variables.collation_connection))
+ MYSQL_YYABORT;
}
| nchar
{
- $$.set(DYN_COL_STRING);
- Lex->charset= national_charset_info;
+ $$.set(DYN_COL_STRING, national_charset_info);
}
;
dyncall_create_element:
expr ',' expr opt_dyncol_type
{
- LEX *lex= Lex;
$$= (DYNCALL_CREATE_DEF *)
alloc_root(thd->mem_root, sizeof(DYNCALL_CREATE_DEF));
if (unlikely($$ == NULL))
@@ -9523,13 +9555,13 @@ dyncall_create_element:
$$->key= $1;
$$->value= $3;
$$->type= (DYNAMIC_COLUMN_TYPE)$4.dyncol_type();
- $$->cs= lex->charset;
- if ($4.length())
- $$->len= strtoul($4.length(), NULL, 10);
+ $$->cs= $4.charset_collation();
+ if ($4.has_explicit_length())
+ $$->len= $4.length();
else
$$->len= 0;
- if ($4.dec())
- $$->frac= strtoul($4.dec(), NULL, 10);
+ if ($4.has_explicit_dec())
+ $$->frac= $4.dec();
else
$$->len= 0;
}
@@ -9662,8 +9694,7 @@ column_default_non_parenthesized_expr:
}
| CAST_SYM '(' expr AS cast_type ')'
{
- if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3,
- Lex->charset))))
+ if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3))))
MYSQL_YYABORT;
}
| CASE_SYM when_list_opt_else END
@@ -9679,8 +9710,7 @@ column_default_non_parenthesized_expr:
}
| CONVERT_SYM '(' expr ',' cast_type ')'
{
- if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3,
- Lex->charset))))
+ if (unlikely(!($$= $5.create_typecast_item_or_error(thd, $3))))
MYSQL_YYABORT;
}
| CONVERT_SYM '(' expr USING charset_name ')'
@@ -9759,7 +9789,9 @@ string_factor_expr:
primary_expr
| string_factor_expr COLLATE_SYM collation_name
{
- if (unlikely(!($$= new (thd->mem_root) Item_func_set_collation(thd, $1, $3))))
+ if (unlikely(!($$= new (thd->mem_root)
+ Item_func_set_collation(thd, $1,
+ $3.charset_info()))))
MYSQL_YYABORT;
}
;
@@ -10223,10 +10255,8 @@ function_call_nonkeyword:
|
COLUMN_GET_SYM '(' expr ',' expr AS cast_type ')'
{
- LEX *lex= Lex;
$$= create_func_dyncol_get(thd, $3, $5, $7.type_handler(),
- $7.length(), $7.dec(),
- lex->charset);
+ $7, $7.charset());
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
@@ -11133,26 +11163,31 @@ in_sum_expr:
cast_type:
BINARY opt_field_length
- { $$.set(&type_handler_long_blob, $2); Lex->charset= &my_charset_bin; }
- | CHAR_SYM opt_field_length
- { Lex->charset= thd->variables.collation_connection; }
- opt_binary
- { $$.set(&type_handler_long_blob, $2); }
- | VARCHAR field_length
- { Lex->charset= thd->variables.collation_connection; }
- opt_binary
- { $$.set(&type_handler_long_blob, $2); }
- | VARCHAR2_ORACLE_SYM field_length
- { Lex->charset= thd->variables.collation_connection; }
- opt_binary
- { $$.set(&type_handler_long_blob, $2); }
+ { $$.set(&type_handler_long_blob, $2, &my_charset_bin); }
+ | CHAR_SYM opt_field_length opt_binary
+ {
+ if ($$.set(&type_handler_long_blob, $2, $3,
+ thd->variables.collation_connection))
+ MYSQL_YYABORT;
+ }
+ | VARCHAR field_length opt_binary
+ {
+ if ($$.set(&type_handler_long_blob, $2, $3,
+ thd->variables.collation_connection))
+ MYSQL_YYABORT;
+ }
+ | VARCHAR2_ORACLE_SYM field_length opt_binary
+ {
+ if ($$.set(&type_handler_long_blob, $2, $3,
+ thd->variables.collation_connection))
+ MYSQL_YYABORT;
+ }
| NCHAR_SYM opt_field_length
{
- Lex->charset= national_charset_info;
- $$.set(&type_handler_long_blob, $2, 0);
+ $$.set(&type_handler_long_blob, $2, national_charset_info);
}
- | cast_type_numeric { $$= $1; Lex->charset= NULL; }
- | cast_type_temporal { $$= $1; Lex->charset= NULL; }
+ | cast_type_numeric { $$= $1; }
+ | cast_type_temporal { $$= $1; }
| IDENT_sys
{
if (Lex->set_cast_type_udt(&$$, $1))
@@ -11183,11 +11218,11 @@ cast_type_numeric:
cast_type_temporal:
DATE_SYM { $$.set(&type_handler_newdate); }
- | TIME_SYM opt_field_length { $$.set(&type_handler_time2, 0, $2); }
- | DATETIME opt_field_length { $$.set(&type_handler_datetime2, 0, $2); }
- | INTERVAL_SYM DAY_SECOND_SYM field_length
+ | TIME_SYM opt_field_scale { $$.set(&type_handler_time2, $2); }
+ | DATETIME opt_field_scale { $$.set(&type_handler_datetime2, $2); }
+ | INTERVAL_SYM DAY_SECOND_SYM field_scale
{
- $$.set(&type_handler_interval_DDhhmmssff, 0, $3);
+ $$.set(&type_handler_interval_DDhhmmssff, $3);
}
;
@@ -11361,7 +11396,7 @@ json_table_column:
!lex->json_table->m_cur_json_table_column))
MYSQL_YYABORT;
- lex->init_last_field(f, &$1, NULL);
+ lex->init_last_field(f, &$1);
}
json_table_column_type
{
@@ -11391,8 +11426,8 @@ json_table_column_type:
FOR_SYM ORDINALITY_SYM
{
Lex_field_type_st type;
- type.set_handler_length_flags(&type_handler_slong, 0, 0);
- Lex->last_field->set_attributes(thd, type, Lex->charset,
+ type.set(&type_handler_slong);
+ Lex->last_field->set_attributes(thd, type,
COLUMN_DEFINITION_TABLE_FIELD);
Lex->json_table->m_cur_json_table_column->
set(Json_table_column::FOR_ORDINALITY);
@@ -11400,20 +11435,23 @@ json_table_column_type:
| json_table_field_type PATH_SYM json_text_literal
json_opt_on_empty_or_error
{
- Lex->last_field->set_attributes(thd, $1, Lex->charset,
+ Lex->last_field->set_attributes(thd, $1,
COLUMN_DEFINITION_TABLE_FIELD);
if (Lex->json_table->m_cur_json_table_column->
- set(thd, Json_table_column::PATH, $3, Lex->charset))
+ set(thd, Json_table_column::PATH, $3,
+ $1.charset_collation_attrs()))
{
MYSQL_YYABORT;
}
}
| json_table_field_type EXISTS PATH_SYM json_text_literal
{
- Lex->last_field->set_attributes(thd, $1, Lex->charset,
+ Lex->last_field->set_attributes(thd, $1,
COLUMN_DEFINITION_TABLE_FIELD);
- Lex->json_table->m_cur_json_table_column->
- set(thd, Json_table_column::EXISTS_PATH, $4, Lex->charset);
+ if (Lex->json_table->m_cur_json_table_column->
+ set(thd, Json_table_column::EXISTS_PATH, $4,
+ $1.charset_collation_attrs()))
+ MYSQL_YYABORT;
}
;
@@ -11813,7 +11851,8 @@ opt_outer:
index_hint_clause:
/* empty */
{
- $$= thd->variables.old_mode ? INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL;
+ $$= (thd->variables.old_behavior & OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN) ?
+ INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL;
}
| FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; }
| FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; }
@@ -14008,12 +14047,25 @@ show_param:
Lex->spname= $3;
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
}
- | describe_command FOR_SYM expr
+ | describe_command opt_format_json FOR_SYM expr
+ /*
+ The alternaltive syntax for this command is MySQL-compatible
+ EXPLAIN FOR CONNECTION
+ */
{
Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
- if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN)))
+ if (unlikely(prepare_schema_table(thd, Lex, 0,
+ Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR)))
MYSQL_YYABORT;
- add_value_to_list(thd, $3);
+ add_value_to_list(thd, $4);
+ }
+ | ANALYZE_SYM opt_format_json FOR_SYM expr
+ {
+ Lex->sql_command= SQLCOM_SHOW_ANALYZE;
+ if (unlikely(prepare_schema_table(thd, Lex, 0,
+ Lex->explain_json ? SCH_ANALYZE_JSON : SCH_ANALYZE_TABULAR)))
+ MYSQL_YYABORT;
+ add_value_to_list(thd, $4);
}
| IDENT_sys remember_tok_start wild_and_where
{
@@ -14167,8 +14219,8 @@ opt_format_json:
else if (lex_string_eq(&$3, STRING_WITH_LEN("TRADITIONAL")))
DBUG_ASSERT(Lex->explain_json==false);
else
- my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), "EXPLAIN",
- $3.str));
+ my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0),
+ "EXPLAIN/ANALYZE", $3.str));
}
;
@@ -14185,6 +14237,31 @@ opt_describe_column:
}
;
+explain_for_connection:
+ /*
+ EXPLAIN FOR CONNECTION is an alternative syntax for
+ SHOW EXPLAIN FOR command. It was introduced for compatibility
+ with MySQL which implements EXPLAIN FOR CONNECTION command
+ */
+ describe_command opt_format_json FOR_SYM CONNECTION_SYM expr
+ {
+ LEX *lex=Lex;
+ lex->wild=0;
+ lex->ident= null_clex_str;
+ if (Lex->main_select_push())
+ MYSQL_YYABORT;
+ mysql_init_select(lex);
+ lex->current_select->parsing_place= SELECT_LIST;
+ lex->create_info.init();
+ Select->parsing_place= NO_MATTER;
+ Lex->pop_select(); //main select
+ Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
+ if (unlikely(prepare_schema_table(thd, Lex, 0,
+ Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR)))
+ MYSQL_YYABORT;
+ add_value_to_list(thd, $5);
+ }
+ ;
/* flush things */
@@ -16603,26 +16680,20 @@ option_value_no_option_type:
thd->parse_error();
MYSQL_YYABORT;
}
- | NAMES_SYM charset_name_or_default opt_collate
+ | NAMES_SYM charset_name_or_default
{
- if (sp_create_assignment_lex(thd, $1.pos()))
- MYSQL_YYABORT;
- LEX *lex= Lex;
- CHARSET_INFO *cs2;
- CHARSET_INFO *cs3;
- cs2= $2 ? $2 : global_system_variables.character_set_client;
- cs3= $3 ? $3 : cs2;
- if (unlikely(!my_charset_same(cs2, cs3)))
- {
- my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
- cs3->coll_name.str, cs2->cs_name.str);
+ CHARSET_INFO *def= global_system_variables.character_set_client;
+ Lex_exact_charset_opt_extended_collate tmp($2 ? $2 : def, false);
+ if (Lex->set_names($1.pos(), tmp, yychar == YYEMPTY))
MYSQL_YYABORT;
- }
- set_var_collation_client *var;
- var= new (thd->mem_root) set_var_collation_client(cs3, cs3, cs3);
- if (unlikely(var == NULL) ||
- unlikely(lex->var_list.push_back(var, thd->mem_root)) ||
- unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY)))
+ }
+ | NAMES_SYM charset_name_or_default
+ COLLATE_SYM collation_name_or_default
+ {
+ CHARSET_INFO *def= global_system_variables.character_set_client;
+ Lex_exact_charset_opt_extended_collate tmp($2 ? $2 : def, false);
+ if (tmp.merge_collation($4) ||
+ Lex->set_names($1.pos(), tmp, yychar == YYEMPTY))
MYSQL_YYABORT;
}
| DEFAULT ROLE_SYM grant_role
@@ -17835,8 +17906,7 @@ sf_return_type:
{
LEX *lex= Lex;
lex->init_last_field(&lex->sphead->m_return_field_def,
- &empty_clex_str,
- thd->variables.collation_database);
+ &empty_clex_str);
}
field_type
{
diff --git a/sql/structs.h b/sql/structs.h
index 0e4ca6236fe..5cf10c61ca5 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -28,6 +28,7 @@
#include "my_base.h" /* ha_rows, ha_key_alg */
#include <mysql_com.h> /* USERNAME_LENGTH */
#include "sql_bitmap.h"
+#include "lex_charset.h"
struct TABLE;
class Type_handler;
@@ -601,17 +602,84 @@ public:
struct Lex_length_and_dec_st
{
-private:
- const char *m_length;
- const char *m_dec;
+protected:
+ uint32 m_length;
+ uint8 m_dec;
+ uint8 m_collation_type:LEX_CHARSET_COLLATION_TYPE_BITS;
+ bool m_has_explicit_length:1;
+ bool m_has_explicit_dec:1;
+ bool m_length_overflowed:1;
+ bool m_dec_overflowed:1;
+
+ static_assert(LEX_CHARSET_COLLATION_TYPE_BITS <= 8,
+ "Lex_length_and_dec_st::m_collation_type bits check");
+
public:
- void set(const char *length, const char *dec)
+ void reset()
+ {
+ m_length= 0;
+ m_dec= 0;
+ m_collation_type= 0;
+ m_has_explicit_length= false;
+ m_has_explicit_dec= false;
+ m_length_overflowed= false;
+ m_dec_overflowed= false;
+ }
+ void set_length_only(uint32 length)
{
m_length= length;
+ m_dec= 0;
+ m_collation_type= 0;
+ m_has_explicit_length= true;
+ m_has_explicit_dec= false;
+ m_length_overflowed= false;
+ m_dec_overflowed= false;
+ }
+ void set_dec_only(uint8 dec)
+ {
+ m_length= 0;
m_dec= dec;
+ m_collation_type= 0;
+ m_has_explicit_length= false;
+ m_has_explicit_dec= true;
+ m_length_overflowed= false;
+ m_dec_overflowed= false;
+ }
+ void set_length_and_dec(uint32 length, uint8 dec)
+ {
+ m_length= length;
+ m_dec= dec;
+ m_collation_type= 0;
+ m_has_explicit_length= true;
+ m_has_explicit_dec= true;
+ m_length_overflowed= false;
+ m_dec_overflowed= false;
+ }
+ void set(const char *length, const char *dec);
+ uint32 length() const
+ {
+ return m_length;
+ }
+ uint8 dec() const
+ {
+ return m_dec;
+ }
+ bool has_explicit_length() const
+ {
+ return m_has_explicit_length;
+ }
+ bool has_explicit_dec() const
+ {
+ return m_has_explicit_dec;
+ }
+ bool length_overflowed() const
+ {
+ return m_length_overflowed;
+ }
+ bool dec_overflowed() const
+ {
+ return m_dec_overflowed;
}
- const char *length() const { return m_length; }
- const char *dec() const { return m_dec; }
};
@@ -619,32 +687,64 @@ struct Lex_field_type_st: public Lex_length_and_dec_st
{
private:
const Type_handler *m_handler;
- void set(const Type_handler *handler, const char *length, const char *dec)
+ CHARSET_INFO *m_ci;
+public:
+ void set(const Type_handler *handler,
+ Lex_length_and_dec_st length_and_dec,
+ CHARSET_INFO *cs= NULL)
{
m_handler= handler;
- Lex_length_and_dec_st::set(length, dec);
+ m_ci= cs;
+ Lex_length_and_dec_st::operator=(length_and_dec);
}
-public:
- void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec)
+ void set(const Type_handler *handler,
+ const Lex_length_and_dec_st &length_and_dec,
+ const Lex_column_charset_collation_attrs_st &coll)
{
m_handler= handler;
+ m_ci= coll.charset_info();
Lex_length_and_dec_st::operator=(length_and_dec);
+ // Using bit-and to avoid the warning:
+ // conversion from ‘uint8’ to ‘unsigned char:3’ may change value
+ m_collation_type= ((uint8) coll.type()) & LEX_CHARSET_COLLATION_TYPE_MASK;
}
- void set_handler_length_flags(const Type_handler *handler, const char *length,
- uint32 flags);
- void set(const Type_handler *handler, const char *length)
+ void set(const Type_handler *handler,
+ const Lex_column_charset_collation_attrs_st &coll)
+ {
+ m_handler= handler;
+ m_ci= coll.charset_info();
+ Lex_length_and_dec_st::reset();
+ // Using bit-and to avoid the warning:
+ // conversion from ‘uint8’ to ‘unsigned char:3’ may change value
+ m_collation_type= ((uint8) coll.type()) & LEX_CHARSET_COLLATION_TYPE_MASK;
+ }
+ void set(const Type_handler *handler, CHARSET_INFO *cs= NULL)
{
- set(handler, length, 0);
+ m_handler= handler;
+ m_ci= cs;
+ Lex_length_and_dec_st::reset();
}
- void set(const Type_handler *handler)
+ void set_handler_length_flags(const Type_handler *handler,
+ const Lex_length_and_dec_st &length,
+ uint32 flags);
+ void set_handler_length(const Type_handler *handler, uint32 length)
{
- set(handler, 0, 0);
+ m_handler= handler;
+ m_ci= NULL;
+ Lex_length_and_dec_st::set_length_only(length);
}
void set_handler(const Type_handler *handler)
{
m_handler= handler;
}
const Type_handler *type_handler() const { return m_handler; }
+ CHARSET_INFO *charset_collation() const { return m_ci; }
+ Lex_column_charset_collation_attrs charset_collation_attrs() const
+ {
+ return Lex_column_charset_collation_attrs(m_ci,
+ (Lex_column_charset_collation_attrs_st::Type)
+ m_collation_type);
+ }
};
@@ -652,26 +752,38 @@ struct Lex_dyncol_type_st: public Lex_length_and_dec_st
{
private:
int m_type; // enum_dynamic_column_type is not visible here, so use int
+ CHARSET_INFO *m_ci;
public:
- void set(int type, const char *length, const char *dec)
+ void set(int type, Lex_length_and_dec_st length_and_dec,
+ CHARSET_INFO *cs= NULL)
{
m_type= type;
- Lex_length_and_dec_st::set(length, dec);
+ m_ci= cs;
+ Lex_length_and_dec_st::operator=(length_and_dec);
}
- void set(int type, Lex_length_and_dec_st length_and_dec)
+ void set(int type)
{
m_type= type;
- Lex_length_and_dec_st::operator=(length_and_dec);
+ m_ci= NULL;
+ Lex_length_and_dec_st::reset();
}
- void set(int type, const char *length)
+ void set(int type, CHARSET_INFO *cs)
{
- set(type, length, 0);
+ m_type= type;
+ m_ci= cs;
+ Lex_length_and_dec_st::reset();
}
- void set(int type)
+ bool set(int type, const Lex_column_charset_collation_attrs_st &collation,
+ CHARSET_INFO *charset)
{
- set(type, 0, 0);
+ CHARSET_INFO *tmp= collation.resolved_to_character_set(charset);
+ if (!tmp)
+ return true;
+ set(type, tmp);
+ return false;
}
int dyncol_type() const { return m_type; }
+ CHARSET_INFO *charset_collation() const { return m_ci; }
};
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index a149bd23f33..614ba288636 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -789,11 +789,27 @@ static bool check_charset(sys_var *self, THD *thd, set_var *var)
else // INT_RESULT
{
int csno= (int)var->value->val_int();
- if (!(var->save_result.ptr= get_charset(csno, MYF(0))))
+ CHARSET_INFO *cs;
+ if ((var->save_result.ptr= cs= get_charset(csno, MYF(0))))
{
- my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), llstr(csno, buff));
- return true;
+ /*
+ Backward compatibility: pre MDEV-30824 servers
+ can write non-default collation IDs to binary log:
+ SET character_set_client=83; -- utf8mb3_bin
+ Convert a non-default collation to the compiled default collation,
+ e.g. utf8mb3_bin to utf8mb3_general_ci, but only if
+ - THD is a slave thread or
+ - is processing a mysqlbinlog output.
+ */
+ if ((cs->state & MY_CS_PRIMARY) ||
+ ((thd->variables.pseudo_slave_mode || thd->slave_thread) &&
+ (var->save_result.ptr=
+ Lex_exact_charset_opt_extended_collate(cs, true).
+ find_default_collation())))
+ return false;
}
+ my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), llstr(csno, buff));
+ return true;
}
return false;
}
@@ -2657,9 +2673,28 @@ static Sys_var_ulong Sys_net_retry_count(
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_net_retry_count));
+static bool set_old_mode (sys_var *self, THD *thd, enum_var_type type)
+{
+ if (thd->variables.old_mode)
+ {
+ thd->variables.old_behavior|= (OLD_MODE_NO_PROGRESS_INFO |
+ OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN |
+ OLD_MODE_COMPAT_5_1_CHECKSUM);
+ }
+ else
+ {
+ thd->variables.old_behavior&= ~(OLD_MODE_NO_PROGRESS_INFO|
+ OLD_MODE_IGNORE_INDEX_ONLY_FOR_JOIN |
+ OLD_MODE_COMPAT_5_1_CHECKSUM);
+ }
+
+ return false;
+}
+
static Sys_var_mybool Sys_old_mode(
"old", "Use compatible behavior from previous MariaDB version. See also --old-mode",
- SESSION_VAR(old_mode), CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+ SESSION_VAR(old_mode), CMD_LINE(OPT_ARG), DEFAULT(FALSE), 0, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(set_old_mode), DEPRECATED("'@@old_mode'"));
static const char *alter_algorithm_modes[]= {"DEFAULT", "COPY", "INPLACE",
"NOCOPY", "INSTANT", NULL};
@@ -3776,6 +3811,8 @@ static const char *old_mode_names[]=
"NO_PROGRESS_INFO",
"ZERO_DATE_TIME_CAST",
"UTF8_IS_UTF8MB3",
+ "IGNORE_INDEX_ONLY_FOR_JOIN",
+ "COMPAT_5_1_CHECKSUM",
0
};
@@ -4424,7 +4461,7 @@ static bool fix_autocommit(sys_var *self, THD *thd, enum_var_type type)
transaction implicitly at the end (@sa stmt_causes_implicitcommit()).
*/
thd->variables.option_bits&=
- ~(OPTION_BEGIN | OPTION_KEEP_LOG | OPTION_NOT_AUTOCOMMIT |
+ ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX | OPTION_NOT_AUTOCOMMIT |
OPTION_GTID_BEGIN);
thd->transaction->all.modified_non_trans_table= false;
thd->transaction->all.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
@@ -5990,6 +6027,11 @@ static Sys_var_charptr Sys_wsrep_notify_cmd(
READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG),
DEFAULT(""));
+static Sys_var_charptr_fscs Sys_wsrep_status_file(
+ "wsrep_status_file", "wsrep status output filename",
+ READ_ONLY GLOBAL_VAR(wsrep_status_file), CMD_LINE(REQUIRED_ARG),
+ DEFAULT(""));
+
static Sys_var_mybool Sys_wsrep_certify_nonPK(
"wsrep_certify_nonPK", "Certify tables with no primary key",
GLOBAL_VAR(wsrep_certify_nonPK),
diff --git a/sql/table.cc b/sql/table.cc
index 36d34331136..10bd4056ac2 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -45,6 +45,7 @@
#include "ha_sequence.h"
#include "sql_show.h"
#include "opt_trace.h"
+#include "sql_db.h" // get_default_db_collation
/* For MySQL 5.7 virtual fields */
#define MYSQL57_GENERATED_FIELD 128
@@ -3487,6 +3488,20 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
old_lex= thd->lex;
thd->lex= &tmp_lex;
+
+ /*
+ THD::reset_db() does not set THD::db_charset,
+ so it keeps pointing to the character set and collation
+ of the current database, rather than the database of the
+ new initialized table. After reset_db() the result of
+ get_default_db_collation() can be wrong. The latter is
+ used inside charset_collation_context_create_table_in_db().
+ Let's initialize ctx before calling reset_db().
+ This makes sure the db.opt file to be loaded properly when needed.
+ */
+ Charset_collation_context
+ ctx(thd->charset_collation_context_create_table_in_db(db.str));
+
thd->reset_db(&db);
lex_start(thd);
@@ -3494,6 +3509,9 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
sql_unusable_for_discovery(thd, hton, sql_copy))))
goto ret;
+ if (thd->lex->create_info.resolve_to_charset_collation_context(thd, ctx))
+ DBUG_RETURN(true);
+
thd->lex->create_info.db_type= hton;
#ifdef WITH_PARTITION_STORAGE_ENGINE
thd->work_part_info= 0; // For partitioning
@@ -10412,5 +10430,5 @@ void TABLE::mark_table_for_reopen()
{
THD *thd= in_use;
DBUG_ASSERT(thd);
- thd->locked_tables_list.mark_table_for_reopen(thd, this);
+ thd->locked_tables_list.mark_table_for_reopen(this);
}
diff --git a/sql/table.h b/sql/table.h
index 83abc107971..2cbe00e6910 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -78,6 +78,7 @@ class derived_handler;
class Pushdown_derived;
struct Name_resolution_context;
class Table_function_json_table;
+class Open_table_context;
/*
Used to identify NESTED_JOIN structures within a join (applicable only to
@@ -929,6 +930,13 @@ struct TABLE_SHARE
vers_kind_t versioned;
period_info_t vers;
period_info_t period;
+ /*
+ Protect multiple threads from repeating partition auto-create over
+ single share.
+
+ TODO: remove it when partitioning metadata will be in TABLE_SHARE.
+ */
+ bool vers_skip_auto_create;
bool init_period_from_extra2(period_info_t *period, const uchar *data,
const uchar *end);
@@ -1841,6 +1849,10 @@ public:
ulonglong vers_start_id() const;
ulonglong vers_end_id() const;
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ bool vers_switch_partition(THD *thd, TABLE_LIST *table_list,
+ Open_table_context *ot_ctx);
+#endif
int update_generated_fields();
int period_make_insert(Item *src, Field *dst);
@@ -2641,6 +2653,13 @@ struct TABLE_LIST
bool merged;
bool merged_for_insert;
bool sequence; /* Part of NEXTVAL/CURVAL/LASTVAL */
+ /*
+ Protect single thread from repeating partition auto-create over
+ multiple share instances (as the share is closed on backoff action).
+
+ Skips auto-create only for one given query id.
+ */
+ query_id_t vers_skip_create;
/*
Items created by create_view_field and collected to change them in case
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 958abebfc47..123f9283d23 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -133,7 +133,7 @@ bool trans_begin(THD *thd, uint flags)
#endif /* WITH_WSREP */
}
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
/*
The following set should not be needed as transaction state should
@@ -280,7 +280,7 @@ bool trans_commit(THD *thd)
else
repl_semisync_master.wait_after_commit(thd, FALSE);
#endif
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
thd->transaction->all.reset();
thd->lex->start_transaction_opt= 0;
@@ -329,7 +329,7 @@ bool trans_commit_implicit(THD *thd)
res= MY_TEST(ha_commit_trans(thd, TRUE));
}
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
thd->transaction->all.reset();
/* The transaction should be marked as complete in P_S. */
@@ -374,7 +374,7 @@ bool trans_rollback(THD *thd)
repl_semisync_master.wait_after_rollback(thd, FALSE);
#endif
/* Reset the binlog transaction marker */
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG |
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX |
OPTION_GTID_BEGIN);
thd->transaction->all.reset();
thd->lex->start_transaction_opt= 0;
@@ -424,7 +424,7 @@ bool trans_rollback_implicit(THD *thd)
of new transacton in @@autocommit=1 mode. This is necessary to
preserve backward compatibility.
*/
- thd->variables.option_bits&= ~(OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BINLOG_THIS_TRX);
thd->transaction->all.reset();
/* Rollback should clear transaction_rollback_request flag. */
@@ -463,7 +463,7 @@ bool trans_commit_stmt(THD *thd)
a savepoint for each nested statement, and release the
savepoint when statement has succeeded.
*/
- DBUG_ASSERT(! thd->in_sub_stmt);
+ DBUG_ASSERT(!(thd->in_sub_stmt));
thd->merge_unsafe_rollback_flags();
@@ -669,7 +669,7 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_CSTRING name)
if (ha_rollback_to_savepoint(thd, sv))
res= TRUE;
- else if (((thd->variables.option_bits & OPTION_KEEP_LOG) ||
+ else if (((thd->variables.option_bits & OPTION_BINLOG_THIS_TRX) ||
thd->transaction->all.modified_non_trans_table) &&
!thd->slave_thread)
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
diff --git a/sql/wsrep_mutex.h b/sql/wsrep_mutex.h
index f396c1be331..50f129c96cd 100644
--- a/sql/wsrep_mutex.h
+++ b/sql/wsrep_mutex.h
@@ -20,6 +20,7 @@
#include "wsrep/mutex.hpp"
/* implementation */
+#include "my_global.h"
#include "my_pthread.h"
class Wsrep_mutex : public wsrep::mutex
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index cff31ab4484..00e3413ecd3 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -17,6 +17,7 @@
#include "sql_plugin.h" /* wsrep_plugins_pre_init() */
#include "my_global.h"
#include "wsrep_server_state.h"
+#include "wsrep_status.h"
#include "mariadb.h"
#include <mysqld.h>
@@ -82,6 +83,7 @@ const char *wsrep_start_position;
const char *wsrep_data_home_dir;
const char *wsrep_dbug_option;
const char *wsrep_notify_cmd;
+const char *wsrep_status_file;
ulong wsrep_debug; // Debug level logging
my_bool wsrep_convert_LOCK_to_trx; // Convert locking sessions to trx
@@ -774,6 +776,8 @@ int wsrep_init_server()
wsrep::log::logger_fn(wsrep_log_cb);
try
{
+ Wsrep_status::init_once(wsrep_status_file);
+
std::string server_name;
std::string server_id;
std::string node_address;
@@ -842,6 +846,7 @@ void wsrep_deinit_server()
{
wsrep_deinit_schema();
Wsrep_server_state::destroy();
+ Wsrep_status::destroy();
}
int wsrep_init()
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index d14e5995771..470727a02da 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -67,6 +67,7 @@ extern const char* wsrep_start_position;
extern ulong wsrep_max_ws_size;
extern ulong wsrep_max_ws_rows;
extern const char* wsrep_notify_cmd;
+extern const char* wsrep_status_file;
extern my_bool wsrep_certify_nonPK;
extern long int wsrep_protocol_version;
extern my_bool wsrep_desync;
diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc
index 1de93d0d0e8..8446f11a34f 100644
--- a/sql/wsrep_notify.cc
+++ b/sql/wsrep_notify.cc
@@ -17,10 +17,13 @@
#include <mysqld.h>
#include "wsrep_priv.h"
#include "wsrep_utils.h"
+#include "wsrep_status.h"
void wsrep_notify_status(enum wsrep::server_state::state status,
const wsrep::view* view)
{
+ Wsrep_status::report_state(status);
+
if (!wsrep_notify_cmd || 0 == strlen(wsrep_notify_cmd))
{
WSREP_INFO("wsrep_notify_cmd is not defined, skipping notification.");
diff --git a/sql/wsrep_plugin.cc b/sql/wsrep_plugin.cc
index 743b8a593b8..d23c51b19e1 100644
--- a/sql/wsrep_plugin.cc
+++ b/sql/wsrep_plugin.cc
@@ -11,7 +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include "wsrep_trans_observer.h"
#include "wsrep_mysqld.h"
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index 8c8e568c62d..118bedecff3 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -525,6 +525,57 @@ static int generate_binlog_index_opt_val(char** ret)
return 0;
}
+// report progress event
+static void sst_report_progress(int const from,
+ long long const total_prev,
+ long long const total,
+ long long const complete)
+{
+ static char buf[128] = { '\0', };
+ static size_t const buf_len= sizeof(buf) - 1;
+ snprintf(buf, buf_len,
+ "{ \"from\": %d, \"to\": %d, \"total\": %lld, \"done\": %lld, "
+ "\"indefinite\": -1 }",
+ from, WSREP_MEMBER_JOINED, total_prev + total, total_prev +complete);
+ WSREP_DEBUG("REPORTING SST PROGRESS: '%s'", buf);
+}
+
+// process "complete" event from SST script feedback
+static void sst_handle_complete(const char* const input,
+ long long const total_prev,
+ long long* total,
+ long long* complete,
+ int const from)
+{
+ long long x;
+ int n= sscanf(input, " %lld", &x);
+ if (n > 0 && x > *complete)
+ {
+ *complete= x;
+ if (*complete > *total) *total= *complete;
+ sst_report_progress(from, total_prev, *total, *complete);
+ }
+}
+
+// process "total" event from SST script feedback
+static void sst_handle_total(const char* const input,
+ long long* total_prev,
+ long long* total,
+ long long* complete,
+ int const from)
+{
+ long long x;
+ int n= sscanf(input, " %lld", &x);
+ if (n > 0)
+ {
+ // new stage starts, update total_prev
+ *total_prev+= *total;
+ *total= x;
+ *complete= 0;
+ sst_report_progress(from, *total_prev, *total, *complete);
+ }
+}
+
static void* sst_joiner_thread (void* a)
{
sst_thread_arg* arg= (sst_thread_arg*) a;
@@ -532,8 +583,8 @@ static void* sst_joiner_thread (void* a)
{
THD* thd;
- const char magic[]= "ready";
- const size_t magic_len= sizeof(magic) - 1;
+ static const char magic[]= "ready";
+ static const size_t magic_len= sizeof(magic) - 1;
const size_t out_len= 512;
char out[out_len];
@@ -586,22 +637,51 @@ static void* sst_joiner_thread (void* a)
wsrep_uuid_t ret_uuid = WSREP_UUID_UNDEFINED;
wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED;
- // in case of successfull receiver start, wait for SST
- // completion/end
- char* tmp= my_fgets (out, out_len, proc.pipe());
-
- proc.wait();
+ // current stage progress
+ long long total= 0;
+ long long complete= 0;
+ // previous stages cumulative progress
+ long long total_prev= 0;
+ // in case of successful receiver start, wait for SST completion/end
+ const char* tmp= NULL;
err= EINVAL;
- if (!tmp)
+ wait_signal:
+ tmp= my_fgets (out, out_len, proc.pipe());
+
+ if (tmp)
+ {
+ static const char magic_total[]= "total";
+ static const size_t total_len=strlen(magic_total);
+ static const char magic_complete[]= "complete";
+ static const size_t complete_len=strlen(magic_complete);
+ static const int from= WSREP_MEMBER_JOINER;
+
+ if (!strncasecmp (tmp, magic_complete, complete_len))
+ {
+ sst_handle_complete(tmp + complete_len, total_prev, &total, &complete,
+ from);
+ goto wait_signal;
+ }
+ else if (!strncasecmp (tmp, magic_total, total_len))
+ {
+ sst_handle_total(tmp + total_len, &total_prev, &total, &complete, from);
+ goto wait_signal;
+ }
+ }
+ else
{
WSREP_ERROR("Failed to read uuid:seqno and wsrep_gtid_domain_id from "
"joiner script.");
+ proc.wait();
if (proc.error()) err= proc.error();
}
- else
+
+ // this should be the final script output with GTID
+ if (tmp)
{
+ proc.wait();
// Read state ID (UUID:SEQNO) followed by wsrep_gtid_domain_id (if any).
const char *pos= strchr(out, ' ');
@@ -1081,7 +1161,7 @@ static ssize_t sst_prepare_other (const char* method,
method, addr_in, mysql_real_data_home,
wsrep_defaults_file,
(int)getpid(),
- 0,
+ wsrep_debug ? 1 : 0,
binlog_opt_val, binlog_index_opt_val);
my_free(binlog_opt_val);
@@ -1719,16 +1799,38 @@ static void* sst_donor_thread (void* a)
if (proc.pipe() && !err)
{
+ long long total= 0;
+ long long complete= 0;
+ // total form previous stages
+ long long total_prev= 0;
+
wait_signal:
out= my_fgets (out_buf, out_len, proc.pipe());
if (out)
{
- const char magic_flush[]= "flush tables";
- const char magic_cont[]= "continue";
- const char magic_done[]= "done";
-
- if (!strcasecmp (out, magic_flush))
+ static const char magic_flush[]= "flush tables";
+ static const char magic_cont[]= "continue";
+ static const char magic_done[]= "done";
+ static const size_t done_len=strlen(magic_done);
+ static const char magic_total[]= "total";
+ static const size_t total_len=strlen(magic_total);
+ static const char magic_complete[]= "complete";
+ static const size_t complete_len=strlen(magic_complete);
+ static const int from= WSREP_MEMBER_DONOR;
+
+ if (!strncasecmp (out, magic_complete, complete_len))
+ {
+ sst_handle_complete(out + complete_len, total_prev, &total, &complete,
+ from);
+ goto wait_signal;
+ }
+ else if (!strncasecmp (out, magic_total, total_len))
+ {
+ sst_handle_total(out + total_len, &total_prev, &total, &complete, from);
+ goto wait_signal;
+ }
+ else if (!strcasecmp (out, magic_flush))
{
err= sst_flush_tables (thd.ptr);
@@ -1773,7 +1875,7 @@ wait_signal:
err= 0;
goto wait_signal;
}
- else if (!strncasecmp (out, magic_done, strlen(magic_done)))
+ else if (!strncasecmp (out, magic_done, done_len))
{
err= sst_scan_uuid_seqno (out + strlen(magic_done) + 1,
&ret_uuid, &ret_seqno);
@@ -1781,6 +1883,7 @@ wait_signal:
else
{
WSREP_WARN("Received unknown signal: '%s'", out);
+ err = -EINVAL;
proc.wait();
}
}
@@ -1874,7 +1977,7 @@ static int sst_donate_other (const char* method,
"%s"
"%s",
method, addr, mysqld_port, mysqld_unix_port,
- 0,
+ wsrep_debug ? 1 : 0,
mysql_real_data_home,
wsrep_defaults_file,
uuid_oss.str().c_str(), gtid.seqno().get(), wsrep_gtid_server.domain_id,
diff --git a/sql/wsrep_status.cc b/sql/wsrep_status.cc
new file mode 100644
index 00000000000..eacd7080d00
--- /dev/null
+++ b/sql/wsrep_status.cc
@@ -0,0 +1,60 @@
+/* Copyright 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
+ 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 "wsrep_status.h"
+
+mysql_mutex_t LOCK_wsrep_status;
+
+#ifdef HAVE_PSI_INTERFACE
+PSI_mutex_key key_LOCK_wsrep_status;
+#endif
+
+Wsrep_mutex* Wsrep_status::m_mutex = 0;
+wsrep::reporter* Wsrep_status::m_instance = 0;
+
+void Wsrep_status::report_log_msg(wsrep::reporter::log_level const level,
+ const char* const tag, size_t const tag_len,
+ const char* const buf, size_t const buf_len,
+ double const tstamp)
+{
+ if (!Wsrep_status::m_instance) return;
+
+ Wsrep_status::m_instance->report_log_msg(level,
+ std::string(tag, tag_len) + std::string(buf, buf_len),
+ tstamp);
+}
+
+void Wsrep_status::init_once(const std::string& file_name)
+{
+ if (file_name.length() > 0 && m_instance == 0)
+ {
+ mysql_mutex_init(key_LOCK_wsrep_status, &LOCK_wsrep_status,
+ MY_MUTEX_INIT_FAST);
+ m_mutex = new Wsrep_mutex(&LOCK_wsrep_status);
+ m_instance = new wsrep::reporter(*m_mutex, file_name, 4);
+ }
+}
+
+void Wsrep_status::destroy()
+{
+ if (m_instance)
+ {
+ delete m_instance;
+ m_instance= 0;
+ delete m_mutex;
+ m_mutex= 0;
+ mysql_mutex_destroy(&LOCK_wsrep_status);
+ }
+}
diff --git a/sql/wsrep_status.h b/sql/wsrep_status.h
new file mode 100644
index 00000000000..dd83dda2857
--- /dev/null
+++ b/sql/wsrep_status.h
@@ -0,0 +1,62 @@
+/* Copyright 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
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#ifndef WSREP_STATUS_H
+#define WSREP_STATUS_H
+
+/* wsrep-lib */
+#include "wsrep/reporter.hpp"
+
+/* implementation */
+#include "wsrep_mutex.h"
+
+class Wsrep_status
+{
+public:
+ static void init_once(const std::string& file_name);
+ static void destroy();
+
+ static void report_state(enum wsrep::server_state::state const state)
+ {
+ if (!Wsrep_status::m_instance) return;
+
+ Wsrep_status::m_instance->report_state(state);
+ }
+
+ static void report_progress(const std::string& progress)
+ {
+ if (!Wsrep_status::m_instance) return;
+
+ Wsrep_status::m_instance->report_progress(progress);
+ }
+
+ static void report_log_msg(wsrep::reporter::log_level level,
+ const char* tag, size_t tag_len,
+ const char* buf, size_t buf_len,
+ double const tstamp = wsrep::reporter::undefined);
+
+ static bool is_instance_initialized()
+ {
+ return m_instance;
+ }
+
+private:
+ Wsrep_status(const std::string& file_name);
+
+ static Wsrep_mutex* m_mutex;
+ static wsrep::reporter* m_instance;
+};
+
+#endif /* WSREP_STATUS_H */
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index 42ba56fa2c2..812452f451a 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -11,7 +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#ifndef WSREP_TRANS_OBSERVER_H
#define WSREP_TRANS_OBSERVER_H
diff --git a/sql/wsrep_utils.h b/sql/wsrep_utils.h
index 743e8d1fb70..c5959b8174b 100644
--- a/sql/wsrep_utils.h
+++ b/sql/wsrep_utils.h
@@ -21,6 +21,27 @@
unsigned int wsrep_check_ip (const char* const addr, bool *is_ipv6);
size_t wsrep_guess_ip (char* buf, size_t buf_len);
+namespace wsp {
+class node_status
+{
+public:
+ node_status() : status(wsrep::server_state::s_disconnected) {}
+ void set(enum wsrep::server_state::state new_status,
+ const wsrep::view* view= 0)
+ {
+ if (status != new_status || 0 != view)
+ {
+ wsrep_notify_status(new_status, view);
+ status= new_status;
+ }
+ }
+ enum wsrep::server_state::state get() const { return status; }
+private:
+ enum wsrep::server_state::state status;
+};
+} /* namespace wsp */
+
+extern wsp::node_status local_status;
/* returns the length of the host part of the address string */
size_t wsrep_host_len(const char* addr, size_t addr_len);
diff --git a/sql/xa.cc b/sql/xa.cc
index ff104dea602..0e421ac62f5 100644
--- a/sql/xa.cc
+++ b/sql/xa.cc
@@ -396,7 +396,7 @@ bool xa_trans_force_rollback(THD *thd)
rc= true;
}
thd->variables.option_bits&=
- ~(OPTION_BEGIN | OPTION_KEEP_LOG | OPTION_GTID_BEGIN);
+ ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX | OPTION_GTID_BEGIN);
thd->transaction->all.reset();
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
@@ -533,7 +533,7 @@ bool trans_xa_prepare(THD *thd)
{
if (!mdl_request.ticket)
ha_rollback_trans(thd, TRUE);
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
thd->transaction->all.reset();
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
@@ -726,7 +726,7 @@ bool trans_xa_commit(THD *thd)
DBUG_RETURN(TRUE);
}
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
thd->transaction->all.reset();
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
@@ -1105,7 +1105,7 @@ bool mysql_xa_recover(THD *thd)
static bool slave_applier_reset_xa_trans(THD *thd)
{
- thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
+ thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_BINLOG_THIS_TRX);
thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS"));
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index a46d6001434..4490f179d24 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -24,10 +24,8 @@
#define ARGS MY_MIN(24,(int)len-i),s+MY_MAX(i-3,0)
-#if defined(_WIN32)
-#define EL "\r\n"
-#else
-#define EL "\n"
+#define EL "\n"
+#if !defined(_WIN32)
#undef SE_CATCH // Does not work for Linux
#endif
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 4fad2b27cd8..d0b7b3163b6 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -199,23 +199,16 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
p = filename + strlen(filename) - 1;
-#if !defined(_WIN32)
- // Data files can be imported from Windows (having CRLF)
+
+ // Data files can have CRLF
if (*p == '\n' || *p == '\r') {
- // is this enough for Unix ???
p--; // Eliminate ending CR or LF character
if (p >= filename)
- // is this enough for Unix ???
if (*p == '\n' || *p == '\r')
p--; // Eliminate ending CR or LF character
- } // endif p
-
-#else
- if (*p == '\n')
- p--; // Eliminate ending new-line character
-#endif
+ } // endif p
// Trim rightmost blanks
for (; p >= filename && *p == ' '; p--) ;
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 691993c819e..acfef5daad2 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1720,40 +1720,144 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept
mach_write_to_8(my_assume_aligned<8>(c), next_checkpoint_lsn);
mach_write_to_8(my_assume_aligned<8>(c + 8), end_lsn);
mach_write_to_4(my_assume_aligned<4>(c + 60), my_crc32c(0, c, 60));
+
+ lsn_t resizing;
+
#ifdef HAVE_PMEM
if (is_pmem())
+ {
+ resizing= resize_lsn.load(std::memory_order_relaxed);
+
+ if (resizing > 1 && resizing <= next_checkpoint_lsn)
+ {
+ memcpy_aligned<64>(resize_buf + CHECKPOINT_1, c, 64);
+ header_write(resize_buf, resizing, is_encrypted());
+ pmem_persist(resize_buf, resize_target);
+ }
pmem_persist(c, 64);
+ }
else
#endif
{
ut_ad(!checkpoint_pending);
checkpoint_pending= true;
latch.wr_unlock();
+ log_write_and_flush_prepare();
+ resizing= resize_lsn.load(std::memory_order_relaxed);
/* FIXME: issue an asynchronous write */
log.write(offset, {c, get_block_size()});
+ if (resizing > 1 && resizing <= next_checkpoint_lsn)
+ {
+ byte *buf= static_cast<byte*>(aligned_malloc(4096, 4096));
+ memset_aligned<4096>(buf, 0, 4096);
+ header_write(buf, resizing, is_encrypted());
+ resize_log.write(0, {buf, 4096});
+ aligned_free(buf);
+ resize_log.write(CHECKPOINT_1, {c, get_block_size()});
+ }
+
if (srv_file_flush_method != SRV_O_DSYNC)
ut_a(log.flush());
latch.wr_lock(SRW_LOCK_CALL);
ut_ad(checkpoint_pending);
checkpoint_pending= false;
+ resizing= resize_lsn.load(std::memory_order_relaxed);
}
ut_ad(!checkpoint_pending);
next_checkpoint_no++;
- last_checkpoint_lsn= next_checkpoint_lsn;
+ const lsn_t checkpoint_lsn{next_checkpoint_lsn};
+ last_checkpoint_lsn= checkpoint_lsn;
DBUG_PRINT("ib_log", ("checkpoint ended at " LSN_PF ", flushed to " LSN_PF,
- next_checkpoint_lsn, get_flushed_lsn()));
+ checkpoint_lsn, get_flushed_lsn()));
if (overwrite_warned)
{
sql_print_information("InnoDB: Crash recovery was broken "
"between LSN=" LSN_PF
" and checkpoint LSN=" LSN_PF ".",
- overwrite_warned, next_checkpoint_lsn);
+ overwrite_warned, checkpoint_lsn);
overwrite_warned= 0;
}
- latch.wr_unlock();
+ lsn_t resizing_completed= 0;
+
+ if (resizing > 1 && resizing <= checkpoint_lsn)
+ {
+ ut_ad(is_pmem() == !resize_flush_buf);
+
+ if (!is_pmem())
+ {
+ if (srv_file_flush_method != SRV_O_DSYNC)
+ ut_a(resize_log.flush());
+ IF_WIN(log.close(),);
+ }
+
+ if (resize_rename())
+ {
+ /* Resizing failed. Discard the log_sys.resize_log. */
+#ifdef HAVE_PMEM
+ if (is_pmem())
+ my_munmap(resize_buf, resize_target);
+ else
+#endif
+ {
+ ut_free_dodump(resize_buf, buf_size);
+ ut_free_dodump(resize_flush_buf, buf_size);
+#ifdef _WIN32
+ ut_ad(!log.is_opened());
+ bool success;
+ log.m_file=
+ os_file_create_func(get_log_file_path().c_str(),
+ OS_FILE_OPEN | OS_FILE_ON_ERROR_NO_EXIT,
+ OS_FILE_NORMAL, OS_LOG_FILE, false, &success);
+ ut_a(success);
+ ut_a(log.is_opened());
+#endif
+ }
+ }
+ else
+ {
+ /* Adopt the resized log. */
+#ifdef HAVE_PMEM
+ if (is_pmem())
+ {
+ my_munmap(buf, file_size);
+ buf= resize_buf;
+ buf_free= START_OFFSET + (get_lsn() - resizing);
+ }
+ else
+#endif
+ {
+ IF_WIN(,log.close());
+ std::swap(log, resize_log);
+ ut_free_dodump(buf, buf_size);
+ ut_free_dodump(flush_buf, buf_size);
+ buf= resize_buf;
+ flush_buf= resize_flush_buf;
+ }
+ srv_log_file_size= resizing_completed= file_size= resize_target;
+ first_lsn= resizing;
+ set_capacity();
+ }
+ ut_ad(!resize_log.is_opened());
+ resize_buf= nullptr;
+ resize_flush_buf= nullptr;
+ resize_target= 0;
+ resize_lsn.store(0, std::memory_order_relaxed);
+ }
+
+ log_resize_release();
+
+ if (UNIV_LIKELY(resizing <= 1));
+ else if (resizing > checkpoint_lsn)
+ buf_flush_ahead(resizing, false);
+ else if (resizing_completed)
+ ib::info() << "Resized log to " << ib::bytes_iec{resizing_completed}
+ << "; start LSN=" << resizing;
+ else
+ sql_print_error("InnoDB: Resize of log failed at " LSN_PF,
+ get_flushed_lsn());
}
/** Initiate a log checkpoint, discarding the start of the log.
@@ -1770,7 +1874,9 @@ static bool log_checkpoint_low(lsn_t oldest_lsn, lsn_t end_lsn)
ut_ad(end_lsn == log_sys.get_lsn());
if (oldest_lsn == log_sys.last_checkpoint_lsn ||
- (oldest_lsn == end_lsn && oldest_lsn == log_sys.last_checkpoint_lsn +
+ (oldest_lsn == end_lsn &&
+ !log_sys.resize_in_progress() &&
+ oldest_lsn == log_sys.last_checkpoint_lsn +
(log_sys.is_encrypted()
? SIZE_OF_FILE_CHECKPOINT + 8 : SIZE_OF_FILE_CHECKPOINT)))
{
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 8e96685b275..8a67192c5da 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -18476,6 +18476,57 @@ static void innodb_log_file_buffering_update(THD *thd, st_mysql_sys_var*,
}
#endif
+static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*,
+ void *var, const void *save)
+{
+ ut_ad(var == &srv_log_file_size);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+
+ if (high_level_read_only)
+ ib_senderrf(thd, IB_LOG_LEVEL_ERROR, ER_READ_ONLY_MODE);
+ else if (!log_sys.is_pmem() &&
+ *static_cast<const ulonglong*>(save) < log_sys.buf_size)
+ my_printf_error(ER_WRONG_ARGUMENTS,
+ "innodb_log_file_size must be at least"
+ " innodb_log_buffer_size=%zu", MYF(0), log_sys.buf_size);
+ else
+ {
+ switch (log_sys.resize_start(*static_cast<const ulonglong*>(save))) {
+ case log_t::RESIZE_NO_CHANGE:
+ break;
+ case log_t::RESIZE_IN_PROGRESS:
+ my_printf_error(ER_WRONG_USAGE,
+ "innodb_log_file_size change is already in progress",
+ MYF(0));
+ break;
+ case log_t::RESIZE_FAILED:
+ ib_senderrf(thd, IB_LOG_LEVEL_ERROR, ER_CANT_CREATE_HANDLER_FILE);
+ break;
+ case log_t::RESIZE_STARTED:
+ for (timespec abstime;;)
+ {
+ if (thd_kill_level(thd))
+ {
+ log_sys.resize_abort();
+ break;
+ }
+
+ set_timespec(abstime, 5);
+ mysql_mutex_lock(&buf_pool.flush_list_mutex);
+ const bool in_progress(buf_pool.get_oldest_modification(LSN_MAX) <
+ log_sys.resize_in_progress());
+ if (in_progress)
+ my_cond_timedwait(&buf_pool.do_flush_list,
+ &buf_pool.flush_list_mutex.m_mutex, &abstime);
+ mysql_mutex_unlock(&buf_pool.flush_list_mutex);
+ if (!log_sys.resize_in_progress())
+ break;
+ }
+ }
+ }
+ mysql_mutex_lock(&LOCK_global_system_variables);
+}
+
/** Update innodb_status_output or innodb_status_output_locks,
which control InnoDB "status monitor" output to the error log.
@param[out] var current value
@@ -19299,9 +19350,10 @@ static MYSQL_SYSVAR_BOOL(log_file_buffering, log_sys.log_buffered,
#endif
static MYSQL_SYSVAR_ULONGLONG(log_file_size, srv_log_file_size,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ PLUGIN_VAR_RQCMDARG,
"Redo log size in bytes.",
- NULL, NULL, 96 << 20, 4 << 20, std::numeric_limits<ulonglong>::max(), 4096);
+ nullptr, innodb_log_file_size_update,
+ 96 << 20, 4 << 20, std::numeric_limits<ulonglong>::max(), 4096);
static MYSQL_SYSVAR_UINT(old_blocks_pct, innobase_old_blocks_pct,
PLUGIN_VAR_RQCMDARG,
@@ -19444,7 +19496,7 @@ static void innodb_change_buffering_update(THD *thd, struct st_mysql_sys_var*,
}
static MYSQL_SYSVAR_ENUM(change_buffering, innodb_change_buffering,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Buffer changes to secondary indexes.",
nullptr, innodb_change_buffering_update,
IBUF_USE_NONE, &innodb_change_buffering_typelib);
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index 6aca809c341..c77f13b9f5c 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -184,6 +184,8 @@ private:
std::atomic<lsn_t> lsn;
/** the first guaranteed-durable log sequence number */
std::atomic<lsn_t> flushed_to_disk_lsn;
+ /** log sequence number when log resizing was initiated, or 0 */
+ std::atomic<lsn_t> resize_lsn;
/** set when there may be need to flush the log buffer, or
preflush buffer pool pages, or initiate a log checkpoint.
This must hold if lsn - last_checkpoint_lsn > max_checkpoint_age. */
@@ -219,10 +221,19 @@ public:
was noticed. Protected by latch.wr_lock(). */
lsn_t overwrite_warned;
- /** innodb_log_buffer_size (size of buf and flush_buf, in bytes) */
+ /** innodb_log_buffer_size (size of buf,flush_buf if !is_pmem(), in bytes) */
size_t buf_size;
private:
+ /** Log file being constructed during resizing; protected by latch */
+ log_file_t resize_log;
+ /** size of resize_log; protected by latch */
+ lsn_t resize_target;
+ /** Buffer for writing to resize_log; @see buf */
+ byte *resize_buf;
+ /** Buffer for writing to resize_log; @see flush_buf */
+ byte *resize_flush_buf;
+
/** spin lock protecting lsn, buf_free in append_prepare() */
alignas(CPU_LEVEL1_DCACHE_LINESIZE) pthread_mutex_t lsn_lock;
void init_lsn_lock() { pthread_mutex_init(&lsn_lock, LSN_LOCK_ATTR); }
@@ -304,11 +315,48 @@ public:
bool is_opened() const noexcept { return log.is_opened(); }
- static constexpr bool resize_in_progress() { return false; }
+ /** @return LSN at which log resizing was started and is still in progress
+ @retval 0 if no log resizing is in progress */
+ lsn_t resize_in_progress() const noexcept
+ { return resize_lsn.load(std::memory_order_relaxed); }
+
+ /** Status of resize_start() */
+ enum resize_start_status {
+ RESIZE_NO_CHANGE, RESIZE_IN_PROGRESS, RESIZE_STARTED, RESIZE_FAILED
+ };
+
+ /** Start resizing the log and release the exclusive latch.
+ @param size requested new file_size
+ @return whether the resizing was started successfully */
+ resize_start_status resize_start(os_offset_t size) noexcept;
+
+ /** Abort any resize_start(). */
+ void resize_abort() noexcept;
+
+ /** Replicate a write to the log.
+ @param lsn start LSN
+ @param end end of the mini-transaction
+ @param len length of the mini-transaction
+ @param seq offset of the sequence bit from the end */
+ inline void resize_write(lsn_t lsn, const byte *end,
+ size_t len, size_t seq) noexcept;
+
+ /** Write resize_buf to resize_log.
+ @param length the used length of resize_buf */
+ ATTRIBUTE_COLD void resize_write_buf(size_t length) noexcept;
/** Rename a log file after resizing.
@return whether an error occurred */
- static bool rename_resized() noexcept;
+ static bool resize_rename() noexcept;
+
+#ifdef HAVE_PMEM
+ /** @return pointer for writing to resize_buf
+ @retval nullptr if no PMEM based resizing is active */
+ inline byte *resize_buf_begin(lsn_t lsn) const noexcept;
+ /** @return end of resize_buf */
+ inline const byte *resize_buf_end() const noexcept
+ { return resize_buf + resize_target; }
+#endif
#if defined __linux__ || defined _WIN32
/** Try to enable or disable file system caching (update log_buffered) */
@@ -322,6 +370,12 @@ public:
/** Calculate the checkpoint safety margins. */
static void set_capacity();
+ /** Write a log file header.
+ @param buf log header buffer
+ @param lsn log sequence number corresponding to log_sys.START_OFFSET
+ @param encrypted whether the log is encrypted */
+ static void header_write(byte *buf, lsn_t lsn, bool encrypted);
+
lsn_t get_lsn(std::memory_order order= std::memory_order_relaxed) const
{ return lsn.load(order); }
@@ -365,7 +419,7 @@ public:
{ check_flush_or_checkpoint_.store(flag, std::memory_order_relaxed); }
/** Make previous write_buf() durable and update flushed_to_disk_lsn. */
- inline bool flush(lsn_t lsn) noexcept;
+ bool flush(lsn_t lsn) noexcept;
/** Initialise the redo log subsystem. */
void create();
@@ -450,8 +504,7 @@ public:
/** Write buf to ib_logfile0.
@tparam release_latch whether to invoke latch.wr_unlock()
- @return new write target
- @retval 0 if everything was written */
+ @return the current log sequence number */
template<bool release_latch> inline lsn_t write_buf() noexcept;
/** Create the log. */
@@ -465,3 +518,6 @@ extern log_t log_sys;
NOTE that this function may only be called while not holding
any synchronization objects except dict_sys.latch. */
void log_free_check();
+
+/** Release the latches that protect log resizing. */
+void log_resize_release();
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 98df975b078..423203a805c 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -159,13 +159,46 @@ dberr_t log_file_t::read(os_offset_t offset, span<byte> buf) noexcept
void log_file_t::write(os_offset_t offset, span<const byte> buf) noexcept
{
ut_ad(is_opened());
- if (dberr_t err= os_file_write(IORequestWrite, "ib_logfile0", m_file,
- buf.data(), offset, buf.size()))
+ if (dberr_t err= os_file_write_func(IORequestWrite, "ib_logfile0", m_file,
+ buf.data(), offset, buf.size()))
ib::fatal() << "write(\"ib_logfile0\") returned " << err;
}
#ifdef HAVE_PMEM
# include <libpmem.h>
+
+/** Attempt to memory map a file.
+@param file log file handle
+@param size file size
+@return pointer to memory mapping
+@retval MAP_FAILED if the memory cannot be mapped */
+static void *log_mmap(os_file_t file, os_offset_t size)
+{
+ void *ptr=
+ my_mmap(0, size_t(size),
+ srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE,
+ MAP_SHARED_VALIDATE | MAP_SYNC, file, 0);
+#ifdef __linux__
+ if (ptr == MAP_FAILED)
+ {
+ struct stat st;
+ if (!fstat(file, &st))
+ {
+ MSAN_STAT_WORKAROUND(&st);
+ const auto st_dev= st.st_dev;
+ if (!stat("/dev/shm", &st))
+ {
+ MSAN_STAT_WORKAROUND(&st);
+ if (st.st_dev == st_dev)
+ ptr= my_mmap(0, size_t(size),
+ srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE,
+ MAP_SHARED, file, 0);
+ }
+ }
+ }
+#endif /* __linux__ */
+ return ptr;
+}
#endif
void log_t::attach(log_file_t file, os_offset_t size)
@@ -179,29 +212,7 @@ void log_t::attach(log_file_t file, os_offset_t size)
ut_ad(!flush_buf);
if (size && !(size_t(size) & 4095) && srv_operation != SRV_OPERATION_BACKUP)
{
- void *ptr=
- my_mmap(0, size_t(size),
- srv_read_only_mode ? PROT_READ : PROT_READ | PROT_WRITE,
- MAP_SHARED_VALIDATE | MAP_SYNC, log.m_file, 0);
-#ifdef __linux__
- if (ptr == MAP_FAILED)
- {
- struct stat st;
- if (!fstat(log.m_file, &st))
- {
- MSAN_STAT_WORKAROUND(&st);
- const auto st_dev= st.st_dev;
- if (!stat("/dev/shm", &st))
- {
- MSAN_STAT_WORKAROUND(&st);
- if (st.st_dev == st_dev)
- ptr= my_mmap(0, size_t(size), srv_read_only_mode
- ? PROT_READ : PROT_READ | PROT_WRITE,
- MAP_SHARED, log.m_file, 0);
- }
- }
- }
-#endif /* __linux__ */
+ void *ptr= log_mmap(log.m_file, size);
if (ptr != MAP_FAILED)
{
log.close();
@@ -236,6 +247,30 @@ void log_t::attach(log_file_t file, os_offset_t size)
#endif
}
+/** Write a log file header.
+@param buf log header buffer
+@param lsn log sequence number corresponding to log_sys.START_OFFSET
+@param encrypted whether the log is encrypted */
+void log_t::header_write(byte *buf, lsn_t lsn, bool encrypted)
+{
+ mach_write_to_4(my_assume_aligned<4>(buf) + LOG_HEADER_FORMAT,
+ log_sys.FORMAT_10_8);
+ mach_write_to_8(my_assume_aligned<8>(buf + LOG_HEADER_START_LSN), lsn);
+ static constexpr const char LOG_HEADER_CREATOR_CURRENT[]=
+ "MariaDB "
+ IB_TO_STR(MYSQL_VERSION_MAJOR) "."
+ IB_TO_STR(MYSQL_VERSION_MINOR) "."
+ IB_TO_STR(MYSQL_VERSION_PATCH);
+
+ strcpy(reinterpret_cast<char*>(buf) + LOG_HEADER_CREATOR,
+ LOG_HEADER_CREATOR_CURRENT);
+ static_assert(LOG_HEADER_CREATOR_END - LOG_HEADER_CREATOR >=
+ sizeof LOG_HEADER_CREATOR_CURRENT, "compatibility");
+ if (encrypted)
+ log_crypt_write_header(buf + LOG_HEADER_CREATOR_END);
+ mach_write_to_4(my_assume_aligned<4>(508 + buf), my_crc32c(0, buf, 508));
+}
+
void log_t::create(lsn_t lsn) noexcept
{
#ifndef SUX_LOCK_GENERIC
@@ -267,22 +302,7 @@ void log_t::create(lsn_t lsn) noexcept
memset_aligned<4096>(buf, 0, buf_size);
}
- mach_write_to_4(buf + LOG_HEADER_FORMAT, FORMAT_10_8);
- mach_write_to_8(buf + LOG_HEADER_START_LSN, lsn);
- static constexpr const char LOG_HEADER_CREATOR_CURRENT[]=
- "MariaDB "
- IB_TO_STR(MYSQL_VERSION_MAJOR) "."
- IB_TO_STR(MYSQL_VERSION_MINOR) "."
- IB_TO_STR(MYSQL_VERSION_PATCH);
-
- strcpy(reinterpret_cast<char*>(buf) + LOG_HEADER_CREATOR,
- LOG_HEADER_CREATOR_CURRENT);
- static_assert(LOG_HEADER_CREATOR_END - LOG_HEADER_CREATOR >=
- sizeof LOG_HEADER_CREATOR_CURRENT, "compatibility");
- if (is_encrypted())
- log_crypt_write_header(buf + LOG_HEADER_CREATOR_END);
- mach_write_to_4(my_assume_aligned<4>(508 + buf), my_crc32c(0, buf, 508));
-
+ log_sys.header_write(buf, lsn, is_encrypted());
DBUG_PRINT("ib_log", ("write header " LSN_PF, lsn));
#ifdef HAVE_PMEM
@@ -323,7 +343,6 @@ void log_t::close_file()
ib::fatal() << "closing ib_logfile0 failed: " << err;
}
-#if defined __linux__ || defined _WIN32
/** Acquire all latches that protect the log. */
static void log_resize_acquire()
{
@@ -352,6 +371,7 @@ void log_resize_release()
}
}
+#if defined __linux__ || defined _WIN32
/** Try to enable or disable file system caching (update log_buffered) */
void log_t::set_buffered(bool buffered)
{
@@ -379,6 +399,140 @@ void log_t::set_buffered(bool buffered)
}
#endif
+/** Start resizing the log and release the exclusive latch.
+@param size requested new file_size
+@return whether the resizing was started successfully */
+log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept
+{
+ ut_ad(size >= 4U << 20);
+ ut_ad(!(size & 4095));
+ ut_ad(!srv_read_only_mode);
+
+ log_resize_acquire();
+
+ resize_start_status status= RESIZE_NO_CHANGE;
+ lsn_t start_lsn{0};
+
+ if (resize_in_progress())
+ status= RESIZE_IN_PROGRESS;
+ else if (size != file_size)
+ {
+ ut_ad(!resize_in_progress());
+ ut_ad(!resize_log.is_opened());
+ ut_ad(!resize_buf);
+ ut_ad(!resize_flush_buf);
+ std::string path{get_log_file_path("ib_logfile101")};
+ bool success;
+ resize_lsn.store(1, std::memory_order_relaxed);
+ resize_target= 0;
+ resize_log.m_file=
+ os_file_create_func(path.c_str(),
+ OS_FILE_CREATE | OS_FILE_ON_ERROR_NO_EXIT,
+ OS_FILE_NORMAL, OS_LOG_FILE, false, &success);
+ if (success)
+ {
+ log_resize_release();
+
+ void *ptr= nullptr, *ptr2= nullptr;
+ success= os_file_set_size(path.c_str(), resize_log.m_file, size);
+ if (!success);
+#ifdef HAVE_PMEM
+ else if (is_pmem())
+ {
+ ptr= log_mmap(resize_log.m_file, size);
+ if (ptr == MAP_FAILED)
+ goto alloc_fail;
+ }
+#endif
+ else
+ {
+ ptr= ut_malloc_dontdump(buf_size, PSI_INSTRUMENT_ME);
+ if (ptr)
+ {
+ TRASH_ALLOC(ptr, buf_size);
+ ptr2= ut_malloc_dontdump(buf_size, PSI_INSTRUMENT_ME);
+ if (ptr2)
+ TRASH_ALLOC(ptr2, buf_size);
+ else
+ {
+ ut_free_dodump(ptr, buf_size);
+ ptr= nullptr;
+ goto alloc_fail;
+ }
+ }
+ else
+ alloc_fail:
+ success= false;
+ }
+
+ log_resize_acquire();
+
+ if (!success)
+ {
+ resize_log.close();
+ IF_WIN(DeleteFile(path.c_str()), unlink(path.c_str()));
+ }
+ else
+ {
+ resize_target= size;
+ resize_buf= static_cast<byte*>(ptr);
+ resize_flush_buf= static_cast<byte*>(ptr2);
+ if (is_pmem())
+ {
+ resize_log.close();
+ start_lsn= get_lsn();
+ }
+ else
+ {
+ memcpy_aligned<16>(resize_buf, buf, (buf_free + 15) & ~15);
+ start_lsn= first_lsn +
+ (~lsn_t{get_block_size() - 1} & (write_lsn - first_lsn));
+ }
+ }
+ resize_lsn.store(start_lsn, std::memory_order_relaxed);
+ status= success ? RESIZE_STARTED : RESIZE_FAILED;
+ }
+ }
+
+ log_resize_release();
+
+ if (start_lsn)
+ buf_flush_ahead(start_lsn, false);
+
+ return status;
+}
+
+/** Abort log resizing. */
+void log_t::resize_abort() noexcept
+{
+ log_resize_acquire();
+
+ if (resize_in_progress() > 1)
+ {
+ if (!is_pmem())
+ {
+ resize_log.close();
+ ut_free_dodump(resize_buf, buf_size);
+ ut_free_dodump(resize_flush_buf, buf_size);
+ resize_flush_buf= nullptr;
+ }
+#ifdef HAVE_PMEM
+ else
+ {
+ ut_ad(!resize_log.is_opened());
+ ut_ad(!resize_flush_buf);
+ if (resize_buf)
+ my_munmap(resize_buf, resize_target);
+ }
+#endif
+ resize_buf= nullptr;
+ resize_target= 0;
+ resize_lsn.store(0, std::memory_order_relaxed);
+ }
+
+ log_resize_release();
+}
+
/** Write an aligned buffer to ib_logfile0.
@param buf buffer to be written
@param len length of data to be written
@@ -548,8 +702,12 @@ inline void log_t::persist(lsn_t lsn) noexcept
if (old >= lsn)
return;
+ const lsn_t resizing{resize_in_progress()};
+ if (UNIV_UNLIKELY(resizing))
+ latch.rd_lock(SRW_LOCK_CALL);
const size_t start(calc_lsn_offset(old));
const size_t end(calc_lsn_offset(lsn));
+
if (UNIV_UNLIKELY(end < start))
{
pmem_persist(log_sys.buf + start, log_sys.file_size - start);
@@ -561,24 +719,52 @@ inline void log_t::persist(lsn_t lsn) noexcept
old= flushed_to_disk_lsn.load(std::memory_order_relaxed);
- if (old >= lsn)
- return;
+ if (old < lsn)
+ {
+ while (!flushed_to_disk_lsn.compare_exchange_weak
+ (old, lsn, std::memory_order_release, std::memory_order_relaxed))
+ if (old >= lsn)
+ break;
- while (!flushed_to_disk_lsn.compare_exchange_weak
- (old, lsn, std::memory_order_release, std::memory_order_relaxed))
- if (old >= lsn)
- break;
+ log_flush_notify(lsn);
+ DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE(););
+ }
- log_flush_notify(lsn);
- DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE(););
+ if (UNIV_UNLIKELY(resizing))
+ latch.rd_unlock();
}
#endif
+/** Write resize_buf to resize_log.
+@param length the used length of resize_buf */
+ATTRIBUTE_COLD void log_t::resize_write_buf(size_t length) noexcept
+{
+ const size_t block_size_1= get_block_size() - 1;
+ ut_ad(!(resize_target & block_size_1));
+ ut_ad(!(length & block_size_1));
+ ut_ad(length > block_size_1);
+ ut_ad(length <= resize_target);
+ const lsn_t resizing{resize_in_progress()};
+ ut_ad(resizing <= write_lsn);
+ lsn_t offset= START_OFFSET +
+ ((write_lsn - resizing) & ~lsn_t{block_size_1}) %
+ (resize_target - START_OFFSET);
+
+ if (UNIV_UNLIKELY(offset + length > resize_target))
+ {
+ offset= START_OFFSET;
+ resize_lsn.store(first_lsn +
+ (~lsn_t{block_size_1} & (write_lsn - first_lsn)),
+ std::memory_order_relaxed);
+ }
+
+ ut_a(os_file_write_func(IORequestWrite, "ib_logfile101", resize_log.m_file,
+ resize_flush_buf, offset, length) == DB_SUCCESS);
+}
+
/** Write buf to ib_logfile0.
@tparam release_latch whether to invoke latch.wr_unlock()
-@return lsn of a callback pending on write_lock
-@retval 0 if everything was written
-*/
+@return the current log sequence number */
template<bool release_latch> inline lsn_t log_t::write_buf() noexcept
{
#ifndef SUX_LOCK_GENERIC
@@ -601,7 +787,7 @@ template<bool release_latch> inline lsn_t log_t::write_buf() noexcept
write_lock.set_pending(lsn);
ut_ad(write_lsn >= get_flushed_lsn());
const size_t block_size_1{get_block_size() - 1};
- const lsn_t offset{calc_lsn_offset(write_lsn) & ~lsn_t{block_size_1}};
+ lsn_t offset{calc_lsn_offset(write_lsn) & ~lsn_t{block_size_1}};
DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF " at " LSN_PF,
write_lsn, lsn, offset));
@@ -623,15 +809,23 @@ template<bool release_latch> inline lsn_t log_t::write_buf() noexcept
(We want to avoid memset() while holding mutex.)
This block will be overwritten later, once records beyond
the current LSN are generated. */
+# ifdef HAVE_valgrind
MEM_MAKE_DEFINED(buf + length, get_block_size() - new_buf_free);
+ if (UNIV_LIKELY_NULL(resize_flush_buf))
+ MEM_MAKE_DEFINED(resize_buf + length, get_block_size() - new_buf_free);
+# endif
buf[length]= 0; /* allow recovery to catch EOF faster */
length&= ~block_size_1;
memcpy_aligned<16>(flush_buf, buf + length, (new_buf_free + 15) & ~15);
+ if (UNIV_LIKELY_NULL(resize_flush_buf))
+ memcpy_aligned<16>(resize_flush_buf, resize_buf + length,
+ (new_buf_free + 15) & ~15);
length+= get_block_size();
#endif
}
std::swap(buf, flush_buf);
+ std::swap(resize_buf, resize_flush_buf);
write_to_log++;
if (release_latch)
latch.wr_unlock();
@@ -644,13 +838,15 @@ template<bool release_latch> inline lsn_t log_t::write_buf() noexcept
/* Do the write to the log file */
log_write_buf(write_buf, length, offset);
+ if (UNIV_LIKELY_NULL(resize_buf))
+ resize_write_buf(length);
write_lsn= lsn;
}
- return write_lock.release(lsn);
+ return lsn;
}
-inline bool log_t::flush(lsn_t lsn) noexcept
+bool log_t::flush(lsn_t lsn) noexcept
{
ut_ad(lsn >= get_flushed_lsn());
flush_lock.set_pending(lsn);
@@ -718,7 +914,6 @@ repeat:
return;
flush_lock.set_pending(log_sys.get_lsn());
}
-
lsn_t pending_write_lsn= 0, pending_flush_lsn= 0;
@@ -726,7 +921,7 @@ repeat:
group_commit_lock::ACQUIRED)
{
log_sys.latch.wr_lock(SRW_LOCK_CALL);
- pending_write_lsn= log_sys.write_buf<true>();
+ pending_write_lsn= write_lock.release(log_sys.write_buf<true>());
}
if (durable)
@@ -769,8 +964,9 @@ ATTRIBUTE_COLD void log_write_and_flush()
ut_ad(!srv_read_only_mode);
if (!log_sys.is_pmem())
{
- log_sys.write_buf<false>();
- log_flush(write_lock.value());
+ const lsn_t lsn{log_sys.write_buf<false>()};
+ write_lock.release(lsn);
+ log_flush(lsn);
}
#ifdef HAVE_PMEM
else
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 3be297e9666..fb08511126a 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -1074,6 +1074,116 @@ func_exit:
return finish_write(len);
}
+inline void log_t::resize_write(lsn_t lsn, const byte *end, size_t len,
+ size_t seq) noexcept
+{
+#ifndef SUX_LOCK_GENERIC
+ ut_ad(latch.is_locked());
+#endif
+
+ if (UNIV_LIKELY_NULL(resize_buf))
+ {
+ ut_ad(end >= buf);
+ end-= len;
+ size_t s;
+
+#ifdef HAVE_PMEM
+ if (!resize_flush_buf)
+ {
+ ut_ad(is_pmem());
+ const size_t resize_capacity{resize_target - START_OFFSET};
+ const lsn_t resizing{resize_in_progress()};
+ if (UNIV_UNLIKELY(lsn < resizing))
+ {
+ size_t l= resizing - lsn;
+ if (l >= len)
+ return;
+ end+= l - len;
+ len-= l;
+ lsn+= l;
+ }
+ lsn-= resizing;
+ s= START_OFFSET + lsn % resize_capacity;
+
+ if (UNIV_UNLIKELY(end < &buf[START_OFFSET]))
+ {
+ /* The source buffer (log_sys.buf) wrapped around */
+ ut_ad(end + capacity() < &buf[file_size]);
+ ut_ad(end + len >= &buf[START_OFFSET]);
+ ut_ad(end + capacity() + len >= &buf[file_size]);
+
+ size_t l= size_t(buf - (end - START_OFFSET));
+ if (UNIV_LIKELY(s + len <= resize_target))
+ {
+ /* The destination buffer (log_sys.resize_buf) did not wrap around */
+ memcpy(resize_buf + s, end + capacity(), l);
+ memcpy(resize_buf + s + l, &buf[START_OFFSET], len - l);
+ goto pmem_nowrap;
+ }
+ else
+ {
+ /* Both log_sys.buf and log_sys.resize_buf wrapped around */
+ const size_t rl= resize_target - s;
+ if (l <= rl)
+ {
+ /* log_sys.buf wraps around first */
+ memcpy(resize_buf + s, end + capacity(), l);
+ memcpy(resize_buf + s + l, &buf[START_OFFSET], rl - l);
+ memcpy(resize_buf + START_OFFSET, &buf[START_OFFSET + rl - l],
+ len - l);
+ }
+ else
+ {
+ /* log_sys.resize_buf wraps around first */
+ memcpy(resize_buf + s, end + capacity(), rl);
+ memcpy(resize_buf + START_OFFSET, end + capacity() + rl, l - rl);
+ memcpy(resize_buf + START_OFFSET + (l - rl),
+ &buf[START_OFFSET], len - l);
+ }
+ goto pmem_wrap;
+ }
+ }
+ else
+ {
+ ut_ad(end + len <= &buf[file_size]);
+
+ if (UNIV_LIKELY(s + len <= resize_target))
+ {
+ memcpy(resize_buf + s, end, len);
+ pmem_nowrap:
+ s+= len - seq;
+ }
+ else
+ {
+ /* The log_sys.resize_buf wrapped around */
+ memcpy(resize_buf + s, end, resize_target - s);
+ memcpy(resize_buf + START_OFFSET, end + (resize_target - s),
+ len - (resize_target - s));
+ pmem_wrap:
+ s+= len - seq;
+ if (s >= resize_target)
+ s-= resize_capacity;
+ resize_lsn.fetch_add(resize_capacity); /* Move the target ahead. */
+ }
+ }
+ }
+ else
+#endif
+ {
+ ut_ad(resize_flush_buf);
+ s= end - buf;
+ ut_ad(s + len <= buf_size);
+ memcpy(resize_buf + s, end, len);
+ s+= len - seq;
+ }
+
+ /* Always set the sequence bit. If the resized log were to wrap around,
+ we will advance resize_lsn. */
+ ut_ad(resize_buf[s] <= 1);
+ resize_buf[s]= 1;
+ }
+}
+
/** Write the mini-transaction log to the redo log buffer.
@param len number of bytes to write
@return {start_lsn,flush_ahead} */
@@ -1108,6 +1218,7 @@ mtr_t::finish_write(size_t len)
start.second+= 8;
}
mach_write_to_4(start.second, m_crc);
+ start.second+= 4;
}
#ifdef HAVE_PMEM
else
@@ -1154,9 +1265,14 @@ mtr_t::finish_write(size_t len)
::memcpy(start.second, tail, size_left);
::memcpy(log_sys.buf + log_sys.START_OFFSET, tail + size_left,
size - size_left);
+ start.second= log_sys.buf +
+ ((size >= size_left) ? log_sys.START_OFFSET : log_sys.file_size) +
+ (size - size_left);
}
#endif
+ log_sys.resize_write(start.first, start.second, len, size);
+
m_commit_lsn= start.first + len;
return {start.first, log_close(m_commit_lsn)};
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 5f45e7cae3b..704cd85eed1 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -252,22 +252,20 @@ err_exit:
/** Rename the redo log file after resizing.
@return whether an error occurred */
-bool log_t::rename_resized() noexcept
+bool log_t::resize_rename() noexcept
{
- ut_ad(!srv_log_file_created);
- ut_d(srv_log_file_created= true);
-
std::string old_name{get_log_file_path("ib_logfile101")};
std::string new_name{get_log_file_path()};
if (IF_WIN(MoveFileEx(old_name.c_str(), new_name.c_str(),
- MOVEFILE_REPLACE_EXISTING),
+ MOVEFILE_REPLACE_EXISTING),
!rename(old_name.c_str(), new_name.c_str())))
return false;
- sql_print_error("InnoDB: Failed to rename log from %.*s to %.*s",
+ sql_print_error("InnoDB: Failed to rename log from %.*s to %.*s (error %d)",
int(old_name.size()), old_name.data(),
- int(new_name.size()), new_name.data());
+ int(new_name.size()), new_name.data(),
+ IF_WIN(int(GetLastError()), errno));
return true;
}
@@ -1187,7 +1185,10 @@ dberr_t srv_start(bool create_new_db)
buf_flush_sync();
- if (log_sys.rename_resized()) {
+ ut_ad(!srv_log_file_created);
+ ut_d(srv_log_file_created= true);
+
+ if (log_sys.resize_rename()) {
return(srv_init_abort(DB_ERROR));
}
} else {
@@ -1395,7 +1396,7 @@ dberr_t srv_start(bool create_new_db)
err = create_log_file(false, lsn);
- if (err == DB_SUCCESS && log_sys.rename_resized()) {
+ if (err == DB_SUCCESS && log_sys.resize_rename()) {
err = DB_ERROR;
}
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 2239970a4e3..8067d6f6b93 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -600,6 +600,7 @@ static unsigned long // NOLINT(runtime/int)
rocksdb_persistent_cache_size_mb;
static ulong rocksdb_info_log_level;
static char *rocksdb_wal_dir;
+static char *rocksdb_log_dir;
static char *rocksdb_persistent_cache_path;
static ulong rocksdb_index_type;
static uint32_t rocksdb_flush_log_at_trx_commit;
@@ -1316,6 +1317,11 @@ static MYSQL_SYSVAR_STR(wal_dir, rocksdb_wal_dir,
"DBOptions::wal_dir for RocksDB", nullptr, nullptr,
rocksdb_db_options->wal_dir.c_str());
+static MYSQL_SYSVAR_STR(log_dir, rocksdb_log_dir,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
+ "DBOptions::db_log_dir for RocksDB", nullptr, nullptr,
+ rocksdb_db_options->db_log_dir.c_str());
+
static MYSQL_SYSVAR_STR(
persistent_cache_path, rocksdb_persistent_cache_path,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -2041,6 +2047,7 @@ static struct st_mysql_sys_var *rocksdb_system_variables[] = {
MYSQL_SYSVAR(max_total_wal_size),
MYSQL_SYSVAR(use_fsync),
MYSQL_SYSVAR(wal_dir),
+ MYSQL_SYSVAR(log_dir),
MYSQL_SYSVAR(persistent_cache_path),
MYSQL_SYSVAR(persistent_cache_size_mb),
MYSQL_SYSVAR(delete_obsolete_files_period_micros),
@@ -5381,7 +5388,7 @@ static int rocksdb_init_func(void *const p) {
rocksdb::NewGenericRateLimiter(rocksdb_rate_limiter_bytes_per_sec));
rocksdb_db_options->rate_limiter = rocksdb_rate_limiter;
}
-
+ rocksdb_db_options->db_log_dir = rocksdb_log_dir;
rocksdb_db_options->delayed_write_rate = rocksdb_delayed_write_rate;
std::shared_ptr<Rdb_logger> myrocks_logger = std::make_shared<Rdb_logger>();
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/checksum_table.result b/storage/rocksdb/mysql-test/rocksdb/r/checksum_table.result
index bb209856a97..85cf53044e1 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/checksum_table.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/checksum_table.result
@@ -70,6 +70,8 @@ col3 double
# Enable the old algorithm:
set @tmp_old=@@old;
set old=1;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
checksum table t1;
Table Checksum
test.t1 0
@@ -89,4 +91,6 @@ checksum table t1;
Table Checksum
test.t1 3183101003
set old=@tmp_old;
+Warnings:
+Warning 1287 '@@old' is deprecated and will be removed in a future release. Please use '@@old_mode' instead
drop table t1;
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 a3a138555ee..4a1fc17395d 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
@@ -1423,11 +1423,11 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) NOT NULL;
-ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) NOT NULL;
-ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) NOT NULL;
-ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
+ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
#----------------------------------
@@ -1825,7 +1825,7 @@ r1_1 0.9
r1_1 0.9
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) NOT NULL;
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) NOT NULL;
-ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) NOT NULL;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
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 f0d377890c5..d97fb8a2481 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
@@ -1232,11 +1232,11 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) NULL;
-ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) NULL;
-ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) NULL;
-ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
+ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
@@ -1612,7 +1612,7 @@ r1_1 0.9
r1_1 0.9
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) NULL;
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) NULL;
-ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) NULL;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_unsigned.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_unsigned.result
index 13445fc9326..0a8f49ebf36 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_unsigned.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_unsigned.result
@@ -148,11 +148,11 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) UNSIGNED;
-ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) UNSIGNED;
-ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) UNSIGNED;
-ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
+ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
DROP TABLE t1;
CREATE TABLE t1 (
a DECIMAL UNSIGNED,
@@ -499,7 +499,7 @@ r1_1 0.9
r1_1 0.9
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) UNSIGNED;
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) UNSIGNED;
-ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) UNSIGNED;
DROP TABLE t1;
CREATE TABLE t1 (
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
index a23283306b0..989d28e773d 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
@@ -942,6 +942,7 @@ rocksdb_keep_log_file_num 1000
rocksdb_large_prefix OFF
rocksdb_lock_scanned_rows OFF
rocksdb_lock_wait_timeout 1
+rocksdb_log_dir
rocksdb_log_file_time_to_roll 0
rocksdb_manifest_preallocation_size 4194304
rocksdb_manual_compaction_threads 0
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_log_dir.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_log_dir.result
new file mode 100644
index 00000000000..33f2e9f497c
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_log_dir.result
@@ -0,0 +1,8 @@
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(42);
+DROP TABLE t1;
+DROP DATABASE mysqltest;
+Check for MyRocks info LOG files
+db_LOG
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_fixed.result b/storage/rocksdb/mysql-test/rocksdb/r/type_fixed.result
index 055952ea55f..fcbef547891 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_fixed.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_fixed.result
@@ -123,9 +123,9 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) ;
-ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) ;
-ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) ;
-ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
+ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
DROP TABLE t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_float.result b/storage/rocksdb/mysql-test/rocksdb/r/type_float.result
index 371b550d4ab..0cf5c5e0496 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_float.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_float.result
@@ -309,6 +309,6 @@ r1_1 0.9
r1_1 0.9
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) ;
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) ;
-ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
+ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) ;
DROP TABLE t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.opt b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.opt
new file mode 100644
index 00000000000..8e5da2c042c
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.opt
@@ -0,0 +1,2 @@
+--plugin-load=$HA_ROCKSDB_SO --default-storage-engine=rocksdb --rocksdb_log_dir=$MYSQL_TMP_DIR
+
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.test
new file mode 100644
index 00000000000..948e12edb4d
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_log_dir.test
@@ -0,0 +1,15 @@
+--source include/have_rocksdb.inc
+
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(42);
+DROP TABLE t1;
+DROP DATABASE mysqltest;
+
+--echo Check for MyRocks info LOG files
+--replace_regex /.*LOG/db_LOG/
+--list_files $MYSQL_TMP_DIR *LOG
+
+# Clean up
+remove_files_wildcard $MYSQL_TMP_DIR/./ *LOG;
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_log_dir_basic.result b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_log_dir_basic.result
new file mode 100644
index 00000000000..b5caf639850
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_log_dir_basic.result
@@ -0,0 +1,7 @@
+SET @start_global_value = @@global.ROCKSDB_LOG_DIR;
+SELECT @start_global_value;
+@start_global_value
+
+"Trying to set variable @@global.ROCKSDB_LOG_DIR to 444. It should fail because it is readonly."
+SET @@global.ROCKSDB_LOG_DIR = 444;
+ERROR HY000: Variable 'rocksdb_log_dir' is a read only variable
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_log_dir_basic.test b/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_log_dir_basic.test
new file mode 100644
index 00000000000..b8ab9c18e70
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/t/rocksdb_log_dir_basic.test
@@ -0,0 +1,6 @@
+--source include/have_rocksdb.inc
+
+--let $sys_var=ROCKSDB_LOG_DIR
+--let $read_only=1
+--let $session=0
+--source include/rocksdb_sys_var.inc
diff --git a/storage/rocksdb/nosql_access.cc b/storage/rocksdb/nosql_access.cc
index 9dcbe3fbcbc..080977f3722 100644
--- a/storage/rocksdb/nosql_access.cc
+++ b/storage/rocksdb/nosql_access.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
diff --git a/storage/rocksdb/nosql_access.h b/storage/rocksdb/nosql_access.h
index 70aaa400668..c6e75ec01c3 100644
--- a/storage/rocksdb/nosql_access.h
+++ b/storage/rocksdb/nosql_access.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* C++ standard header files */
#include <array>
diff --git a/storage/rocksdb/rdb_converter.cc b/storage/rocksdb/rdb_converter.cc
index 65f0b81cc7f..6f8aa306668 100644
--- a/storage/rocksdb/rdb_converter.cc
+++ b/storage/rocksdb/rdb_converter.cc
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#include <my_global.h>
diff --git a/storage/rocksdb/rdb_converter.h b/storage/rocksdb/rdb_converter.h
index a4eae341f16..6ace89b3366 100644
--- a/storage/rocksdb/rdb_converter.h
+++ b/storage/rocksdb/rdb_converter.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#pragma once
diff --git a/storage/rocksdb/rdb_global.h b/storage/rocksdb/rdb_global.h
index 7213571bf61..c6b7e705587 100644
--- a/storage/rocksdb/rdb_global.h
+++ b/storage/rocksdb/rdb_global.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/* MyRocks global type definitions goes here */
diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt
index bc682e96609..bc1387db236 100644
--- a/storage/spider/CMakeLists.txt
+++ b/storage/spider/CMakeLists.txt
@@ -1,6 +1,3 @@
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_HANDLERSOCKET")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_HANDLERSOCKET")
-
IF(HAVE_WVLA)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla")
@@ -17,36 +14,12 @@ SET(SPIDER_SOURCES
spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc
spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc
spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def
- spd_db_mysql.cc spd_db_oracle.cc spd_group_by_handler.cc spd_db_include.cc
+ spd_db_mysql.cc spd_group_by_handler.cc spd_db_include.cc
)
-IF(DEFINED ENV{ORACLE_HOME})
- SET(ORACLE_HOME $ENV{ORACLE_HOME})
- FIND_PATH(ORACLE_INCLUDE_DIR oci.h PATHS ${ORACLE_HOME}/rdbms/public)
- SET(ORACLE_OCI_LIB_NAME clntsh)
- SET(ORACLE_LIB_DIR ${ORACLE_HOME}/lib)
- FIND_LIBRARY(ORACLE_OCI_LIBRARY NAMES ${ORACLE_OCI_LIB_NAME} PATHS ${ORACLE_LIB_DIR})
-ENDIF()
-
-IF(EXISTS ${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake)
- SET(CMAKE_CXX_FLAGS_DEBUG
- "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi")
- SET(CMAKE_C_FLAGS_DEBUG
- "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi")
- SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /MAP /MAPINFO:EXPORTS")
- INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
-
- INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/sql
- ${CMAKE_SOURCE_DIR}/regex)
-
- MYSQL_STORAGE_ENGINE(SPIDER)
-ELSEIF(PLUGIN_PARTITION MATCHES "^NO$")
+IF(PLUGIN_PARTITION MATCHES "^NO$")
MESSAGE(STATUS "Spider is skipped because partitioning is disabled")
ELSE()
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/spider/hs_client)
-
IF(DEB)
SET(extra_options COMPONENT spider-engine)
ELSE()
@@ -60,16 +33,6 @@ ELSE()
ENDIF()
ENDIF()
-IF(ORACLE_INCLUDE_DIR AND ORACLE_OCI_LIBRARY)
- SET(SPIDER_WITH_ORACLE_OCI OFF CACHE BOOL "Spider is compiled with Oracle OCI library.")
- IF(SPIDER_WITH_ORACLE_OCI)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_ORACLE_OCI -DLINUX -D_GNU_SOURCE -D_REENTRANT")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_ORACLE_OCI -DLINUX -D_GNU_SOURCE -D_REENTRANT")
- INCLUDE_DIRECTORIES(${ORACLE_INCLUDE_DIR})
- TARGET_LINK_LIBRARIES (spider ${ORACLE_OCI_LIBRARY})
- ENDIF()
-ENDIF()
-
IF(MSVC AND (TARGET spider))
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_CUSTOM_COMMAND(TARGET spider
diff --git a/storage/spider/Makefile.am b/storage/spider/Makefile.am
deleted file mode 100644
index 3847b3f2332..00000000000
--- a/storage/spider/Makefile.am
+++ /dev/null
@@ -1,89 +0,0 @@
-HAVE_HANDLERSOCKET = "-DHAVE_HANDLERSOCKET"
-
-pkgplugindir = $(pkglibdir)/plugin
-INCLUDES = -I$(SPD_MYSQL_INC)$(top_srcdir)/include \
- -I$(SPD_MYSQL_INC)$(top_srcdir)/regex \
- -I$(SPD_MYSQL_INC)$(top_srcdir)/sql \
- -I$(SPD_MYSQL_INC)$(top_srcdir)/extra/yassl/include \
- -I./hs_client \
- $(MYSQL_INCLUDE_PATH) \
- $(HANDLERSOCKET_INCLUDE_PATH)
-
-noinst_HEADERS = ha_spider.h spd_conn.h spd_db_conn.h \
- spd_db_include.h spd_err.h spd_sys_table.h \
- spd_table.h spd_trx.h spd_include.h spd_param.h \
- spd_direct_sql.h spd_udf.h spd_ping_table.h \
- spd_copy_tables.h spd_malloc.h \
- spd_db_mysql.h spd_db_handlersocket.h \
- hs_client/allocator.hpp hs_client/config.hpp \
- hs_client/mutex.hpp hs_client/string_util.hpp \
- hs_client/auto_addrinfo.hpp hs_client/escape.hpp \
- hs_client/socket.hpp hs_client/thread.hpp \
- hs_client/auto_file.hpp hs_client/fatal.hpp \
- hs_client/string_buffer.hpp hs_client/util.hpp \
- hs_client/auto_ptrcontainer.hpp \
- hs_client/hstcpcli.hpp hs_client/string_ref.hpp \
- hs_client/hs_compat.h
-
-lib_LTLIBRARIES = $(PLUGIN_SPIDER_LTLIBRARIES_TARGET)
-EXTRA_LTLIBRARIES = ha_spider.la
-pkgplugin_LTLIBRARIES = @plugin_spider_shared_target@
-ha_spider_la_LDFLAGS = -shared -module -rpath $(pkgplugindir)
-ha_spider_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN \
- $(HAVE_HANDLERSOCKET)
-ha_spider_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN \
- $(HAVE_HANDLERSOCKET)
-ha_spider_la_SOURCES = \
- spd_param.cc \
- spd_sys_table.cc \
- spd_trx.cc \
- spd_db_conn.cc \
- spd_conn.cc \
- spd_table.cc \
- spd_direct_sql.cc \
- spd_udf.cc \
- spd_ping_table.cc \
- spd_copy_tables.cc \
- spd_i_s.cc \
- spd_malloc.cc \
- ha_spider.cc \
- spd_db_mysql.cc \
- spd_db_handlersocket.cc \
- hs_client/config.cpp \
- hs_client/escape.cpp \
- hs_client/fatal.cpp \
- hs_client/hstcpcli.cpp \
- hs_client/socket.cpp \
- hs_client/string_util.cpp
-
-lib_LIBRARIES = $(PLUGIN_SPIDER_LIBRARIES_TARGET)
-EXTRA_LIBRARIES = libspider.a
-noinst_LIBRARIES = @plugin_spider_static_target@
-libspider_a_CXXFLAGS = $(AM_CXXFLAGS) $(HAVE_HANDLERSOCKET)
-libspider_a_CFLAGS = $(AM_CFLAGS) $(HAVE_HANDLERSOCKET)
-libspider_a_SOURCES = \
- spd_param.cc \
- spd_sys_table.cc \
- spd_trx.cc \
- spd_db_conn.cc \
- spd_conn.cc \
- spd_table.cc \
- spd_direct_sql.cc \
- spd_udf.cc \
- spd_ping_table.cc \
- spd_copy_tables.cc \
- spd_i_s.cc \
- spd_malloc.cc \
- ha_spider.cc \
- spd_db_mysql.cc \
- spd_db_handlersocket.cc \
- hs_client/config.cpp \
- hs_client/escape.cpp \
- hs_client/fatal.cpp \
- hs_client/hstcpcli.cpp \
- hs_client/socket.cpp \
- hs_client/string_util.cpp
-
-EXTRA_DIST = plug.in
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/storage/spider/configure.in b/storage/spider/configure.in
deleted file mode 100644
index 6f103aed871..00000000000
--- a/storage/spider/configure.in
+++ /dev/null
@@ -1,95 +0,0 @@
-AC_INIT([spider_engine], [1.0], [kentokushiba@gmail.com])
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE
-
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_LIBTOOL
-
-AC_TYPE_SIZE_T
-
-AC_DEFUN([MYSQL_PATH_TEST],[
- AC_MSG_CHECKING([mysql source path])
- AC_ARG_WITH([mysql],
- [AS_HELP_STRING([--with-mysql=PATH],[mysql source directory PATH])],
- [
- if test \
- -f $withval/include/mysql/plugin.h -a \
- -f $withval/include/mysql.h -a \
- -f $withval/include/errmsg.h -a \
- \( -f $withval/sql/mysql_priv.h -o -f $withval/sql/sql_priv.h \) ;
- then
- SPD_MYSQL_INC="$withval/"
- AC_MSG_RESULT([yes])
- plugin_spider_shared_target=""
- AC_SUBST(plugin_spider_shared_target)
- plugin_spider_static_target=""
- AC_SUBST(plugin_spider_static_target)
- PLUGIN_SPIDER_LTLIBRARIES_TARGET="ha_spider.la"
- AC_SUBST(PLUGIN_SPIDER_LTLIBRARIES_TARGET)
- PLUGIN_SPIDER_LIBRARIES_TARGET="libspider.a"
- AC_SUBST(PLUGIN_SPIDER_LIBRARIES_TARGET)
- LIBTOOL="$LIBTOOL --preserve-dup-deps"
- AC_SUBST(LIBTOOL)
- else
- AC_MSG_ERROR([Can't find header files. Please check --with-mysql=PATH option])
- fi
- ],
- [
- if test \
- -f ../../include/mysql/plugin.h -a \
- -f ../../include/mysql.h -a \
- -f ../../include/errmsg.h -a \
- \( -f ../../sql/mysql_priv.h -o ../../sql/sql_priv.h \) ;
- then
- SPD_MYSQL_INC="../../"
- AC_MSG_RESULT([no])
- else
- AC_MSG_ERROR([Can't find header files. Please set --with-mysql=PATH option])
- fi
- ]
- )
-])
-
-MYSQL_PATH_TEST
-AC_SUBST(SPD_MYSQL_INC)
-
-AC_DEFUN([MYSQL_INCLUDE_PATH_TEST],[
- AC_MSG_CHECKING([mysql include path])
- AC_ARG_WITH([mysql-include],
- [AS_HELP_STRING([--with-mysql-include=PATH],[mysql include directory PATH])],
- [
- if test \
- -f $withval/mysql_version.h -a \
- -f $withval/my_config.h ;
- then
- MYSQL_INCLUDE_PATH="-I $withval/"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_ERROR([Can't find "my_config.h". Please check --with-mysql-include=PATH option])
- fi
- ],
- [
- if test \
- -f ../../include/mysql_version.h -a \
- -f ../../include/my_config.h ;
- then
- MYSQL_INCLUDE_PATH="-I ../../include/"
- AC_MSG_RESULT([no])
- else
- AC_MSG_ERROR([Can't find "my_config.h". Please set --with-mysql-include=PATH option])
- fi
- ]
- )
-])
-
-MYSQL_INCLUDE_PATH_TEST
-AC_SUBST(MYSQL_INCLUDE_PATH)
-
-CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
-
-
-AC_CHECK_FUNCS([memset strchr strncasecmp])
-
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index 9504b5a6c26..53f74d5fc0d 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -22,18 +22,11 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "key.h"
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
-#endif
-#endif
#include "ha_partition.h"
#include "spd_param.h"
#include "spd_err.h"
@@ -48,21 +41,13 @@
#include "spd_ping_table.h"
#include "spd_malloc.h"
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
#define SPIDER_CAN_BG_SEARCH (1LL << 37)
#define SPIDER_CAN_BG_INSERT (1LL << 38)
#define SPIDER_CAN_BG_UPDATE (1LL << 39)
-#else
-#define SPIDER_CAN_BG_SEARCH (LL(1) << 37)
-#define SPIDER_CAN_BG_INSERT (LL(1) << 38)
-#define SPIDER_CAN_BG_UPDATE (LL(1) << 39)
-#endif
extern handlerton *spider_hton_ptr;
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
extern HASH spider_open_tables;
-#endif
extern pthread_mutex_t spider_lgtm_tblhnd_share_mutex;
/* UTC time zone for timestamp columns */
@@ -83,13 +68,9 @@ ha_spider::ha_spider(
spider_thread_id = 0;
trx_conn_adjustment = 0;
search_link_query_id = 0;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_handler = NULL;
-#endif
-#ifdef HA_MRR_USE_DEFAULT_IMPL
multi_range_keys = NULL;
mrr_key_buff = NULL;
-#endif
append_tblnm_alias = NULL;
use_index_merge = FALSE;
is_clone = FALSE;
@@ -103,30 +84,13 @@ ha_spider::ha_spider(
sql_kinds = 0;
error_mode = 0;
use_spatial_index = FALSE;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
use_fields = FALSE;
-#endif
dml_inited = FALSE;
use_pre_call = FALSE;
use_pre_action = FALSE;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- is_bulk_access_clone = FALSE;
- synced_from_clone_source = FALSE;
- bulk_access_started = FALSE;
- bulk_access_executing = FALSE;
- bulk_access_pre_called = FALSE;
- bulk_access_link_first = NULL;
-/*
- init_ha_mem_root = FALSE;
-*/
-#endif
prev_index_rnd_init = SPD_NONE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
direct_aggregate_item_first = NULL;
-#endif
result_link_idx = 0;
result_list.have_sql_kind_backup = FALSE;
result_list.sqls = NULL;
@@ -140,10 +104,8 @@ ha_spider::ha_spider(
result_list.set_split_read = FALSE;
result_list.insert_dup_update_pushdown = FALSE;
result_list.tmp_pos_row_first = NULL;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = FALSE;
result_list.snap_direct_aggregate = FALSE;
-#endif
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
@@ -168,13 +130,9 @@ ha_spider::ha_spider(
spider_thread_id = 0;
trx_conn_adjustment = 0;
search_link_query_id = 0;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_handler = NULL;
-#endif
-#ifdef HA_MRR_USE_DEFAULT_IMPL
multi_range_keys = NULL;
mrr_key_buff = NULL;
-#endif
append_tblnm_alias = NULL;
use_index_merge = FALSE;
is_clone = FALSE;
@@ -188,30 +146,13 @@ ha_spider::ha_spider(
sql_kinds = 0;
error_mode = 0;
use_spatial_index = FALSE;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
use_fields = FALSE;
-#endif
dml_inited = FALSE;
use_pre_call = FALSE;
use_pre_action = FALSE;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- is_bulk_access_clone = FALSE;
- synced_from_clone_source = FALSE;
- bulk_access_started = FALSE;
- bulk_access_executing = FALSE;
- bulk_access_pre_called = FALSE;
- bulk_access_link_first = NULL;
-/*
- init_ha_mem_root = FALSE;
-*/
-#endif
prev_index_rnd_init = SPD_NONE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
direct_aggregate_item_first = NULL;
-#endif
result_link_idx = 0;
result_list.have_sql_kind_backup = FALSE;
result_list.sqls = NULL;
@@ -225,10 +166,8 @@ ha_spider::ha_spider(
result_list.set_split_read = FALSE;
result_list.insert_dup_update_pushdown = FALSE;
result_list.tmp_pos_row_first = NULL;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = FALSE;
result_list.snap_direct_aggregate = FALSE;
-#endif
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
@@ -241,9 +180,7 @@ ha_spider::~ha_spider()
{
DBUG_ENTER("ha_spider::~ha_spider");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_handler = NULL;
-#endif
if (wide_handler_owner)
{
spider_free(spider_current_trx, wide_handler, MYF(0));
@@ -297,18 +234,15 @@ int ha_spider::open(
ha_spider *spider, *owner;
bool wide_handler_alloc = FALSE;
SPIDER_WIDE_SHARE *wide_share;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
uint part_num;
bool partition_handler_alloc = FALSE;
ha_spider **wide_handler_handlers = NULL;
ha_partition *clone_source;
-#endif
DBUG_ENTER("ha_spider::open");
DBUG_PRINT("info",("spider this=%p", this));
dup_key_idx = (uint) -1;
conn_kinds = SPIDER_CONN_KIND_MYSQL;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
table->file->get_no_parts("", &part_num);
if (part_num)
{
@@ -322,13 +256,10 @@ int ha_spider::open(
is_clone = TRUE;
}
} else {
-#endif
spider = this;
owner = this;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
clone_source = NULL;
}
-#endif
if (!spider->wide_handler)
{
uchar *searched_bitmap;
@@ -339,7 +270,6 @@ int ha_spider::open(
uchar *rnd_read_bitmap;
uchar *rnd_write_bitmap;
if (!(wide_handler = (SPIDER_WIDE_HANDLER *)
-#ifdef WITH_PARTITION_STORAGE_ENGINE
spider_bulk_malloc(spider_current_trx, 16, MYF(MY_WME | MY_ZEROFILL),
&wide_handler, sizeof(SPIDER_WIDE_HANDLER),
&searched_bitmap,
@@ -359,25 +289,6 @@ int ha_spider::open(
&partition_handler,
(uint) sizeof(SPIDER_PARTITION_HANDLER),
NullS)
-#else
- spider_bulk_malloc(spider_current_trx, 16, MYF(MY_WME | MY_ZEROFILL),
- &wide_handler, sizeof(SPIDER_WIDE_HANDLER),
- &searched_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- &ft_discard_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- &position_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- &idx_read_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- &idx_write_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- &rnd_read_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- &rnd_write_bitmap,
- (uint) sizeof(uchar) * no_bytes_in_map(table->read_set),
- NullS)
-#endif
)
) {
error_num = HA_ERR_OUT_OF_MEM;
@@ -392,9 +303,7 @@ int ha_spider::open(
wide_handler->idx_write_bitmap = idx_write_bitmap;
wide_handler->rnd_read_bitmap = rnd_read_bitmap;
wide_handler->rnd_write_bitmap = rnd_write_bitmap;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
wide_handler->partition_handler = partition_handler;
-#endif
wide_handler->owner = owner;
if (table_share->tmp_table == NO_TMP_TABLE)
wide_handler->top_share = table->s;
@@ -410,7 +319,6 @@ int ha_spider::open(
wide_share = share->wide_share;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
DBUG_PRINT("info",("spider create partition_handler"));
DBUG_PRINT("info",("spider table=%p", table));
partition_handler->table = table;
@@ -435,7 +343,6 @@ int ha_spider::open(
thr_lock_data_init(&wide_share->lock, &wide_handler->lock, NULL);
}
-#endif
init_sql_alloc_size =
spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size);
@@ -496,7 +403,6 @@ int ha_spider::open(
if (is_clone)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_num)
{
for (roop_count = 0; roop_count < (int) part_num; roop_count++)
@@ -509,7 +415,6 @@ int ha_spider::open(
}
}
}
-#endif
wide_handler->external_lock_type =
pt_clone_source_handler->wide_handler->external_lock_type;
@@ -534,9 +439,6 @@ int ha_spider::open(
wide_handler->semi_table_lock = TRUE;
}
}
-#ifdef HA_CAN_BULK_ACCESS
- external_lock_cnt = 0;
-#endif
if (reset())
{
@@ -551,7 +453,6 @@ error_reset:
blob_buff = NULL;
error_init_blob_buff:
error_init_result_list:
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_handler_alloc)
{
wide_share = share->wide_share;
@@ -559,7 +460,6 @@ error_init_result_list:
owner->partition_handler = NULL;
}
partition_handler = NULL;
-#endif
spider_free_share(share);
share = NULL;
if (conn_keys)
@@ -571,12 +471,10 @@ error_get_share:
if (wide_handler_alloc)
{
spider_free(spider_current_trx, wide_handler, MYF(0));
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (wide_handler_handlers)
{
wide_handler_handlers[0]->wide_handler = NULL;
}
-#endif
spider->wide_handler = NULL;
owner->wide_handler = NULL;
owner->wide_handler_owner = FALSE;
@@ -594,7 +492,6 @@ int ha_spider::close()
DBUG_ENTER("ha_spider::close");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_keys)
{
DBUG_PRINT("info",("spider free multi_range_keys=%p", multi_range_keys));
@@ -606,24 +503,6 @@ int ha_spider::close()
delete [] mrr_key_buff;
mrr_key_buff = NULL;
}
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- if (bulk_access_link_first)
- {
- do {
- DBUG_PRINT("info",("spider bulk_access_link->spider=%p",
- bulk_access_link_first->spider));
- DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
- bulk_access_link_first->spider->dbton_handler));
- DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler="
- "%p", &bulk_access_link_first->spider->dbton_handler));
- bulk_access_link_current = bulk_access_link_first->next;
- delete_bulk_access_link(bulk_access_link_first);
- bulk_access_link_first = bulk_access_link_current;
- } while (bulk_access_link_first);
- }
-#endif
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
while (direct_aggregate_item_first)
{
direct_aggregate_item_current = direct_aggregate_item_first->next;
@@ -634,7 +513,6 @@ int ha_spider::close()
spider_free(spider_current_trx, direct_aggregate_item_first, MYF(0));
direct_aggregate_item_first = direct_aggregate_item_current;
}
-#endif
if (is_clone)
{
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
@@ -678,9 +556,7 @@ int ha_spider::close()
spider_free(spider_current_trx, conn_keys, MYF(0));
conn_keys = NULL;
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_handler = NULL;
-#endif
if (wide_handler_owner)
{
spider_free(spider_current_trx, wide_handler, MYF(0));
@@ -777,52 +653,10 @@ void ha_spider::check_access_kind(
wide_handler->sql_command = thd_sql_command(thd);
DBUG_PRINT("info",("spider sql_command=%u", wide_handler->sql_command));
DBUG_PRINT("info",("spider thd->query_id=%lld", thd->query_id));
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
wide_handler->update_request = FALSE;
-#else
- if (
- wide_handler->sql_command == SQLCOM_UPDATE ||
- wide_handler->sql_command == SQLCOM_UPDATE_MULTI ||
- /* for triggers */
- wide_handler->sql_command == SQLCOM_INSERT ||
- wide_handler->sql_command == SQLCOM_INSERT_SELECT ||
- wide_handler->sql_command == SQLCOM_DELETE ||
- wide_handler->sql_command == SQLCOM_DELETE_MULTI
- )
- wide_handler->update_request = TRUE;
- else
- wide_handler->update_request = FALSE;
-#endif
DBUG_VOID_RETURN;
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::additional_lock(
- THD *thd,
- enum thr_lock_type lock_type
-) {
- DBUG_ENTER("ha_spider::additional_lock");
- DBUG_PRINT("info",("spider this=%p", this));
- if (bulk_access_executing)
- {
- if (is_bulk_access_clone)
- {
- check_access_kind(thd);
- DBUG_RETURN(check_access_kind_for_connection(thd,
- (lock_type >= TL_WRITE_ALLOW_WRITE)));
- } else if (bulk_access_link_exec_tgt->called)
- {
- bulk_access_link_exec_tgt->spider->check_access_kind(thd);
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->
- check_access_kind_for_connection(
- thd, (lock_type >= TL_WRITE_ALLOW_WRITE)));
- }
- }
- check_access_kind(thd);
- DBUG_RETURN(check_access_kind_for_connection(thd,
- (lock_type >= TL_WRITE_ALLOW_WRITE)));
-}
-#endif
THR_LOCK_DATA **ha_spider::store_lock(
THD *thd,
@@ -831,7 +665,6 @@ THR_LOCK_DATA **ha_spider::store_lock(
) {
DBUG_ENTER("ha_spider::store_lock");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_STORE_LOCK &&
wide_handler->stage_executor != this)
@@ -840,7 +673,6 @@ THR_LOCK_DATA **ha_spider::store_lock(
}
wide_handler->stage = SPD_HND_STAGE_STORE_LOCK;
wide_handler->stage_executor = this;
-#endif
wide_handler->lock_table_type = 0;
if (lock_type == TL_IGNORE)
{
@@ -941,7 +773,6 @@ THR_LOCK_DATA **ha_spider::store_lock(
!spider_param_local_lock_table(thd)
) {
wide_handler->lock_table_type = 1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_handler && partition_handler->handlers)
{
uint roop_count;
@@ -956,11 +787,8 @@ THR_LOCK_DATA **ha_spider::store_lock(
}
}
} else {
-#endif
store_error_num = append_lock_tables_list();
-#ifdef WITH_PARTITION_STORAGE_ENGINE
}
-#endif
}
} else {
DBUG_PRINT("info",("spider default lock route"));
@@ -976,7 +804,6 @@ THR_LOCK_DATA **ha_spider::store_lock(
spider_param_semi_table_lock(thd, wide_handler->semi_table_lock)
) {
wide_handler->lock_table_type = 2;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_handler && partition_handler->handlers)
{
uint roop_count;
@@ -992,11 +819,8 @@ THR_LOCK_DATA **ha_spider::store_lock(
}
}
} else {
-#endif
store_error_num = append_lock_tables_list();
-#ifdef WITH_PARTITION_STORAGE_ENGINE
}
-#endif
}
}
if (
@@ -1128,7 +952,6 @@ int ha_spider::start_stmt(
thr_lock_type lock_type
) {
DBUG_ENTER("ha_spider::start_stmt");
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_START_STMT &&
wide_handler->stage_executor != this)
@@ -1137,7 +960,6 @@ int ha_spider::start_stmt(
}
wide_handler->stage = SPD_HND_STAGE_START_STMT;
wide_handler->stage_executor = this;
-#endif
DBUG_RETURN(0);
}
@@ -1153,41 +975,6 @@ int ha_spider::reset()
backup_error_status();
DBUG_ENTER("ha_spider::reset");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- SPIDER_BULK_ACCESS_LINK *tmp_bulk_access_link = bulk_access_link_first;
- while (tmp_bulk_access_link)
- {
- DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
- tmp_bulk_access_link->spider->dbton_handler));
- DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p",
- &tmp_bulk_access_link->spider->dbton_handler));
- if (!tmp_bulk_access_link->used)
- break;
- if ((error_num2 = tmp_bulk_access_link->spider->ha_reset()))
- error_num = error_num2;
- tmp_bulk_access_link->used = FALSE;
- tmp_bulk_access_link = tmp_bulk_access_link->next;
- }
- synced_from_clone_source = FALSE;
- bulk_access_started = FALSE;
- bulk_access_executing = FALSE;
- bulk_access_pre_called = FALSE;
- if (
- bulk_access_link_first &&
- !spider_param_bulk_access_free(share->bulk_access_free)
- ) {
- do {
- DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
- bulk_access_link_first->spider->dbton_handler));
- DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p",
- &bulk_access_link_first->spider->dbton_handler));
- bulk_access_link_current = bulk_access_link_first->next;
- delete_bulk_access_link(bulk_access_link_first);
- bulk_access_link_first = bulk_access_link_current;
- } while (bulk_access_link_first);
- }
-#endif
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
direct_aggregate_item_current = direct_aggregate_item_first;
while (direct_aggregate_item_current)
{
@@ -1207,7 +994,6 @@ int ha_spider::reset()
}
result_list.direct_aggregate = FALSE;
result_list.snap_direct_aggregate = FALSE;
-#endif
result_list.direct_distinct = FALSE;
store_error_num = 0;
if (wide_handler)
@@ -1240,16 +1026,12 @@ int ha_spider::reset()
wide_handler->condition = tmp_cond;
}
wide_handler->cond_check = FALSE;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
wide_handler->direct_update_fields = NULL;
-#endif
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
wide_handler->info_limit = 9223372036854775807LL;
#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
wide_handler->stage = SPD_HND_STAGE_NONE;
wide_handler->stage_executor = NULL;
-#endif
}
if (!(tmp_trx = spider_get_trx(thd, TRUE, &error_num2)))
{
@@ -1306,23 +1088,19 @@ int ha_spider::reset()
conn_kinds = SPIDER_CONN_KIND_MYSQL;
use_index_merge = FALSE;
init_rnd_handler = FALSE;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_keys)
{
DBUG_PRINT("info",("spider free multi_range_keys=%p", multi_range_keys));
spider_free(spider_current_trx, multi_range_keys, MYF(0));
multi_range_keys = NULL;
}
-#endif
multi_range_num = 0;
ft_handler = NULL;
ft_current = NULL;
ft_count = 0;
ft_init_without_index_init = FALSE;
sql_kinds = 0;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
prev_index_rnd_init = SPD_NONE;
result_list.have_sql_kind_backup = FALSE;
result_list.direct_order_limit = FALSE;
@@ -1330,21 +1108,8 @@ int ha_spider::reset()
result_list.set_split_read = FALSE;
result_list.insert_dup_update_pushdown = FALSE;
use_spatial_index = FALSE;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
use_fields = FALSE;
-#endif
error_mode = 0;
-#ifdef HA_CAN_BULK_ACCESS
-#ifndef DBUG_OFF
- if (bulk_access_link_first)
- {
- DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
- bulk_access_link_first->spider->dbton_handler));
- DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p",
- &bulk_access_link_first->spider->dbton_handler));
- }
-#endif
-#endif
DBUG_RETURN(error_num);
}
@@ -1355,7 +1120,6 @@ int ha_spider::extra(
DBUG_ENTER("ha_spider::extra");
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider operation=%d", (int) operation));
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_EXTRA &&
wide_handler->stage_executor != this)
@@ -1364,7 +1128,6 @@ int ha_spider::extra(
}
wide_handler->stage = SPD_HND_STAGE_EXTRA;
wide_handler->stage_executor = this;
-#endif
switch (operation)
{
case HA_EXTRA_QUICK:
@@ -1374,13 +1137,11 @@ int ha_spider::extra(
if (!is_clone)
{
wide_handler->keyread = TRUE;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (wide_handler->update_request)
{
if (check_partitioned())
wide_handler->keyread = FALSE;
}
-#endif
}
break;
case HA_EXTRA_NO_KEYREAD:
@@ -1398,24 +1159,19 @@ int ha_spider::extra(
case HA_EXTRA_WRITE_CANNOT_REPLACE:
wide_handler->write_can_replace = FALSE;
break;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
case HA_EXTRA_INSERT_WITH_UPDATE:
wide_handler->insert_with_update = TRUE;
break;
-#endif
case HA_EXTRA_ATTACH_CHILDREN:
DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN"));
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
DBUG_RETURN(error_num);
break;
-#if MYSQL_VERSION_ID < 50500
-#else
case HA_EXTRA_ADD_CHILDREN_LIST:
DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST"));
if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
DBUG_RETURN(error_num);
break;
-#endif
#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF)
#ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
@@ -1465,19 +1221,6 @@ int ha_spider::index_init(
DBUG_ENTER("ha_spider::index_init");
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider idx=%u", idx));
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_ASSERT(!bulk_access_started);
- if (bulk_access_executing)
- {
- if (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_index_init(
- idx, sorted));
- }
- }
-#endif
if (!dml_inited)
{
if (unlikely((error_num = dml_init())))
@@ -1526,16 +1269,6 @@ int ha_spider::index_init(
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::pre_index_init(
- uint idx,
- bool sorted
-) {
- DBUG_ENTER("ha_spider::pre_index_init");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_index_init(idx, sorted));
-}
-#endif
int ha_spider::index_end()
{
@@ -1543,21 +1276,6 @@ int ha_spider::index_end()
backup_error_status();
DBUG_ENTER("ha_spider::index_end");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_ASSERT(!bulk_access_started);
- if (bulk_access_executing)
- {
- if (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- error_num = bulk_access_link_exec_tgt->spider->ha_index_end();
- if (error_num)
- DBUG_RETURN(check_error_mode(error_num));
- DBUG_RETURN(0);
- }
- }
-#endif
active_index = MAX_KEY;
/*
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
@@ -1577,14 +1295,6 @@ int ha_spider::index_end()
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::pre_index_end()
-{
- DBUG_ENTER("ha_spider::pre_index_end");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_index_end());
-}
-#endif
int ha_spider::index_read_map_internal(
uchar *buf,
@@ -1603,9 +1313,7 @@ int ha_spider::index_read_map_internal(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if (
find_flag >= HA_READ_MBR_CONTAIN &&
find_flag <= HA_READ_MBR_EQUAL
@@ -1629,13 +1337,9 @@ int ha_spider::index_read_map_internal(
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -1739,7 +1443,6 @@ int ha_spider::index_read_map_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -1774,7 +1477,6 @@ int ha_spider::index_read_map_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -1805,18 +1507,6 @@ int ha_spider::index_read_map_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (
- is_bulk_access_clone &&
- !bulk_access_executing &&
- conn_kind[roop_count] != SPIDER_CONN_KIND_MYSQL
- ) {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -1929,12 +1619,7 @@ int ha_spider::index_read_map_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
if (buf && (error_num = spider_db_fetch(buf, this, table)))
DBUG_RETURN(check_error_mode_eof(error_num));
@@ -1947,42 +1632,13 @@ int ha_spider::pre_index_read_map(
enum ha_rkey_function find_flag,
bool use_parallel
) {
-#ifdef HA_CAN_BULK_ACCESS
- int error_num;
-#endif
DBUG_ENTER("ha_spider::pre_index_read_map");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- if (bulk_access_started)
- {
- error_num = bulk_access_link_current->spider->pre_index_read_map(key,
- keypart_map, find_flag, TRUE);
- bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
- bulk_access_link_current->called = TRUE;
- DBUG_RETURN(error_num);
- } else if (
- bulk_access_executing && !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->pre_index_read_map(key,
- keypart_map, find_flag, TRUE));
- }
-#endif
check_pre_call(use_parallel);
if (use_pre_call)
{
store_error_num =
index_read_map_internal(NULL, key, keypart_map, find_flag);
-#ifdef HA_CAN_BULK_ACCESS
- if (
- !store_error_num &&
- bulk_access_executing &&
- is_bulk_access_clone &&
- !bulk_access_pre_called
- ) {
- bulk_req_exec();
- }
-#endif
DBUG_RETURN(store_error_num);
}
DBUG_RETURN(0);
@@ -1997,59 +1653,6 @@ int ha_spider::index_read_map(
int error_num;
DBUG_ENTER("ha_spider::index_read_map");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_ASSERT(!bulk_access_started);
- if (bulk_access_executing)
- {
- if (is_bulk_access_clone)
- {
- if (bulk_access_pre_called)
- {
- SPIDER_CONN *conn;
- int roop_count, roop_start, roop_end, tmp_lock_mode, link_ok,
- tmp_error_num;
- tmp_lock_mode = spider_conn_lock_mode(this);
- if (tmp_lock_mode)
- {
- /* "for update" or "lock in share mode" */
- link_ok = spider_conn_link_idx_next(share->link_statuses,
- conn_link_idx, -1, share->link_count,
- SPIDER_LINK_STATUS_OK);
- roop_start = spider_conn_link_idx_next(share->link_statuses,
- conn_link_idx, -1, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY);
- roop_end = share->link_count;
- } else {
- link_ok = search_link_idx;
- roop_start = search_link_idx;
- roop_end = search_link_idx + 1;
- }
- for (roop_count = roop_start; roop_count < roop_end;
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- conn_link_idx, roop_count, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY)
- ) {
- conn = conns[roop_count];
- if ((tmp_error_num = spider_db_bulk_store_result(this, conn,
- roop_count, (roop_count != link_ok))))
- {
- store_error_num = tmp_error_num;
- } else {
- result_link_idx = link_ok;
- }
- }
- use_pre_call = TRUE;
- bulk_access_pre_called = FALSE;
- } else {
- /* do access normally */
- }
- } else if (bulk_access_link_exec_tgt->called)
- {
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->index_read_map(buf, key,
- keypart_map, find_flag));
- }
- }
-#endif
if (use_pre_call)
{
if (store_error_num)
@@ -2088,9 +1691,7 @@ int ha_spider::index_read_last_map_internal(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if ((error_num = index_handler_init()))
DBUG_RETURN(check_error_mode_eof(error_num));
if (is_clone)
@@ -2116,13 +1717,9 @@ int ha_spider::index_read_last_map_internal(
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -2214,7 +1811,6 @@ int ha_spider::index_read_last_map_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -2249,7 +1845,6 @@ int ha_spider::index_read_last_map_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -2280,15 +1875,6 @@ int ha_spider::index_read_last_map_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -2401,12 +1987,7 @@ int ha_spider::index_read_last_map_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
if (buf && (error_num = spider_db_fetch(buf, this, table)))
DBUG_RETURN(check_error_mode_eof(error_num));
@@ -2466,21 +2047,6 @@ int ha_spider::index_next(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_ASSERT(!bulk_access_started);
- if (bulk_access_executing)
- {
- if (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- error_num = bulk_access_link_exec_tgt->spider->index_next(buf);
- if (error_num)
- DBUG_RETURN(check_error_mode(error_num));
- DBUG_RETURN(0);
- }
- }
-#endif
if (is_clone)
{
DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p",
@@ -2512,21 +2078,6 @@ int ha_spider::index_prev(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_ASSERT(!bulk_access_started);
- if (bulk_access_executing)
- {
- if (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- error_num = bulk_access_link_exec_tgt->spider->index_prev(buf);
- if (error_num)
- DBUG_RETURN(check_error_mode(error_num));
- DBUG_RETURN(0);
- }
- }
-#endif
if (is_clone)
{
DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p",
@@ -2559,9 +2110,7 @@ int ha_spider::index_first_internal(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if ((error_num = index_handler_init()))
DBUG_RETURN(check_error_mode_eof(error_num));
if (is_clone)
@@ -2584,13 +2133,9 @@ int ha_spider::index_first_internal(
DBUG_RETURN(error_num);
check_direct_order_limit();
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -2683,7 +2228,6 @@ int ha_spider::index_first_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -2718,7 +2262,6 @@ int ha_spider::index_first_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -2750,15 +2293,6 @@ int ha_spider::index_first_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -2871,12 +2405,7 @@ int ha_spider::index_first_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
}
@@ -2946,9 +2475,7 @@ int ha_spider::index_last_internal(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if ((error_num = index_handler_init()))
DBUG_RETURN(check_error_mode_eof(error_num));
if (is_clone)
@@ -2971,13 +2498,9 @@ int ha_spider::index_last_internal(
DBUG_RETURN(error_num);
check_direct_order_limit();
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -3070,7 +2593,6 @@ int ha_spider::index_last_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -3105,7 +2627,6 @@ int ha_spider::index_last_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -3137,15 +2658,6 @@ int ha_spider::index_last_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -3258,12 +2770,7 @@ int ha_spider::index_last_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
}
@@ -3334,22 +2841,6 @@ int ha_spider::index_next_same(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_ASSERT(!bulk_access_started);
- if (bulk_access_executing)
- {
- if (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- error_num = bulk_access_link_exec_tgt->spider->index_next_same(buf, key,
- keylen);
- if (error_num)
- DBUG_RETURN(check_error_mode(error_num));
- DBUG_RETURN(0);
- }
- }
-#endif
if (is_clone)
{
DBUG_PRINT("info",("spider set pt_clone_last_searcher to %p",
@@ -3386,9 +2877,7 @@ int ha_spider::read_range_first_internal(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if (
start_key &&
start_key->flag >= HA_READ_MBR_CONTAIN &&
@@ -3417,13 +2906,9 @@ int ha_spider::read_range_first_internal(
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -3516,7 +3001,6 @@ int ha_spider::read_range_first_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -3551,7 +3035,6 @@ int ha_spider::read_range_first_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -3582,15 +3065,6 @@ int ha_spider::read_range_first_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -3703,12 +3177,7 @@ int ha_spider::read_range_first_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
if (buf && (error_num = spider_db_fetch(buf, this, table)))
DBUG_RETURN(check_error_mode_eof(error_num));
@@ -3821,8 +3290,6 @@ bool ha_spider::check_no_where_cond()
DBUG_RETURN(FALSE);
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
ha_rows ha_spider::multi_range_read_info_const(
uint keyno,
RANGE_SEQ_IF *seq,
@@ -3832,17 +3299,6 @@ ha_rows ha_spider::multi_range_read_info_const(
uint *flags,
Cost_estimate *cost
)
-#else
-ha_rows ha_spider::multi_range_read_info_const(
- uint keyno,
- RANGE_SEQ_IF *seq,
- void *seq_init_param,
- uint n_ranges,
- uint *bufsz,
- uint *flags,
- COST_VECT *cost
-)
-#endif
{
DBUG_ENTER("ha_spider::multi_range_read_info_const");
DBUG_PRINT("info",("spider this=%p", this));
@@ -3887,7 +3343,6 @@ ha_rows ha_spider::multi_range_read_info_const(
DBUG_RETURN(rows);
}
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
ha_rows ha_spider::multi_range_read_info(
uint keyno,
uint n_ranges,
@@ -3897,17 +3352,6 @@ ha_rows ha_spider::multi_range_read_info(
uint *flags,
Cost_estimate *cost
)
-#else
-ha_rows ha_spider::multi_range_read_info(
- uint keyno,
- uint n_ranges,
- uint keys,
- uint key_parts,
- uint *bufsz,
- uint *flags,
- COST_VECT *cost
-)
-#endif
{
DBUG_ENTER("ha_spider::multi_range_read_info");
DBUG_PRINT("info",("spider this=%p", this));
@@ -3977,49 +3421,23 @@ int ha_spider::multi_range_read_init(
)
);
}
-#endif
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int ha_spider::multi_range_read_next_first(
range_id_t *range_info
)
-#else
-int ha_spider::multi_range_read_next_first(
- char **range_info
-)
-#endif
-#else
-int ha_spider::read_multi_range_first_internal(
- uchar *buf,
- KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- HANDLER_BUFFER *buffer
-)
-#endif
{
int error_num, roop_count;
SPIDER_CONN *conn;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
int range_res;
backup_error_status();
DBUG_ENTER("ha_spider::multi_range_read_next_first");
-#else
- bka_mode = spider_param_bka_mode(wide_handler->trx->thd, share->bka_mode);
- backup_error_status();
- DBUG_ENTER("ha_spider::read_multi_range_first_internal");
-#endif
DBUG_PRINT("info",("spider this=%p", this));
if (wide_handler->trx->thd->killed)
{
my_error(ER_QUERY_INTERRUPTED, MYF(0));
DBUG_RETURN(ER_QUERY_INTERRUPTED);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if ((error_num = index_handler_init()))
DBUG_RETURN(check_error_mode_eof(error_num));
if (is_clone)
@@ -4028,21 +3446,12 @@ int ha_spider::read_multi_range_first_internal(
pt_clone_source_handler));
pt_clone_source_handler->pt_clone_last_searcher = this;
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#else
- multi_range_sorted = sorted;
- multi_range_buffer = buffer;
-#endif
spider_db_free_one_result_for_start_next(this);
check_direct_order_limit();
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -4050,16 +3459,10 @@ int ha_spider::read_multi_range_first_internal(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
result_list.desc_flg = FALSE;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
result_list.sorted = mrr_is_output_sorted;
-#else
- result_list.sorted = sorted;
-#endif
result_list.key_info = &table->key_info[active_index];
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
multi_range_num == 1 ||
-#endif
result_list.multi_split_read <= 1 ||
(sql_kinds & SPIDER_SQL_KIND_HANDLER)
) {
@@ -4080,21 +3483,10 @@ int ha_spider::read_multi_range_first_internal(
)
DBUG_RETURN(error_num);
set_where_pos_sql(SPIDER_SQL_TYPE_SELECT_SQL);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
error_num = HA_ERR_END_OF_FILE;
while (!(range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range)))
-#else
- for (
- multi_range_curr = ranges,
- multi_range_end = ranges + range_count;
- multi_range_curr < multi_range_end;
- multi_range_curr++
- )
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res1=%d", range_res));
-#endif
result_list.limit_num =
result_list.internal_limit - result_list.record_num >=
result_list.split_read ?
@@ -4102,17 +3494,10 @@ int ha_spider::read_multi_range_first_internal(
result_list.internal_limit - result_list.record_num;
DBUG_PRINT("info",("spider limit_num=%lld", result_list.limit_num));
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
(error_num = spider_db_append_key_where(
&mrr_cur_range.start_key,
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
NULL : &mrr_cur_range.end_key, this))
-#else
- (error_num = spider_db_append_key_where(
- &multi_range_curr->start_key,
- SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
- NULL : &multi_range_curr->end_key, this))
-#endif
)
DBUG_RETURN(error_num);
if (sql_kinds & SPIDER_SQL_KIND_SQL)
@@ -4175,7 +3560,6 @@ int ha_spider::read_multi_range_first_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -4208,7 +3592,6 @@ int ha_spider::read_multi_range_first_internal(
);
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -4240,21 +3623,6 @@ int ha_spider::read_multi_range_first_internal(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
- *range_info = (char *) mrr_cur_range.ptr;
-#else
- *found_range_p = multi_range_curr;
-#endif
- DBUG_RETURN(0);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -4369,12 +3737,7 @@ int ha_spider::read_multi_range_first_internal(
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
if (error_num)
break;
}
@@ -4401,19 +3764,11 @@ int ha_spider::read_multi_range_first_internal(
result_list.current = result_list.current->prev;
}
} else {
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (!range_info)
DBUG_RETURN(0);
if (!(error_num = spider_db_fetch(table->record[0], this, table)))
-#else
- if (!buf || !(error_num = spider_db_fetch(buf, this, table)))
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
*range_info = (char *) mrr_cur_range.ptr;
-#else
- *found_range_p = multi_range_curr;
-#endif
DBUG_RETURN(check_ha_range_eof());
}
if (
@@ -4444,21 +3799,17 @@ int ha_spider::read_multi_range_first_internal(
set_where_to_pos_sql(SPIDER_SQL_TYPE_SELECT_SQL);
set_where_to_pos_sql(SPIDER_SQL_TYPE_HANDLER);
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res2=%d", range_res));
-#endif
if (error_num)
DBUG_RETURN(check_error_mode_eof(error_num));
} else {
bool tmp_high_priority = wide_handler->high_priority;
bool have_multi_range;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
const uchar *first_mrr_start_key;
const uchar *first_mrr_end_key;
uint first_mrr_start_key_length;
uint first_mrr_end_key_length;
have_second_range = FALSE;
-#endif
if (wide_handler->keyread)
result_list.keyread = TRUE;
else
@@ -4466,25 +3817,16 @@ int ha_spider::read_multi_range_first_internal(
mrr_with_cnt = TRUE;
multi_range_cnt = 0;
multi_range_hit_point = 0;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_keys)
{
DBUG_PRINT("info",("spider free multi_range_keys=%p", multi_range_keys));
spider_free(spider_current_trx, multi_range_keys, MYF(0));
}
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
if (!(multi_range_keys = (range_id_t *)
spider_malloc(spider_current_trx, 1, sizeof(range_id_t) *
(multi_range_num < result_list.multi_split_read ?
multi_range_num : result_list.multi_split_read), MYF(MY_WME)))
)
-#else
- if (!(multi_range_keys = (char **)
- spider_malloc(spider_current_trx, 1, sizeof(char *) *
- (multi_range_num < result_list.multi_split_read ?
- multi_range_num : result_list.multi_split_read), MYF(MY_WME)))
- )
-#endif
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
DBUG_PRINT("info",("spider alloc multi_range_keys=%p", multi_range_keys));
if (!mrr_key_buff)
@@ -4496,11 +3838,7 @@ int ha_spider::read_multi_range_first_internal(
for (roop_count = 0; roop_count < 2; roop_count++)
mrr_key_buff[roop_count].init_calc_mem(235);
}
-#else
- multi_range_ranges = ranges;
-#endif
error_num = 0;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if ((range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range)))
{
DBUG_PRINT("info",("spider range_res3=%d", range_res));
@@ -4537,64 +3875,36 @@ int ha_spider::read_multi_range_first_internal(
first_mrr_end_key_length);
mrr_cur_range.end_key.key = (const uchar *) mrr_key_buff[1].ptr();
}
-#else
- multi_range_curr = ranges;
- multi_range_end = ranges + range_count;
-#endif
result_list.tmp_table_join = FALSE;
memset(result_list.tmp_table_join_first, 0, share->link_bitmap_size);
do
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if ((range_res = mrr_funcs.next(mrr_iter, &mrr_second_range)))
-#else
- if (multi_range_curr + 1 >= multi_range_end)
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
have_second_range = FALSE;
-#endif
have_multi_range = FALSE;
} else {
-#ifdef HA_MRR_USE_DEFAULT_IMPL
have_second_range = TRUE;
-#endif
have_multi_range = TRUE;
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res5=%d", range_res));
-#endif
result_list.tmp_reuse_sql = FALSE;
if (bka_mode &&
have_multi_range &&
-#ifdef HA_MRR_USE_DEFAULT_IMPL
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE)
-#else
- SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE)
-#endif
) {
if (
result_list.tmp_table_join &&
-#ifdef HA_MRR_USE_DEFAULT_IMPL
result_list.tmp_table_join_key_part_map ==
mrr_cur_range.start_key.keypart_map
-#else
- result_list.tmp_table_join_key_part_map ==
- multi_range_curr->start_key.keypart_map
-#endif
) {
/* reuse tmp_sql */
result_list.tmp_reuse_sql = TRUE;
} else {
/* create tmp_sql */
result_list.tmp_table_join = TRUE;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
result_list.tmp_table_join_key_part_map =
mrr_cur_range.start_key.keypart_map;
-#else
- result_list.tmp_table_join_key_part_map =
- multi_range_curr->start_key.keypart_map;
-#endif
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL)))
DBUG_RETURN(error_num);
@@ -4639,11 +3949,7 @@ int ha_spider::read_multi_range_first_internal(
if (!result_list.tmp_reuse_sql)
{
if ((error_num = append_union_table_and_sql_for_bka(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key
-#else
- &multi_range_curr->start_key
-#endif
))) {
DBUG_RETURN(error_num);
}
@@ -4657,11 +3963,7 @@ int ha_spider::read_multi_range_first_internal(
if (!result_list.tmp_reuse_sql)
{
if ((error_num = append_tmp_table_and_sql_for_bka(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key
-#else
- &multi_range_curr->start_key
-#endif
))) {
DBUG_RETURN(error_num);
}
@@ -4673,38 +3975,18 @@ int ha_spider::read_multi_range_first_internal(
}
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
do
-#else
- for (
- ;
- multi_range_curr < multi_range_end;
- multi_range_curr++
- )
-#endif
{
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
!SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ||
result_list.tmp_table_join_key_part_map !=
mrr_cur_range.start_key.keypart_map
-#else
- !SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ||
- result_list.tmp_table_join_key_part_map !=
- multi_range_curr->start_key.keypart_map
-#endif
) {
result_list.tmp_table_join_break_after_get_next = TRUE;
break;
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
-#else
- multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
-#endif
-#endif
if (bka_mode == 2)
{
if ((error_num = spider_db_append_select(this)))
@@ -4715,11 +3997,7 @@ int ha_spider::read_multi_range_first_internal(
SPIDER_SQL_TYPE_SELECT_SQL, multi_range_cnt)))
DBUG_RETURN(error_num);
if ((error_num = append_key_column_values_with_name_sql_part(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key,
-#else
- &multi_range_curr->start_key,
-#endif
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
} else {
@@ -4727,11 +4005,7 @@ int ha_spider::read_multi_range_first_internal(
SPIDER_SQL_TYPE_SELECT_SQL, multi_range_cnt, TRUE)))
DBUG_RETURN(error_num);
if ((error_num = append_key_column_values_sql_part(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key,
-#else
- &multi_range_curr->start_key,
-#endif
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
@@ -4743,11 +4017,7 @@ int ha_spider::read_multi_range_first_internal(
SPIDER_SQL_TYPE_TMP_SQL, multi_range_cnt, TRUE)))
DBUG_RETURN(error_num);
if ((error_num = append_key_column_values_sql_part(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key,
-#else
- &multi_range_curr->start_key,
-#endif
SPIDER_SQL_TYPE_TMP_SQL)))
DBUG_RETURN(error_num);
if ((error_num =
@@ -4758,7 +4028,6 @@ int ha_spider::read_multi_range_first_internal(
multi_range_cnt++;
if (multi_range_cnt >= (uint) result_list.multi_split_read)
break;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_cnt == 1)
{
if (have_multi_range)
@@ -4774,11 +4043,8 @@ int ha_spider::read_multi_range_first_internal(
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res6=%d", range_res));
}
-#endif
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
while (!range_res);
-#endif
if (bka_mode == 2)
{
if ((error_num = append_union_table_terminator_sql_part(
@@ -4814,24 +4080,10 @@ int ha_spider::read_multi_range_first_internal(
)
DBUG_RETURN(error_num);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
do
-#else
- for (
- ;
- multi_range_curr < multi_range_end;
- multi_range_curr++
- )
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res7=%d", range_res));
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
-#else
- multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
-#endif
-#endif
if ((error_num = spider_db_append_select(this)))
DBUG_RETURN(error_num);
if ((error_num = append_multi_range_cnt_sql_part(
@@ -4854,17 +4106,10 @@ int ha_spider::read_multi_range_first_internal(
result_list.internal_offset));
DBUG_PRINT("info",("spider limit_num=%lld", result_list.limit_num));
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
(error_num = spider_db_append_key_where(
&mrr_cur_range.start_key,
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
NULL : &mrr_cur_range.end_key, this))
-#else
- (error_num = spider_db_append_key_where(
- &multi_range_curr->start_key,
- SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
- NULL : &multi_range_curr->end_key, this))
-#endif
)
DBUG_RETURN(error_num);
if (result_list.direct_order_limit)
@@ -4896,7 +4141,6 @@ int ha_spider::read_multi_range_first_internal(
multi_range_cnt++;
if (multi_range_cnt >= (uint) result_list.multi_split_read)
break;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_cnt == 1)
{
if (have_multi_range)
@@ -4912,30 +4156,21 @@ int ha_spider::read_multi_range_first_internal(
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res8=%d", range_res));
}
-#endif
if (check_no_where_cond())
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = 1;
-#else
- multi_range_curr = multi_range_end;
-#endif
break;
}
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
while (!range_res);
-#endif
wide_handler->high_priority = tmp_high_priority;
if ((error_num = append_union_all_end_sql_part(
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
result_list.use_union = TRUE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate_backup = result_list.direct_aggregate;
result_list.direct_aggregate = FALSE;
-#endif
if (result_list.direct_order_limit)
{
if ((error_num =
@@ -4947,9 +4182,7 @@ int ha_spider::read_multi_range_first_internal(
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = direct_aggregate_backup;
-#endif
if ((error_num = append_limit_sql_part(
result_list.internal_offset,
result_list.limit_num,
@@ -4982,7 +4215,6 @@ int ha_spider::read_multi_range_first_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -5017,7 +4249,6 @@ int ha_spider::read_multi_range_first_internal(
break;
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -5050,21 +4281,6 @@ int ha_spider::read_multi_range_first_internal(
}
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
- *range_info = multi_range_keys[multi_range_hit_point];
-#else
- *found_range_p = &multi_range_ranges[multi_range_hit_point];
-#endif
- DBUG_RETURN(0);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -5222,12 +4438,7 @@ int ha_spider::read_multi_range_first_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
if (error_num)
{
@@ -5240,19 +4451,11 @@ int ha_spider::read_multi_range_first_internal(
{
if (multi_range_cnt >= (uint) result_list.multi_split_read)
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res9=%d", range_res));
-#else
- multi_range_curr++;
-#endif
}
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res
-#else
- multi_range_curr == multi_range_end
-#endif
) {
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(error_num);
@@ -5277,19 +4480,11 @@ int ha_spider::read_multi_range_first_internal(
} else
DBUG_RETURN(error_num);
} else {
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (!range_info)
DBUG_RETURN(0);
if (!(error_num = spider_db_fetch(table->record[0], this, table)))
-#else
- if (!buf || !(error_num = spider_db_fetch(buf, this, table)))
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
*range_info = multi_range_keys[multi_range_hit_point];
-#else
- *found_range_p = &multi_range_ranges[multi_range_hit_point];
-#endif
DBUG_RETURN(0);
}
if (
@@ -5301,19 +4496,11 @@ int ha_spider::read_multi_range_first_internal(
{
if (multi_range_cnt >= (uint) result_list.multi_split_read)
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res10=%d", range_res));
-#else
- multi_range_curr++;
-#endif
}
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res
-#else
- multi_range_curr == multi_range_end
-#endif
) {
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(error_num);
@@ -5346,16 +4533,11 @@ int ha_spider::read_multi_range_first_internal(
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#else
- multi_range_ranges = multi_range_curr;
-#endif
} while (!error_num);
}
DBUG_RETURN(0);
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
int ha_spider::pre_multi_range_read_next(
bool use_parallel
) {
@@ -5371,15 +4553,9 @@ int ha_spider::pre_multi_range_read_next(
DBUG_RETURN(0);
}
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int ha_spider::multi_range_read_next(
range_id_t *range_info
)
-#else
-int ha_spider::multi_range_read_next(
- char **range_info
-)
-#endif
{
int error_num;
DBUG_ENTER("ha_spider::multi_range_read_next");
@@ -5406,82 +4582,16 @@ int ha_spider::multi_range_read_next(
error_num = multi_range_read_next_next(range_info);
DBUG_RETURN(error_num);
}
-#else
-int ha_spider::pre_read_multi_range_first(
- KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- HANDLER_BUFFER *buffer,
- bool use_parallel
-) {
- DBUG_ENTER("ha_spider::pre_read_multi_range_first");
- DBUG_PRINT("info",("spider this=%p", this));
- check_pre_call(use_parallel);
- if (use_pre_call)
- {
- store_error_num =
- read_multi_range_first_internal(NULL, found_range_p, ranges,
- range_count, sorted, buffer);
- DBUG_RETURN(store_error_num);
- }
- DBUG_RETURN(0);
-}
-
-int ha_spider::read_multi_range_first(
- KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- HANDLER_BUFFER *buffer
-) {
- int error_num;
- DBUG_ENTER("ha_spider::read_multi_range_first");
- DBUG_PRINT("info",("spider this=%p", this));
- if (use_pre_call)
- {
- if (store_error_num)
- {
- if (store_error_num == HA_ERR_END_OF_FILE)
- table->status = STATUS_NOT_FOUND;
- DBUG_RETURN(store_error_num);
- }
- if ((error_num = spider_bg_all_conn_pre_next(this, search_link_idx)))
- DBUG_RETURN(error_num);
- use_pre_call = FALSE;
- DBUG_RETURN(read_multi_range_next(found_range_p));
- }
- DBUG_RETURN(read_multi_range_first_internal(table->record[0], found_range_p,
- ranges, range_count, sorted, buffer));
-}
-#endif
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int ha_spider::multi_range_read_next_next(
range_id_t *range_info
)
-#else
-int ha_spider::multi_range_read_next_next(
- char **range_info
-)
-#endif
-#else
-int ha_spider::read_multi_range_next(
- KEY_MULTI_RANGE **found_range_p
-)
-#endif
{
int error_num, roop_count;
SPIDER_CONN *conn;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
int range_res;
backup_error_status();
DBUG_ENTER("ha_spider::multi_range_read_next_next");
-#else
- backup_error_status();
- DBUG_ENTER("ha_spider::read_multi_range_next");
-#endif
DBUG_PRINT("info",("spider this=%p", this));
if (wide_handler->trx->thd->killed)
{
@@ -5495,29 +4605,19 @@ int ha_spider::read_multi_range_next(
pt_clone_source_handler->pt_clone_last_searcher = this;
}
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
multi_range_num == 1 ||
-#endif
result_list.multi_split_read <= 1 ||
(sql_kinds & SPIDER_SQL_KIND_HANDLER)
) {
if (!(error_num = spider_db_seek_next(table->record[0], this,
search_link_idx, table)))
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
*range_info = (char *) mrr_cur_range.ptr;
-#else
- *found_range_p = multi_range_curr;
-#endif
DBUG_RETURN(0);
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res1=%d", range_res));
-#else
- multi_range_curr++;
-#endif
if (
error_num != HA_ERR_END_OF_FILE &&
!check_error_mode(error_num)
@@ -5525,19 +4625,13 @@ int ha_spider::read_multi_range_next(
error_num = HA_ERR_END_OF_FILE;
if (
error_num != HA_ERR_END_OF_FILE ||
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res
-#else
- multi_range_curr == multi_range_end
-#endif
)
DBUG_RETURN(error_num);
spider_db_free_one_result_for_start_next(this);
spider_first_split_read_param(this);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
if (result_list.current)
@@ -5546,19 +4640,9 @@ int ha_spider::read_multi_range_next(
result_list.current->finish_flg = FALSE;
}
result_list.record_num = 0;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
do
-#else
- for (
- ;
- multi_range_curr < multi_range_end;
- multi_range_curr++
- )
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res2=%d", range_res));
-#endif
if (check_no_where_cond())
{
DBUG_RETURN(check_error_mode_eof(0));
@@ -5571,17 +4655,10 @@ int ha_spider::read_multi_range_next(
result_list.split_read :
result_list.internal_limit - result_list.record_num;
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
(error_num = spider_db_append_key_where(
&mrr_cur_range.start_key,
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
NULL : &mrr_cur_range.end_key, this))
-#else
- (error_num = spider_db_append_key_where(
- &multi_range_curr->start_key,
- SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
- NULL : &multi_range_curr->end_key, this))
-#endif
)
DBUG_RETURN(error_num);
if (sql_kinds & SPIDER_SQL_KIND_SQL)
@@ -5644,7 +4721,6 @@ int ha_spider::read_multi_range_next(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -5677,7 +4753,6 @@ int ha_spider::read_multi_range_next(
);
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -5709,21 +4784,6 @@ int ha_spider::read_multi_range_next(
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
- *range_info = multi_range_keys[multi_range_hit_point];
-#else
- *found_range_p = &multi_range_ranges[multi_range_hit_point];
-#endif
- DBUG_RETURN(0);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -5838,12 +4898,7 @@ int ha_spider::read_multi_range_next(
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
if (error_num)
break;
}
@@ -5873,11 +4928,7 @@ int ha_spider::read_multi_range_next(
} else {
if (!(error_num = spider_db_fetch(table->record[0], this, table)))
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
*range_info = (char *) mrr_cur_range.ptr;
-#else
- *found_range_p = multi_range_curr;
-#endif
DBUG_RETURN(check_ha_range_eof());
}
if (
@@ -5902,37 +4953,26 @@ int ha_spider::read_multi_range_next(
} else
DBUG_RETURN(error_num);
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res3=%d", range_res));
-#endif
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
while (!range_res);
-#endif
if (error_num)
DBUG_RETURN(check_error_mode_eof(error_num));
} else {
if (!(error_num = spider_db_seek_next(table->record[0], this,
search_link_idx, table)))
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
*range_info = multi_range_keys[multi_range_hit_point];
-#else
- *found_range_p = &multi_range_ranges[multi_range_hit_point];
-#endif
DBUG_RETURN(0);
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
const uchar *first_mrr_start_key;
const uchar *first_mrr_end_key;
uint first_mrr_start_key_length;
uint first_mrr_end_key_length;
-#endif
if (!result_list.tmp_table_join_break_after_get_next)
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res4=%d", range_res));
if (!range_res)
@@ -5960,15 +5000,9 @@ int ha_spider::read_multi_range_next(
mrr_cur_range.end_key.key = (const uchar *) mrr_key_buff[1].ptr();
}
}
-#else
- if (multi_range_curr < multi_range_end)
- multi_range_curr++;
-#endif
} else {
result_list.tmp_table_join_break_after_get_next = FALSE;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = 0;
-#endif
}
if (
@@ -5978,11 +5012,7 @@ int ha_spider::read_multi_range_next(
error_num = HA_ERR_END_OF_FILE;
if (
error_num != HA_ERR_END_OF_FILE ||
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res
-#else
- multi_range_curr == multi_range_end
-#endif
)
DBUG_RETURN(error_num);
if (check_no_where_cond())
@@ -5991,10 +5021,8 @@ int ha_spider::read_multi_range_next(
}
spider_db_free_one_result_for_start_next(this);
spider_first_split_read_param(this);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
if (result_list.current)
@@ -6007,10 +5035,6 @@ int ha_spider::read_multi_range_next(
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#else
- multi_range_ranges = multi_range_curr;
-#endif
bool tmp_high_priority = wide_handler->high_priority;
bool have_multi_range;
@@ -6018,59 +5042,35 @@ int ha_spider::read_multi_range_next(
error_num = 0;
do
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (
!have_second_range &&
(range_res = mrr_funcs.next(mrr_iter, &mrr_second_range))
)
-#else
- if (multi_range_curr + 1 >= multi_range_end)
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
have_second_range = FALSE;
-#endif
have_multi_range = FALSE;
} else {
-#ifdef HA_MRR_USE_DEFAULT_IMPL
have_second_range = TRUE;
-#endif
have_multi_range = TRUE;
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
DBUG_PRINT("info",("spider range_res5=%d", range_res));
-#endif
result_list.tmp_reuse_sql = FALSE;
if (bka_mode &&
have_multi_range &&
-#ifdef HA_MRR_USE_DEFAULT_IMPL
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE)
-#else
- SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE)
-#endif
) {
if (
result_list.tmp_table_join &&
-#ifdef HA_MRR_USE_DEFAULT_IMPL
result_list.tmp_table_join_key_part_map ==
mrr_cur_range.start_key.keypart_map
-#else
- result_list.tmp_table_join_key_part_map ==
- multi_range_curr->start_key.keypart_map
-#endif
) {
/* reuse tmp_sql */
result_list.tmp_reuse_sql = TRUE;
} else {
/* create tmp_sql */
result_list.tmp_table_join = TRUE;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
result_list.tmp_table_join_key_part_map =
mrr_cur_range.start_key.keypart_map;
-#else
- result_list.tmp_table_join_key_part_map =
- multi_range_curr->start_key.keypart_map;
-#endif
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL)))
DBUG_RETURN(error_num);
@@ -6116,11 +5116,7 @@ int ha_spider::read_multi_range_next(
if (!result_list.tmp_reuse_sql)
{
if ((error_num = append_union_table_and_sql_for_bka(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key
-#else
- &multi_range_curr->start_key
-#endif
))) {
DBUG_RETURN(error_num);
}
@@ -6134,11 +5130,7 @@ int ha_spider::read_multi_range_next(
if (!result_list.tmp_reuse_sql)
{
if ((error_num = append_tmp_table_and_sql_for_bka(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key
-#else
- &multi_range_curr->start_key
-#endif
))) {
DBUG_RETURN(error_num);
}
@@ -6150,38 +5142,18 @@ int ha_spider::read_multi_range_next(
}
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
do
-#else
- for (
- ;
- multi_range_curr < multi_range_end;
- multi_range_curr++
- )
-#endif
{
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
!SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ||
result_list.tmp_table_join_key_part_map !=
mrr_cur_range.start_key.keypart_map
-#else
- !SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ||
- result_list.tmp_table_join_key_part_map !=
- multi_range_curr->start_key.keypart_map
-#endif
) {
result_list.tmp_table_join_break_after_get_next = TRUE;
break;
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
-#else
- multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
-#endif
-#endif
if (bka_mode == 2)
{
if ((error_num = spider_db_append_select(this)))
@@ -6192,11 +5164,7 @@ int ha_spider::read_multi_range_next(
SPIDER_SQL_TYPE_SELECT_SQL, multi_range_cnt)))
DBUG_RETURN(error_num);
if ((error_num = append_key_column_values_with_name_sql_part(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key,
-#else
- &multi_range_curr->start_key,
-#endif
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
} else {
@@ -6204,11 +5172,7 @@ int ha_spider::read_multi_range_next(
SPIDER_SQL_TYPE_SELECT_SQL, multi_range_cnt, TRUE)))
DBUG_RETURN(error_num);
if ((error_num = append_key_column_values_sql_part(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key,
-#else
- &multi_range_curr->start_key,
-#endif
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
@@ -6220,11 +5184,7 @@ int ha_spider::read_multi_range_next(
SPIDER_SQL_TYPE_TMP_SQL, multi_range_cnt, TRUE)))
DBUG_RETURN(error_num);
if ((error_num = append_key_column_values_sql_part(
-#ifdef HA_MRR_USE_DEFAULT_IMPL
&mrr_cur_range.start_key,
-#else
- &multi_range_curr->start_key,
-#endif
SPIDER_SQL_TYPE_TMP_SQL)))
DBUG_RETURN(error_num);
@@ -6235,7 +5195,6 @@ int ha_spider::read_multi_range_next(
multi_range_cnt++;
if (multi_range_cnt >= (uint) result_list.multi_split_read)
break;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_cnt == 1)
{
if (have_multi_range)
@@ -6251,11 +5210,8 @@ int ha_spider::read_multi_range_next(
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res6=%d", range_res));
}
-#endif
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
while (!range_res);
-#endif
if (bka_mode == 2)
{
if ((error_num = append_union_table_terminator_sql_part(
@@ -6290,23 +5246,9 @@ int ha_spider::read_multi_range_next(
append_union_all_start_sql_part(SPIDER_SQL_TYPE_SELECT_SQL))
)
DBUG_RETURN(error_num);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
do
-#else
- for (
- ;
- multi_range_curr < multi_range_end;
- multi_range_curr++
- )
-#endif
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
multi_range_keys[multi_range_cnt] = mrr_cur_range.ptr;
-#else
- multi_range_keys[multi_range_cnt] = (char *) mrr_cur_range.ptr;
-#endif
-#endif
if ((error_num = spider_db_append_select(this)))
DBUG_RETURN(error_num);
if ((error_num = append_multi_range_cnt_sql_part(
@@ -6326,17 +5268,10 @@ int ha_spider::read_multi_range_next(
DBUG_RETURN(error_num);
set_where_pos_sql(SPIDER_SQL_TYPE_SELECT_SQL);
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
(error_num = spider_db_append_key_where(
&mrr_cur_range.start_key,
SPIDER_TEST(mrr_cur_range.range_flag & EQ_RANGE) ?
NULL : &mrr_cur_range.end_key, this))
-#else
- (error_num = spider_db_append_key_where(
- &multi_range_curr->start_key,
- SPIDER_TEST(multi_range_curr->range_flag & EQ_RANGE) ?
- NULL : &multi_range_curr->end_key, this))
-#endif
)
DBUG_RETURN(error_num);
if (result_list.direct_order_limit)
@@ -6366,7 +5301,6 @@ int ha_spider::read_multi_range_next(
multi_range_cnt++;
if (multi_range_cnt >= (uint) result_list.multi_split_read)
break;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
if (multi_range_cnt == 1)
{
if (have_multi_range)
@@ -6382,21 +5316,16 @@ int ha_spider::read_multi_range_next(
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res7=%d", range_res));
}
-#endif
}
-#ifdef HA_MRR_USE_DEFAULT_IMPL
while (!range_res);
-#endif
wide_handler->high_priority = tmp_high_priority;
if ((error_num =
append_union_all_end_sql_part(SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
result_list.use_union = TRUE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate_backup = result_list.direct_aggregate;
result_list.direct_aggregate = FALSE;
-#endif
if (result_list.direct_order_limit)
{
if ((error_num =
@@ -6408,9 +5337,7 @@ int ha_spider::read_multi_range_next(
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list.direct_aggregate = direct_aggregate_backup;
-#endif
if ((error_num = append_limit_sql_part(
result_list.internal_offset,
result_list.limit_num,
@@ -6442,7 +5369,6 @@ int ha_spider::read_multi_range_next(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -6477,7 +5403,6 @@ int ha_spider::read_multi_range_next(
break;
}
} else {
-#endif
ulong sql_type;
conn = conns[roop_count];
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -6510,21 +5435,6 @@ int ha_spider::read_multi_range_next(
}
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(wide_handler->trx, conn);
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
- *range_info = multi_range_keys[multi_range_hit_point];
-#else
- *found_range_p = &multi_range_ranges[multi_range_hit_point];
-#endif
- DBUG_RETURN(0);
- } else {
-#endif
conn->need_mon = &need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -6682,12 +5592,7 @@ int ha_spider::read_multi_range_next(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
if (error_num)
{
@@ -6700,19 +5605,11 @@ int ha_spider::read_multi_range_next(
{
if (multi_range_cnt >= (uint) result_list.multi_split_read)
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res8=%d", range_res));
-#else
- multi_range_curr++;
-#endif
}
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res
-#else
- multi_range_curr == multi_range_end
-#endif
) {
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(error_num);
@@ -6739,11 +5636,7 @@ int ha_spider::read_multi_range_next(
} else {
if (!(error_num = spider_db_fetch(table->record[0], this, table)))
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
*range_info = multi_range_keys[multi_range_hit_point];
-#else
- *found_range_p = &multi_range_ranges[multi_range_hit_point];
-#endif
DBUG_RETURN(0);
}
if (
@@ -6755,19 +5648,11 @@ int ha_spider::read_multi_range_next(
{
if (multi_range_cnt >= (uint) result_list.multi_split_read)
{
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
DBUG_PRINT("info",("spider range_res9=%d", range_res));
-#else
- multi_range_curr++;
-#endif
}
if (
-#ifdef HA_MRR_USE_DEFAULT_IMPL
range_res
-#else
- multi_range_curr == multi_range_end
-#endif
) {
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(error_num);
@@ -6800,10 +5685,6 @@ int ha_spider::read_multi_range_next(
if ((error_num = reset_sql_sql(
SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_HANDLER)))
DBUG_RETURN(error_num);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#else
- multi_range_ranges = multi_range_curr;
-#endif
} while (!error_num);
}
DBUG_RETURN(0);
@@ -6867,10 +5748,8 @@ int ha_spider::rnd_init(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (conns[roop_count] && result_list.bgs_working)
spider_bg_conn_break(conns[roop_count], this);
-#endif
if (quick_targets[roop_count])
{
spider_db_free_one_quick_result(
@@ -6887,9 +5766,7 @@ int ha_spider::rnd_init(
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.quick_phase = 0;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list.bgs_phase = 0;
-#endif
}
mrr_with_cnt = FALSE;
@@ -6921,15 +5798,6 @@ int ha_spider::rnd_init(
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::pre_rnd_init(
- bool scan
-) {
- DBUG_ENTER("ha_spider::pre_rnd_init");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_rnd_init(scan));
-}
-#endif
int ha_spider::rnd_end()
{
@@ -6953,14 +5821,6 @@ int ha_spider::rnd_end()
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::pre_rnd_end()
-{
- DBUG_ENTER("ha_spider::pre_rnd_end");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_rnd_end());
-}
-#endif
int ha_spider::rnd_next_internal(
uchar *buf
@@ -6979,22 +5839,16 @@ int ha_spider::rnd_next_internal(
/* do not copy table data at alter table */
if (wide_handler->sql_command == SQLCOM_ALTER_TABLE)
DBUG_RETURN(HA_ERR_END_OF_FILE);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if (rnd_scan_and_first)
{
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
if ((error_num = rnd_handler_init()))
DBUG_RETURN(check_error_mode_eof(error_num));
check_direct_order_limit();
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(TRUE);
-#endif
if (this->result_list.direct_limit_offset)
{
@@ -7053,14 +5907,12 @@ int ha_spider::rnd_next_internal(
NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list.direct_aggregate)
{
if ((error_num =
append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
-#endif
result_list.desc_flg = FALSE;
result_list.sorted = FALSE;
result_list.key_info = NULL;
@@ -7116,7 +5968,6 @@ int ha_spider::rnd_next_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -7151,7 +6002,6 @@ int ha_spider::rnd_next_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
SPIDER_CONN *conn = conns[roop_count];
ulong sql_type;
if (sql_kind[roop_count] == SPIDER_SQL_KIND_SQL)
@@ -7295,9 +6145,7 @@ int ha_spider::rnd_next_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
rnd_scan_and_first = FALSE;
@@ -7645,13 +6493,9 @@ int ha_spider::ft_read_internal(
ft_init_and_first = FALSE;
spider_db_free_one_result_for_start_next(this);
check_direct_order_limit();
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(this)))
DBUG_RETURN(error_num);
-#endif
-#ifdef WITH_PARTITION_STORAGE_ENGINE
check_select_column(FALSE);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list.finish_flg = FALSE;
result_list.record_num = 0;
@@ -7696,14 +6540,12 @@ int ha_spider::ft_read_internal(
SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list.direct_aggregate)
{
if ((error_num =
append_group_by_sql_part(NULL, 0, SPIDER_SQL_TYPE_SELECT_SQL)))
DBUG_RETURN(error_num);
}
-#endif
if (sql_kinds & SPIDER_SQL_KIND_SQL)
{
if ((error_num = append_limit_sql_part(
@@ -7753,7 +6595,6 @@ int ha_spider::ft_read_internal(
conn_link_idx, roop_count, share->link_count,
SPIDER_LINK_STATUS_RECOVERY)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list.bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(
@@ -7788,7 +6629,6 @@ int ha_spider::ft_read_internal(
DBUG_RETURN(check_error_mode_eof(error_num));
}
} else {
-#endif
uint dbton_id = share->use_sql_dbton_ids[roop_count];
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
SPIDER_CONN *conn = conns[roop_count];
@@ -7927,9 +6767,7 @@ int ha_spider::ft_read_internal(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
}
@@ -7988,12 +6826,8 @@ int ha_spider::info(
THD *thd = ha_thd();
double sts_interval = spider_param_sts_interval(thd, share->sts_interval);
int sts_mode = spider_param_sts_mode(thd, share->sts_mode);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int sts_sync = spider_param_sts_sync(thd, share->sts_sync);
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int sts_bg_mode = spider_param_sts_bg_mode(thd, share->sts_bg_mode);
-#endif
SPIDER_INIT_ERROR_TABLE *spider_init_error_table = NULL;
set_error_mode();
backup_error_status();
@@ -8045,9 +6879,7 @@ int ha_spider::info(
{
tmp_auto_increment_mode = spider_param_auto_increment_mode(thd,
share->auto_increment_mode);
-#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
info_auto_called = TRUE;
-#endif
}
if (!share->sts_init)
{
@@ -8083,10 +6915,8 @@ int ha_spider::info(
}
pthread_mutex_unlock(&share->sts_mutex);
sts_interval = 0;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (tmp_auto_increment_mode == 1)
sts_sync = 0;
-#endif
}
}
if (flag & HA_STATUS_AUTO)
@@ -8097,9 +6927,7 @@ int ha_spider::info(
!share->lgtm_tblhnd_share->auto_increment_init
) {
sts_interval = 0;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
sts_sync = 0;
-#endif
}
}
if (difftime(tmp_time, share->sts_get_time) >= sts_interval)
@@ -8108,10 +6936,8 @@ int ha_spider::info(
sts_interval == 0 ||
!pthread_mutex_trylock(&share->sts_mutex)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (sts_interval == 0 || sts_bg_mode == 0)
{
-#endif
if (sts_interval == 0)
pthread_mutex_lock(&share->sts_mutex);
if (difftime(tmp_time, share->sts_get_time) >= sts_interval)
@@ -8153,9 +6979,7 @@ int ha_spider::info(
}
if ((error_num = spider_get_sts(share, search_link_idx, tmp_time,
this, sts_interval, sts_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
sts_sync,
-#endif
share->sts_init ? 2 : 1,
flag | (share->sts_init ? 0 : HA_STATUS_AUTO)))
) {
@@ -8217,7 +7041,6 @@ int ha_spider::info(
DBUG_RETURN(check_error_mode(error_num));
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
} else if (sts_bg_mode == 1) {
/* background */
if (!share->bg_sts_init || share->bg_sts_thd_wait)
@@ -8226,9 +7049,7 @@ int ha_spider::info(
share->bg_sts_try_time = tmp_time;
share->bg_sts_interval = sts_interval;
share->bg_sts_mode = sts_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->bg_sts_sync = sts_sync;
-#endif
if (!share->bg_sts_init)
{
if ((error_num = spider_create_sts_thread(share)))
@@ -8253,12 +7074,9 @@ int ha_spider::info(
share->bg_sts_try_time = tmp_time;
share->bg_sts_interval = sts_interval;
share->bg_sts_mode = sts_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->bg_sts_sync = sts_sync;
-#endif
spider_table_add_share_to_sts_thread(share);
}
-#endif
pthread_mutex_unlock(&share->sts_mutex);
}
}
@@ -8364,12 +7182,8 @@ ha_rows ha_spider::records_in_range(
double crd_interval = spider_param_crd_interval(thd, share->crd_interval);
int crd_mode = spider_param_crd_mode(thd, share->crd_mode);
int crd_type = spider_param_crd_type(thd, share->crd_type);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int crd_sync = spider_param_crd_sync(thd, share->crd_sync);
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int crd_bg_mode = spider_param_crd_bg_mode(thd, share->crd_bg_mode);
-#endif
SPIDER_INIT_ERROR_TABLE *spider_init_error_table = NULL;
uint dbton_id;
spider_db_handler *dbton_hdl;
@@ -8435,19 +7249,15 @@ ha_rows ha_spider::records_in_range(
crd_interval == 0 ||
!pthread_mutex_trylock(&share->crd_mutex)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (crd_interval == 0 || crd_bg_mode == 0)
{
-#endif
if (crd_interval == 0)
pthread_mutex_lock(&share->crd_mutex);
if (difftime(tmp_time, share->crd_get_time) >= crd_interval)
{
if ((error_num = spider_get_crd(share, search_link_idx, tmp_time,
this, table, crd_interval, crd_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
crd_sync,
-#endif
share->crd_init ? 2 : 1)))
{
pthread_mutex_unlock(&share->crd_mutex);
@@ -8500,7 +7310,6 @@ ha_rows ha_spider::records_in_range(
DBUG_RETURN(HA_POS_ERROR);
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
} else if (crd_bg_mode == 1) {
/* background */
if (!share->bg_crd_init || share->bg_crd_thd_wait)
@@ -8509,9 +7318,7 @@ ha_rows ha_spider::records_in_range(
share->bg_crd_try_time = tmp_time;
share->bg_crd_interval = crd_interval;
share->bg_crd_mode = crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->bg_crd_sync = crd_sync;
-#endif
if (!share->bg_crd_init)
{
if ((error_num = spider_create_crd_thread(share)))
@@ -8527,12 +7334,9 @@ ha_rows ha_spider::records_in_range(
share->bg_crd_try_time = tmp_time;
share->bg_crd_interval = crd_interval;
share->bg_crd_mode = crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->bg_crd_sync = crd_sync;
-#endif
spider_table_add_share_to_crd_thread(share);
}
-#endif
pthread_mutex_unlock(&share->crd_mutex);
}
}
@@ -8688,12 +7492,8 @@ int ha_spider::check_crd()
THD *thd = ha_thd();
double crd_interval = spider_param_crd_interval(thd, share->crd_interval);
int crd_mode = spider_param_crd_mode(thd, share->crd_mode);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int crd_sync = spider_param_crd_sync(thd, share->crd_sync);
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int crd_bg_mode = spider_param_crd_bg_mode(thd, share->crd_bg_mode);
-#endif
SPIDER_INIT_ERROR_TABLE *spider_init_error_table = NULL;
uint dbton_id;
spider_db_handler *dbton_hdl;
@@ -8745,19 +7545,15 @@ int ha_spider::check_crd()
crd_interval == 0 ||
!pthread_mutex_trylock(&share->crd_mutex)
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (crd_interval == 0 || crd_bg_mode == 0)
{
-#endif
if (crd_interval == 0)
pthread_mutex_lock(&share->crd_mutex);
if (difftime(tmp_time, share->crd_get_time) >= crd_interval)
{
if ((error_num = spider_get_crd(share, search_link_idx, tmp_time,
this, table, crd_interval, crd_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
crd_sync,
-#endif
share->crd_init ? 2 : 1)))
{
pthread_mutex_unlock(&share->crd_mutex);
@@ -8803,7 +7599,6 @@ int ha_spider::check_crd()
DBUG_RETURN(check_error_mode(error_num));
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
} else if (crd_bg_mode == 1) {
/* background */
if (!share->bg_crd_init || share->bg_crd_thd_wait)
@@ -8812,9 +7607,7 @@ int ha_spider::check_crd()
share->bg_crd_try_time = tmp_time;
share->bg_crd_interval = crd_interval;
share->bg_crd_mode = crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->bg_crd_sync = crd_sync;
-#endif
if (!share->bg_crd_init)
{
if ((error_num = spider_create_crd_thread(share)))
@@ -8829,12 +7622,9 @@ int ha_spider::check_crd()
share->bg_crd_try_time = tmp_time;
share->bg_crd_interval = crd_interval;
share->bg_crd_mode = crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->bg_crd_sync = crd_sync;
-#endif
spider_table_add_share_to_crd_thread(share);
}
-#endif
pthread_mutex_unlock(&share->crd_mutex);
}
}
@@ -8910,7 +7700,6 @@ ha_rows ha_spider::records()
DBUG_RETURN(table_rows);
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int ha_spider::pre_calculate_checksum()
{
int error_num;
@@ -8988,7 +7777,6 @@ int ha_spider::calculate_checksum()
}
DBUG_RETURN(0);
}
-#endif
const char *ha_spider::table_type() const
{
@@ -9147,7 +7935,6 @@ uint8 ha_spider::table_cache_type()
DBUG_RETURN(HA_CACHE_TBL_NOCACHE);
}
-#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
bool ha_spider::need_info_for_auto_inc()
{
THD *thd = ha_thd();
@@ -9168,7 +7955,6 @@ bool ha_spider::need_info_for_auto_inc()
)
));
}
-#endif
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool ha_spider::can_use_for_auto_inc_init()
@@ -9342,16 +8128,10 @@ void ha_spider::release_auto_increment()
DBUG_VOID_RETURN;
}
-#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
void ha_spider::start_bulk_insert(
ha_rows rows,
uint flags
)
-#else
-void ha_spider::start_bulk_insert(
- ha_rows rows
-)
-#endif
{
DBUG_ENTER("ha_spider::start_bulk_insert");
DBUG_PRINT("info",("spider this=%p", this));
@@ -9394,39 +8174,6 @@ int ha_spider::write_row(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- ulonglong option_backup = 0;
- if (is_bulk_access_clone)
- {
- bulk_access_pre_called = FALSE;
- DBUG_RETURN(spider_db_bulk_bulk_insert(this));
- }
-#if MYSQL_VERSION_ID < 50500
- option_backup = thd->options;
- thd->options &= ~OPTION_BIN_LOG;
-#else
- option_backup = thd->variables.option_bits;
- thd->variables.option_bits &= ~OPTION_BIN_LOG;
-#endif
- error_num = bulk_access_link_exec_tgt->spider->ha_write_row(buf);
-#if MYSQL_VERSION_ID < 50500
- thd->options = option_backup;
-#else
- thd->variables.option_bits = option_backup;
-#endif
- DBUG_RETURN(error_num);
- }
-#endif
if (!dml_inited)
{
if (unlikely((error_num = dml_init())))
@@ -9437,11 +8184,6 @@ int ha_spider::write_row(
#ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
ha_statistic_increment(&SSV::ha_write_count);
#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-#else
- if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
- table->timestamp_field->set_time();
-#endif
if (!bulk_insert)
store_last_insert_id = 0;
if (auto_increment_flag)
@@ -9503,12 +8245,8 @@ int ha_spider::write_row(
DBUG_RETURN(check_error_mode(error_num));
if (bulk_insert)
bulk_size =
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
(wide_handler->insert_with_update &&
!result_list.insert_dup_update_pushdown) ||
-#else
- wide_handler->insert_with_update ||
-#endif
(!direct_dup_insert && wide_handler->ignore_dup_key) ?
0 : spider_param_bulk_size(wide_handler->trx->thd, share->bulk_size);
else
@@ -9517,46 +8255,10 @@ int ha_spider::write_row(
if ((error_num = spider_db_bulk_insert(this, table, &copy_info, FALSE)))
DBUG_RETURN(check_error_mode(error_num));
-#ifdef HA_CAN_BULK_ACCESS
- /* bulk access disabled case (like using partitioning) */
- if (bulk_access_executing && is_bulk_access_clone)
- {
- bulk_req_exec();
- DBUG_RETURN(spider_db_bulk_bulk_insert(this));
- }
-#endif
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::pre_write_row(
- uchar *buf
-) {
- int error_num;
- ulonglong option_backup = 0;
- THD *thd = wide_handler->trx->thd;
- DBUG_ENTER("ha_spider::pre_write_row");
- DBUG_PRINT("info",("spider this=%p", this));
-#if MYSQL_VERSION_ID < 50500
- option_backup = thd->options;
- thd->options &= ~OPTION_BIN_LOG;
-#else
- option_backup = thd->variables.option_bits;
- thd->variables.option_bits &= ~OPTION_BIN_LOG;
-#endif
- error_num = bulk_access_link_current->spider->ha_write_row(buf);
- bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
- bulk_access_link_current->called = TRUE;
-#if MYSQL_VERSION_ID < 50500
- thd->options = option_backup;
-#else
- thd->variables.option_bits = option_backup;
-#endif
- DBUG_RETURN(error_num);
-}
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
void ha_spider::direct_update_init(
THD *thd,
bool hs_request
@@ -9566,7 +8268,6 @@ void ha_spider::direct_update_init(
do_direct_update = TRUE;
DBUG_VOID_RETURN;
}
-#endif
bool ha_spider::start_bulk_update(
) {
@@ -9645,40 +8346,10 @@ int ha_spider::update_row(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing && !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- ulonglong option_backup = 0;
-#if MYSQL_VERSION_ID < 50500
- option_backup = thd->options;
- thd->options &= ~OPTION_BIN_LOG;
-#else
- option_backup = thd->variables.option_bits;
- thd->variables.option_bits &= ~OPTION_BIN_LOG;
-#endif
- error_num = bulk_access_link_exec_tgt->spider->ha_update_row(
- old_data, new_data);
-#if MYSQL_VERSION_ID < 50500
- thd->options = option_backup;
-#else
- thd->variables.option_bits = option_backup;
-#endif
- DBUG_RETURN(error_num);
- }
-#endif
#ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
ha_statistic_increment(&SSV::ha_update_count);
#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-#else
- if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
- table->timestamp_field->set_time();
-#endif
if ((error_num = spider_db_update(this, table, old_data)))
DBUG_RETURN(check_error_mode(error_num));
if (table->found_next_number_field &&
@@ -9722,7 +8393,6 @@ int ha_spider::update_row(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool ha_spider::check_direct_update_sql_part(
st_select_lex *select_lex,
longlong select_limit,
@@ -9745,136 +8415,6 @@ bool ha_spider::check_direct_update_sql_part(
DBUG_RETURN(FALSE);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-#ifdef SPIDER_MDEV_16246
-int ha_spider::direct_update_rows_init(
- List<Item> *update_fields,
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
-)
-#else
-int ha_spider::direct_update_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
-)
-#endif
-{
- st_select_lex *select_lex;
- longlong select_limit;
- longlong offset_limit;
- THD *thd = wide_handler->trx->thd;
- DBUG_ENTER("ha_spider::direct_update_rows_init");
- DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- DBUG_PRINT("info",("spider return pre_direct_init_result %d",
- pre_direct_init_result));
- DBUG_RETURN(pre_direct_init_result);
- }
-#ifdef SPIDER_MDEV_16246
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
- update_fields, mode, ranges, range_count, sorted, new_data));
-#else
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init(
- mode, ranges, range_count, sorted, new_data));
-#endif
- }
-#endif
- if (!dml_inited)
- {
- if (unlikely((error_num = dml_init())))
- {
- DBUG_RETURN(error_num);
- }
- }
- direct_update_init(
- thd,
- FALSE
- );
- if (!condition)
- cond_check = FALSE;
- spider_get_select_limit(this, &select_lex, &select_limit, &offset_limit);
- if (
- !range_count &&
- direct_update_fields
- ) {
- if (
-#if MYSQL_VERSION_ID < 50500
- !thd->variables.engine_condition_pushdown ||
-#else
-#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
-#else
- !(thd->variables.optimizer_switch &
- OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
-#endif
-#endif
- !select_lex ||
- select_lex->table_list.elements != 1 ||
- check_update_columns_sql_part() ||
- check_direct_update_sql_part(select_lex, select_limit, offset_limit) ||
- spider_db_append_condition(this, NULL, 0, TRUE)
- ) {
- DBUG_PRINT("info",("spider FALSE by condition"));
- do_direct_update = FALSE;
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
- }
- if (select_lex->order_list.elements)
- {
- ORDER *order;
- for (order = (ORDER *) select_lex->order_list.first; order;
- order = order->next)
- {
- if (check_item_type_sql((*order->item)))
- {
- DBUG_PRINT("info",("spider FALSE by order"));
- do_direct_update = FALSE;
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
- }
- }
- result_list.direct_order_limit = TRUE;
- }
- wide_handler->trx->direct_update_count++;
- DBUG_PRINT("info",("spider OK"));
- DBUG_RETURN(0);
- }
-
- DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit));
- DBUG_PRINT("info",("spider mode=%u", mode));
- DBUG_PRINT("info",("spider sql_command=%u", sql_command));
- DBUG_PRINT("info",("spider do_direct_update=%s",
- do_direct_update ? "TRUE" : "FALSE"));
- if (
- (
- !offset_limit
- ) &&
- do_direct_update
- ) {
- wide_handler->trx->direct_update_count++;
- DBUG_PRINT("info",("spider OK"));
- DBUG_RETURN(0);
- }
- DBUG_PRINT("info",("spider FALSE by default"));
- do_direct_update = FALSE;
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-}
-#else
#ifdef SPIDER_MDEV_16246
/**
Perform initialization for a direct update request.
@@ -9922,31 +8462,6 @@ int ha_spider::direct_update_rows_init()
}
}
}
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- DBUG_PRINT("info",("spider return pre_direct_init_result %d",
- pre_direct_init_result));
- DBUG_RETURN(pre_direct_init_result);
- }
-#ifdef SPIDER_MDEV_16246
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->
- direct_update_rows_init(update_fields));
-#else
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_update_rows_init());
-#endif
- }
-#endif
if (!dml_inited)
{
if (unlikely(dml_init()))
@@ -9964,15 +8479,11 @@ int ha_spider::direct_update_rows_init()
if (wide_handler->direct_update_fields)
{
if (
-#if MYSQL_VERSION_ID < 50500
- !thd->variables.engine_condition_pushdown ||
-#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else
!(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
-#endif
!select_lex ||
select_lex->table_list.elements != 1 ||
check_update_columns_sql_part() ||
@@ -10019,121 +8530,9 @@ int ha_spider::direct_update_rows_init()
do_direct_update = FALSE;
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}
-#endif
-
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-#ifdef SPIDER_MDEV_16246
-int ha_spider::pre_direct_update_rows_init(
- List<Item> *update_fields,
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
-)
-#else
-int ha_spider::pre_direct_update_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
-)
-#endif
-{
- int error_num;
- DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (bulk_access_started)
- {
-#ifdef SPIDER_MDEV_16246
- error_num = bulk_access_link_current->spider->
- pre_direct_update_rows_init(
- update_fields, mode, ranges, range_count, sorted, new_data);
-#else
- error_num = bulk_access_link_current->spider->
- pre_direct_update_rows_init(
- mode, ranges, range_count, sorted, new_data);
-#endif
- bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
- bulk_access_link_current->called = TRUE;
- DBUG_RETURN(error_num);
- }
- if (!dml_inited)
- {
- if (unlikely((error_num = dml_init())))
- {
- DBUG_RETURN(error_num);
- }
- }
-#ifdef SPIDER_MDEV_16246
- pre_direct_init_result = direct_update_rows_init(
- update_fields, mode, ranges, range_count, sorted, new_data);
-#else
- pre_direct_init_result = direct_update_rows_init(
- mode, ranges, range_count, sorted, new_data);
-#endif
- DBUG_RETURN(pre_direct_init_result);
-}
-#else
-#ifdef SPIDER_MDEV_16246
-/**
- Do initialization for performing parallel direct update
- for a handlersocket update request.
-
- @param update fields Pointer to the list of fields to update.
- @return >0 Error.
- 0 Success.
-*/
-
-int ha_spider::pre_direct_update_rows_init(
- List<Item> *update_fields
-)
-#else
-int ha_spider::pre_direct_update_rows_init()
-#endif
-{
- int error_num;
- DBUG_ENTER("ha_spider::pre_direct_update_rows_init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (bulk_access_started)
- {
-#ifdef SPIDER_MDEV_16246
- error_num = bulk_access_link_current->spider->
- pre_direct_update_rows_init(update_fields);
-#else
- error_num = bulk_access_link_current->spider->
- pre_direct_update_rows_init();
-#endif
- bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
- bulk_access_link_current->called = TRUE;
- DBUG_RETURN(error_num);
- }
- if (!dml_inited)
- {
- if (unlikely((error_num = dml_init())))
- {
- DBUG_RETURN(error_num);
- }
- }
-#ifdef SPIDER_MDEV_16246
- pre_direct_init_result = direct_update_rows_init(update_fields);
-#else
- pre_direct_init_result = direct_update_rows_init();
-#endif
- DBUG_RETURN(pre_direct_init_result);
-}
-#endif
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
int ha_spider::direct_update_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data,
ha_rows *update_rows,
ha_rows *found_rows
) {
@@ -10148,79 +8547,6 @@ int ha_spider::direct_update_rows(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- bulk_access_pre_called = FALSE;
- DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows));
- }
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows(
- ranges, range_count, sorted, new_data, update_rows, found_rows));
- }
-#endif
- if (
- (active_index != MAX_KEY && (error_num = index_handler_init())) ||
- (active_index == MAX_KEY && (error_num = rnd_handler_init())) ||
- (error_num = spider_db_direct_update(this, table, ranges, range_count,
- update_rows, found_rows))
- )
- DBUG_RETURN(check_error_mode(error_num));
-
-#ifdef HA_CAN_BULK_ACCESS
- if (bulk_access_executing && is_bulk_access_clone)
- {
- bulk_req_exec();
- DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows));
- }
-#endif
- DBUG_RETURN(0);
-}
-#else
-int ha_spider::direct_update_rows(
- ha_rows *update_rows,
- ha_rows *found_rows
-) {
- int error_num;
- THD *thd = ha_thd();
- backup_error_status();
- DBUG_ENTER("ha_spider::direct_update_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- if (spider_param_read_only_mode(thd, share->read_only_mode))
- {
- my_printf_error(ER_SPIDER_READ_ONLY_NUM, ER_SPIDER_READ_ONLY_STR, MYF(0),
- table_share->db.str, table_share->table_name.str);
- DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
- }
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- bulk_access_pre_called = FALSE;
- DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows));
- }
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_update_rows(
- update_rows, found_rows));
- }
-#endif
if (
(active_index != MAX_KEY && (error_num = index_handler_init())) ||
(active_index == MAX_KEY && (error_num = rnd_handler_init())) ||
@@ -10228,45 +8554,9 @@ int ha_spider::direct_update_rows(
)
DBUG_RETURN(check_error_mode(error_num));
-#ifdef HA_CAN_BULK_ACCESS
- if (bulk_access_executing && is_bulk_access_clone)
- {
- bulk_req_exec();
- DBUG_RETURN(spider_db_bulk_direct_update(this, update_rows, found_rows));
- }
-#endif
DBUG_RETURN(0);
}
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int ha_spider::pre_direct_update_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data,
- ha_rows *update_rows,
- ha_rows *found_rows
-) {
- DBUG_ENTER("ha_spider::pre_direct_update_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows(ranges,
- range_count, sorted, new_data, update_rows, found_rows));
-}
-#else
-int ha_spider::pre_direct_update_rows()
-{
- uint update_rows;
- uint found_rows;
- DBUG_ENTER("ha_spider::pre_direct_update_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_direct_update_rows(
- &update_rows, &found_rows));
-}
-#endif
-#endif
-#endif
bool ha_spider::start_bulk_delete(
) {
@@ -10300,40 +8590,15 @@ int ha_spider::delete_row(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing && !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) {
- ulonglong option_backup = 0;
-#if MYSQL_VERSION_ID < 50500
- option_backup = thd->options;
- thd->options &= ~OPTION_BIN_LOG;
-#else
- option_backup = thd->variables.option_bits;
- thd->variables.option_bits &= ~OPTION_BIN_LOG;
-#endif
- error_num = bulk_access_link_exec_tgt->spider->ha_delete_row(buf);
-#if MYSQL_VERSION_ID < 50500
- thd->options = option_backup;
-#else
- thd->variables.option_bits = option_backup;
-#endif
- DBUG_RETURN(error_num);
- }
-#endif
#ifndef SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
ha_statistic_increment(&SSV::ha_delete_count);
#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
if ((error_num = spider_db_delete(this, table, buf)))
DBUG_RETURN(check_error_mode(error_num));
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool ha_spider::check_direct_delete_sql_part(
st_select_lex *select_lex,
longlong select_limit,
@@ -10356,108 +8621,6 @@ bool ha_spider::check_direct_delete_sql_part(
DBUG_RETURN(FALSE);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int ha_spider::direct_delete_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted
-) {
- st_select_lex *select_lex;
- longlong select_limit;
- longlong offset_limit;
- THD *thd = wide_handler->trx->thd;
- DBUG_ENTER("ha_spider::direct_delete_rows_init");
- DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- DBUG_RETURN(pre_direct_init_result);
- }
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init(
- mode, ranges, range_count, sorted));
- }
-#endif
- if (!dml_inited)
- {
- if (unlikely((error_num = dml_init())))
- {
- DBUG_RETURN(error_num);
- }
- }
- direct_update_init(
- thd,
- FALSE
- );
- if (!condition)
- cond_check = FALSE;
- spider_get_select_limit(this, &select_lex, &select_limit, &offset_limit);
- if (!range_count)
- {
- if (
-#if MYSQL_VERSION_ID < 50500
- !thd->variables.engine_condition_pushdown ||
-#else
-#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
-#else
- !(thd->variables.optimizer_switch &
- OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
-#endif
-#endif
- !select_lex ||
- select_lex->table_list.elements != 1 ||
- check_direct_delete_sql_part(select_lex, select_limit, offset_limit) ||
- spider_db_append_condition(this, NULL, 0, TRUE)
- ) {
- DBUG_PRINT("info",("spider FALSE by condition"));
- do_direct_update = FALSE;
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
- }
- if (select_lex->order_list.elements)
- {
- ORDER *order;
- for (order = (ORDER *) select_lex->order_list.first; order;
- order = order->next)
- {
- if (check_item_type_sql((*order->item)))
- {
- DBUG_PRINT("info",("spider FALSE by order"));
- do_direct_update = FALSE;
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
- }
- }
- result_list.direct_order_limit = TRUE;
- }
- wide_handler->trx->direct_delete_count++;
- DBUG_PRINT("info",("spider OK"));
- DBUG_RETURN(0);
- }
-
- if (
- (
- !offset_limit
- ) &&
- do_direct_update
- ) {
- wide_handler->trx->direct_delete_count++;
- DBUG_PRINT("info",("spider OK"));
- DBUG_RETURN(0);
- }
- DBUG_PRINT("info",("spider FALSE by default"));
- do_direct_update = FALSE;
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-}
-#else
int ha_spider::direct_delete_rows_init()
{
st_select_lex *select_lex;
@@ -10466,24 +8629,6 @@ int ha_spider::direct_delete_rows_init()
THD *thd = wide_handler->trx->thd;
DBUG_ENTER("ha_spider::direct_delete_rows_init");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- DBUG_RETURN(pre_direct_init_result);
- }
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->direct_delete_rows_init());
- }
-#endif
if (!dml_inited)
{
if (unlikely(dml_init()))
@@ -10499,15 +8644,11 @@ int ha_spider::direct_delete_rows_init()
wide_handler->cond_check = FALSE;
spider_get_select_limit(this, &select_lex, &select_limit, &offset_limit);
if (
-#if MYSQL_VERSION_ID < 50500
- !thd->variables.engine_condition_pushdown ||
-#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else
!(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
-#endif
!select_lex ||
select_lex->table_list.elements != 1 ||
check_direct_delete_sql_part(select_lex, select_limit, offset_limit) ||
@@ -10536,71 +8677,9 @@ int ha_spider::direct_delete_rows_init()
DBUG_PRINT("info",("spider OK"));
DBUG_RETURN(0);
}
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int ha_spider::pre_direct_delete_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted
-) {
- int error_num;
- DBUG_ENTER("ha_spider::pre_direct_delete_rows_init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (bulk_access_started)
- {
- error_num = bulk_access_link_current->spider->
- pre_direct_delete_rows_init(
- mode, ranges, range_count, sorted);
- bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
- bulk_access_link_current->called = TRUE;
- DBUG_RETURN(error_num);
- }
- if (!dml_inited)
- {
- if (unlikely((error_num = dml_init())))
- {
- DBUG_RETURN(error_num);
- }
- }
- pre_direct_init_result = direct_delete_rows_init(
- mode, ranges, range_count, sorted);
- DBUG_RETURN(pre_direct_init_result);
-}
-#else
-int ha_spider::pre_direct_delete_rows_init()
-{
- int error_num;
- DBUG_ENTER("ha_spider::pre_direct_delete_rows_init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (bulk_access_started)
- {
- error_num = bulk_access_link_current->spider->
- pre_direct_delete_rows_init();
- bulk_access_link_current->spider->bulk_access_pre_called = TRUE;
- bulk_access_link_current->called = TRUE;
- DBUG_RETURN(error_num);
- }
- if (!dml_inited)
- {
- if (unlikely((error_num = dml_init())))
- {
- DBUG_RETURN(error_num);
- }
- }
- pre_direct_init_result = direct_delete_rows_init();
- DBUG_RETURN(pre_direct_init_result);
-}
-#endif
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
int ha_spider::direct_delete_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
ha_rows *delete_rows
) {
int error_num;
@@ -10614,78 +8693,6 @@ int ha_spider::direct_delete_rows(
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- bulk_access_pre_called = FALSE;
- DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows));
- }
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_delete_rows(
- ranges, range_count, sorted, delete_rows));
- }
-#endif
- if (
- (active_index != MAX_KEY && (error_num = index_handler_init())) ||
- (active_index == MAX_KEY && (error_num = rnd_handler_init())) ||
- (error_num = spider_db_direct_delete(this, table, ranges, range_count,
- delete_rows))
- )
- DBUG_RETURN(check_error_mode(error_num));
-
-#ifdef HA_CAN_BULK_ACCESS
- if (bulk_access_executing && is_bulk_access_clone)
- {
- bulk_req_exec();
- DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows));
- }
-#endif
- DBUG_RETURN(0);
-}
-#else
-int ha_spider::direct_delete_rows(
- ha_rows *delete_rows
-) {
- int error_num;
- THD *thd = ha_thd();
- backup_error_status();
- DBUG_ENTER("ha_spider::direct_delete_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- if (spider_param_read_only_mode(thd, share->read_only_mode))
- {
- my_printf_error(ER_SPIDER_READ_ONLY_NUM, ER_SPIDER_READ_ONLY_STR, MYF(0),
- table_share->db.str, table_share->table_name.str);
- DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
- }
-#ifdef HA_CAN_BULK_ACCESS
- if (
- bulk_access_executing &&
- (
- (
- !is_bulk_access_clone &&
- bulk_access_link_exec_tgt->called
- ) ||
- bulk_access_pre_called
- )
- ) {
- if (is_bulk_access_clone)
- {
- bulk_access_pre_called = FALSE;
- DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows));
- }
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->ha_direct_delete_rows(
- delete_rows));
- }
-#endif
if (
(active_index != MAX_KEY && (error_num = index_handler_init())) ||
(active_index == MAX_KEY && (error_num = rnd_handler_init())) ||
@@ -10693,42 +8700,9 @@ int ha_spider::direct_delete_rows(
)
DBUG_RETURN(check_error_mode(error_num));
-#ifdef HA_CAN_BULK_ACCESS
- if (bulk_access_executing && is_bulk_access_clone)
- {
- bulk_req_exec();
- DBUG_RETURN(spider_db_bulk_direct_update(this, delete_rows));
- }
-#endif
DBUG_RETURN(0);
}
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int ha_spider::pre_direct_delete_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- ha_rows *delete_rows
-) {
- DBUG_ENTER("ha_spider::pre_direct_delete_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_direct_delete_rows(
- ranges, range_count, sorted, delete_rows));
-}
-#else
-int ha_spider::pre_direct_delete_rows()
-{
- uint delete_rows;
- DBUG_ENTER("ha_spider::pre_direct_delete_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(bulk_access_link_current->spider->ha_direct_delete_rows(
- &delete_rows));
-}
-#endif
-#endif
-#endif
int ha_spider::delete_all_rows()
{
@@ -10745,9 +8719,7 @@ int ha_spider::delete_all_rows()
table_share->db.str, table_share->table_name.str);
DBUG_RETURN(ER_SPIDER_READ_ONLY_NUM);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
sql_kinds = SPIDER_SQL_KIND_SQL;
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
sql_kind[roop_count] = SPIDER_SQL_KIND_SQL;
@@ -10788,9 +8760,7 @@ int ha_spider::truncate()
{
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
do_direct_update = FALSE;
-#endif
sql_kinds = SPIDER_SQL_KIND_SQL;
for (roop_count = 0; roop_count < (int) share->link_count; roop_count++)
sql_kind[roop_count] = SPIDER_SQL_KIND_SQL;
@@ -10813,59 +8783,6 @@ int ha_spider::truncate()
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-void ha_spider::bulk_req_exec()
-{
- int need_mon;
- SPIDER_CONN *conn = wide_handler->trx->bulk_access_conn_first;
- DBUG_ENTER("ha_spider::bulk_req_exec");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider trx=%p", wide_handler->trx));
- DBUG_PRINT("info",("spider first_conn=%p", conn));
- while (conn)
- {
- DBUG_PRINT("info",("spider conn=%p", conn));
- DBUG_PRINT("info",("spider conn->bulk_access_requests=%u",
- conn->bulk_access_requests));
- if (conn->bulk_access_requests)
- {
- spider_bg_conn_wait(conn);
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &need_mon;
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- /* currently only used for HS */
- conn->bulk_access_error_num = 0;
- if (spider_db_query(
- conn,
- NULL,
- 0,
- -1,
- &need_mon)
- ) {
- conn->bulk_access_error_num = spider_db_errorno(conn);
- }
-/*
- conn->bulk_access_sended += conn->bulk_access_requests;
-*/
- conn->bulk_access_requests = 0;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- conn = conn->bulk_access_next;
- }
- wide_handler->trx->bulk_access_conn_first = NULL;
- DBUG_VOID_RETURN;
-}
-#endif
double ha_spider::scan_time()
{
@@ -11005,16 +8922,11 @@ int ha_spider::create(
memset((void*)&tmp_share, 0, sizeof(SPIDER_SHARE));
tmp_share.table_name = (char*) name;
tmp_share.table_name_length = strlen(name);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
tmp_share.table_name_hash_value = my_calc_hash(&trx->trx_alter_table_hash,
(uchar*) tmp_share.table_name, tmp_share.table_name_length);
tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
name, tmp_share.table_name_length, tmp_share.table_name_hash_value,
FALSE, TRUE, &error_num);
-#else
- tmp_share.lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
- name, tmp_share.table_name_length, FALSE, TRUE, &error_num);
-#endif
if (!tmp_share.lgtm_tblhnd_share)
{
goto error;
@@ -11040,9 +8952,7 @@ int ha_spider::create(
tmp_share.key_hint[roop_count].init_calc_mem(85);
DBUG_PRINT("info",("spider tmp_share.key_hint=%p", tmp_share.key_hint));
if ((error_num = spider_parse_connect_info(&tmp_share, form->s,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
form->part_info,
-#endif
1)))
goto error;
DBUG_PRINT("info",("spider tmp_table=%d", form->s->tmp_table));
@@ -11058,7 +8968,6 @@ int ha_spider::create(
) {
goto error;
}
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
if (
thd->lex->create_info.or_replace() &&
(error_num = spider_delete_tables(
@@ -11066,7 +8975,6 @@ int ha_spider::create(
) {
goto error;
}
-#endif
if (
(error_num = spider_insert_tables(table_tables, &tmp_share))
) {
@@ -11084,16 +8992,10 @@ int ha_spider::create(
spider_free_trx_alter_table(trx);
trx->query_id = thd->query_id;
}
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(alter_table =
(SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value(
&trx->trx_alter_table_hash, tmp_share.table_name_hash_value,
(uchar*) tmp_share.table_name, tmp_share.table_name_length)))
-#else
- if (!(alter_table =
- (SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash,
- (uchar*) tmp_share.table_name, tmp_share.table_name_length)))
-#endif
{
if ((error_num = spider_create_trx_alter_table(trx, &tmp_share, TRUE)))
goto error;
@@ -11218,12 +9120,10 @@ int ha_spider::rename_table(
) {
int error_num, roop_count, old_link_count, from_len = strlen(from),
to_len = strlen(to), tmp_error_num;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type from_hash_value = my_calc_hash(&spider_open_tables,
(uchar*) from, from_len);
my_hash_value_type to_hash_value = my_calc_hash(&spider_open_tables,
(uchar*) to, to_len);
-#endif
THD *thd = ha_thd();
uint sql_command = thd_sql_command(thd);
SPIDER_TRX *trx;
@@ -11391,22 +9291,12 @@ int ha_spider::rename_table(
}
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
from, from_len, from_hash_value, TRUE, FALSE, &error_num);
-#else
- from_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
- from, from_len, TRUE, FALSE, &error_num);
-#endif
if (from_lgtm_tblhnd_share)
{
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
to, to_len, to_hash_value, TRUE, TRUE, &error_num);
-#else
- to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
- to, to_len, TRUE, TRUE, &error_num);
-#endif
if (!to_lgtm_tblhnd_share)
{
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
@@ -11432,13 +9322,8 @@ error:
spider_close_sys_table(current_thd, table_tables,
&open_tables_backup, need_lock);
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
to, to_len, to_hash_value, TRUE, FALSE, &tmp_error_num);
-#else
- to_lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
- to, to_len, TRUE, FALSE, &tmp_error_num);
-#endif
if (to_lgtm_tblhnd_share)
spider_free_lgtm_tblhnd_share_alloc(to_lgtm_tblhnd_share, TRUE);
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
@@ -11486,22 +9371,14 @@ int ha_spider::delete_table(
{
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
int roop_count, old_link_count = 0, name_len = strlen(name);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) name, name_len);
-#endif
if (
sql_command == SQLCOM_ALTER_TABLE &&
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
(alter_table =
(SPIDER_ALTER_TABLE*) my_hash_search_using_hash_value(
&trx->trx_alter_table_hash,
hash_value, (uchar*) name, name_len)) &&
-#else
- (alter_table =
- (SPIDER_ALTER_TABLE*) my_hash_search(&trx->trx_alter_table_hash,
- (uchar*) name, name_len)) &&
-#endif
alter_table->now_create
)
DBUG_RETURN(0);
@@ -11554,13 +9431,8 @@ int ha_spider::delete_table(
}
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
name, name_len, hash_value, TRUE, FALSE, &error_num);
-#else
- lgtm_tblhnd_share = spider_get_lgtm_tblhnd_share(
- name, name_len, TRUE, FALSE, &error_num);
-#endif
if (lgtm_tblhnd_share)
spider_free_lgtm_tblhnd_share_alloc(lgtm_tblhnd_share, TRUE);
pthread_mutex_unlock(&spider_lgtm_tblhnd_share_mutex);
@@ -11709,12 +9581,6 @@ Field *ha_spider::field_exchange(
Field *field
) {
DBUG_ENTER("ha_spider::field_exchange");
-#ifdef HA_CAN_BULK_ACCESS
- if (is_bulk_access_clone)
- {
- DBUG_RETURN(pt_clone_source_handler->field_exchange(field));
- }
-#endif
DBUG_PRINT("info",("spider in field=%p", field));
DBUG_PRINT("info",("spider in field->table=%p", field->table));
DBUG_PRINT("info",("spider table=%p", table));
@@ -11728,7 +9594,6 @@ const COND *ha_spider::cond_push(
const COND *cond
) {
DBUG_ENTER("ha_spider::cond_push");
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_COND_PUSH &&
wide_handler->stage_executor != this)
@@ -11737,7 +9602,6 @@ const COND *ha_spider::cond_push(
}
wide_handler->stage = SPD_HND_STAGE_COND_PUSH;
wide_handler->stage_executor = this;
-#endif
wide_handler->cond_check = FALSE;
if (cond)
{
@@ -11756,7 +9620,6 @@ const COND *ha_spider::cond_push(
void ha_spider::cond_pop()
{
DBUG_ENTER("ha_spider::cond_pop");
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_COND_POP &&
wide_handler->stage_executor != this)
@@ -11765,7 +9628,6 @@ void ha_spider::cond_pop()
}
wide_handler->stage = SPD_HND_STAGE_COND_POP;
wide_handler->stage_executor = this;
-#endif
if (wide_handler->condition)
{
SPIDER_CONDITION *tmp_cond = wide_handler->condition->next;
@@ -11782,7 +9644,6 @@ int ha_spider::info_push(
int error_num = 0;
DBUG_ENTER("ha_spider::info_push");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
wide_handler->stage == SPD_HND_STAGE_INFO_PUSH &&
wide_handler->stage_executor != this)
@@ -11791,45 +9652,16 @@ int ha_spider::info_push(
}
wide_handler->stage = SPD_HND_STAGE_INFO_PUSH;
wide_handler->stage_executor = this;
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- if (
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-#endif
- info_type != INFO_KIND_BULK_ACCESS_BEGIN &&
- info_type != INFO_KIND_BULK_ACCESS_CURRENT &&
- info_type != INFO_KIND_BULK_ACCESS_END
- ) {
- if (!is_bulk_access_clone)
- {
- if (
- bulk_access_executing &&
- bulk_access_link_exec_tgt->called
- ) {
- DBUG_RETURN(bulk_access_link_exec_tgt->spider->info_push(info_type,
- info));
- } else if (bulk_access_started)
- {
- DBUG_RETURN(bulk_access_link_current->spider->info_push(info_type,
- info));
- }
- }
- }
-#endif
-#if defined(HANDLER_HAS_DIRECT_UPDATE_ROWS) || defined(HA_CAN_BULK_ACCESS)
switch (info_type)
{
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef INFO_KIND_UPDATE_FIELDS
case INFO_KIND_UPDATE_FIELDS:
DBUG_PRINT("info",("spider INFO_KIND_UPDATE_FIELDS"));
wide_handler->direct_update_fields = (List<Item> *) info;
wide_handler->update_request = TRUE;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (wide_handler->keyread && check_partitioned())
wide_handler->keyread = FALSE;
-#endif
break;
#endif
#ifdef INFO_KIND_UPDATE_VALUES
@@ -11848,74 +9680,12 @@ int ha_spider::info_push(
wide_handler->info_limit = 9223372036854775807LL;
break;
#endif
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- case INFO_KIND_BULK_ACCESS_BEGIN:
- DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_BEGIN"));
- if (partition_handler && partition_handler->handlers)
- {
- size_t roop_count;
- ha_spider **handlers = partition_handler->handlers;
- for (roop_count = 0; roop_count < partition_handler->no_parts;
- ++roop_count)
- {
- if ((error_num = handlers[roop_count]->bulk_access_begin(info)))
- {
- DBUG_RETURN(error_num);
- }
- }
- } else {
- if ((error_num = bulk_access_begin(info)))
- {
- DBUG_RETURN(error_num);
- }
- }
- break;
- case INFO_KIND_BULK_ACCESS_CURRENT:
- DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_CURRENT"));
- if (partition_handler && partition_handler->handlers)
- {
- size_t roop_count;
- ha_spider **handlers = partition_handler->handlers;
- for (roop_count = 0; roop_count < partition_handler->no_parts;
- ++roop_count)
- {
- if ((error_num = handlers[roop_count]->bulk_access_current(info)))
- {
- DBUG_RETURN(error_num);
- }
- }
- } else {
- if ((error_num = bulk_access_current(info)))
- {
- DBUG_RETURN(error_num);
- }
- }
- break;
- case INFO_KIND_BULK_ACCESS_END:
- DBUG_PRINT("info",("spider INFO_KIND_BULK_ACCESS_END"));
- if (partition_handler && partition_handler->handlers)
- {
- size_t roop_count;
- ha_spider **handlers = partition_handler->handlers;
- for (roop_count = 0; roop_count < partition_handler->no_parts;
- ++roop_count)
- {
- handlers[roop_count]->bulk_access_end();
- }
- } else {
- bulk_access_end();
- }
- break;
-#endif
default:
break;
}
-#endif
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
void ha_spider::return_record_by_parent()
{
DBUG_ENTER("ha_spider::return_record_by_parent");
@@ -11923,7 +9693,6 @@ void ha_spider::return_record_by_parent()
spider_db_refetch_for_item_sum_funcs(this);
DBUG_VOID_RETURN;
}
-#endif
TABLE *ha_spider::get_table()
{
@@ -12156,15 +9925,11 @@ void ha_spider::set_select_column_mode()
if (wide_handler->external_lock_type == F_WRLCK &&
wide_handler->sql_command != SQLCOM_SELECT)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
uint part_num = 0;
if (wide_handler->update_request)
part_num = check_partitioned();
-#endif
if (
-#ifdef WITH_PARTITION_STORAGE_ENGINE
part_num ||
-#endif
table_share->primary_key == MAX_KEY
) {
/* need all columns */
@@ -12195,7 +9960,6 @@ void ha_spider::set_select_column_mode()
DBUG_VOID_RETURN;
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
void ha_spider::check_select_column(bool rnd)
{
THD *thd = wide_handler->trx->thd;
@@ -12254,7 +10018,6 @@ void ha_spider::check_select_column(bool rnd)
}
DBUG_VOID_RETURN;
}
-#endif
bool ha_spider::check_and_start_bulk_update(
spider_bulk_upd_start bulk_upd_start
@@ -12278,11 +10041,7 @@ bool ha_spider::check_and_start_bulk_update(
*/
result_list.bulk_update_size = spider_param_bulk_update_size(thd,
share->bulk_update_size);
-/*
-#ifndef WITHOUT_SPIDER_BG_SEARCH
- int bgs_mode = spider_param_bgs_mode(thd, share->bgs_mode);
-#endif
-*/
+
if (!support_bulk_update_sql())
{
result_list.bulk_update_mode = 0;
@@ -12290,9 +10049,6 @@ bool ha_spider::check_and_start_bulk_update(
result_list.bulk_update_mode));
/*
} else if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
- bgs_mode ||
-#endif
split_read != 9223372036854775807LL
) {
result_list.bulk_update_mode = 2;
@@ -12736,9 +10492,7 @@ int ha_spider::index_handler_init()
roop_end = search_link_idx + 1;
}
sql_kinds = 0;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
direct_update_kinds = 0;
-#endif
for (roop_count = roop_start; roop_count < roop_end;
roop_count = spider_conn_link_idx_next(share->link_statuses,
conn_link_idx, roop_count, share->link_count,
@@ -12824,9 +10578,7 @@ int ha_spider::rnd_handler_init()
roop_end = search_link_idx + 1;
}
sql_kinds = 0;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
direct_update_kinds = 0;
-#endif
for (roop_count = roop_start; roop_count < roop_end;
roop_count = spider_conn_link_idx_next(share->link_statuses,
conn_link_idx, roop_count, share->link_count,
@@ -13015,11 +10767,7 @@ void ha_spider::check_pre_call(
) ||
(
(skip_parallel_search & 2) &&
-#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
lex->sql_cache == LEX::SQL_NO_CACHE // for mysqldump
-#else
- select_lex && select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE // for mysqldump
-#endif
)
) {
use_pre_call = FALSE;
@@ -13049,7 +10797,6 @@ void ha_spider::check_pre_call(
DBUG_VOID_RETURN;
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
void ha_spider::check_insert_dup_update_pushdown()
{
THD *thd = wide_handler->trx->thd;
@@ -13068,147 +10815,7 @@ void ha_spider::check_insert_dup_update_pushdown()
}
DBUG_VOID_RETURN;
}
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-SPIDER_BULK_ACCESS_LINK *ha_spider::create_bulk_access_link()
-{
- uchar *ref;
- ha_spider *spider;
- SPIDER_BULK_ACCESS_LINK *bulk_access_link;
- DBUG_ENTER("ha_spider::create_bulk_access_link");
- DBUG_PRINT("info",("spider this=%p", this));
-/*
- if (!init_ha_mem_root)
- {
- SPD_INIT_ALLOC_ROOT(&ha_mem_root, sizeof(ha_spider) * 16,
- sizeof(ha_spider) * 16, MYF(MY_WME));
- init_ha_mem_root = TRUE;
- }
-*/
- if (!(bulk_access_link = (SPIDER_BULK_ACCESS_LINK *)
- spider_bulk_malloc(spider_current_trx, 168, MYF(MY_WME),
- &bulk_access_link, (uint) (sizeof(SPIDER_BULK_ACCESS_LINK)),
- &ref, (uint) (ALIGN_SIZE(ref_length) * 2),
- NullS))
- ) {
- goto error_bulk_malloc;
- }
- SPD_INIT_ALLOC_ROOT(&bulk_access_link->mem_root, sizeof(ha_spider), 0,
- MYF(MY_WME));
-/*
- if (!(spider = new ha_spider(spider_hton_ptr, table_share)))
- if (!(spider = (ha_spider *) spider_create_handler(
- spider_hton_ptr, table_share, &ha_mem_root)))
-*/
- if (!(spider = (ha_spider *) spider_create_handler(
- spider_hton_ptr, table_share, &bulk_access_link->mem_root)))
- {
- goto error_new_spider;
- }
- DBUG_PRINT("info",("spider spider=%p", spider));
- bulk_access_link->spider = spider;
- spider->ref = ref;
- bulk_access_link->next = NULL;
- spider->is_clone = TRUE;
- spider->is_bulk_access_clone = TRUE;
- spider->pt_clone_source_handler = this;
- if (spider->ha_open(table, share->table_name, table->db_stat,
- HA_OPEN_IGNORE_IF_LOCKED))
- {
- goto error_ha_open;
- }
- DBUG_RETURN(bulk_access_link);
-
-error_ha_open:
- delete spider;
-error_new_spider:
- free_root(&bulk_access_link->mem_root, MYF(0));
- spider_free(spider_current_trx, bulk_access_link, MYF(0));
-error_bulk_malloc:
- DBUG_RETURN(NULL);
-}
-
-void ha_spider::delete_bulk_access_link(
- SPIDER_BULK_ACCESS_LINK *bulk_access_link
-) {
- ha_spider *spider = bulk_access_link->spider;
- DBUG_ENTER("ha_spider::delete_bulk_access_link");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider spider=%p", spider));
- DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
- spider->dbton_handler));
- DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p",
- &spider->dbton_handler));
- spider->close();
- delete spider;
- free_root(&bulk_access_link->mem_root, MYF(0));
- spider_free(spider_current_trx, bulk_access_link, MYF(0));
- DBUG_VOID_RETURN;
-}
-
-int ha_spider::sync_from_clone_source(
- ha_spider *spider
-) {
- int error_num;
- DBUG_ENTER("ha_spider::sync_from_clone_source");
- sync_from_clone_source_base(spider);
- if (!synced_from_clone_source)
- {
- DBUG_PRINT("info",("spider synced from clone source all"));
- wide_handler->trx = spider->wide_handler->trx;
- sql_command = spider->sql_command;
- wide_handler->external_lock_type =
- spider->wide_handler->external_lock_type;
- selupd_lock_mode = spider->selupd_lock_mode;
- update_request = spider->update_request;
- lock_mode = spider->lock_mode;
- high_priority = spider->high_priority;
- low_priority = spider->low_priority;
- memcpy(conns, spider->conns,
- sizeof(SPIDER_CONN *) * share->link_count);
- spider_thread_id = spider->spider_thread_id;
- trx_conn_adjustment = spider->trx_conn_adjustment;
- search_link_idx = spider->search_link_idx;
- external_lock_cnt = spider->external_lock_cnt;
- uint roop_count, dbton_id;
- spider_db_handler *dbton_hdl, *dbton_hdl2;
- for (roop_count = 0; roop_count < share->use_dbton_count; roop_count++)
- {
- dbton_id = share->use_dbton_ids[roop_count];
- dbton_hdl = dbton_handler[dbton_id];
- dbton_hdl2 = spider->dbton_handler[dbton_id];
- dbton_hdl->sync_from_clone_source(dbton_hdl2);
- }
- synced_from_clone_source = TRUE;
- } else if (external_lock_cnt != spider->external_lock_cnt)
- {
- DBUG_PRINT("info",("spider synced from clone source"));
- sql_command = spider->sql_command;
- wide_handler->external_lock_type =
- spider->wide_handler->external_lock_type;
- selupd_lock_mode = spider->selupd_lock_mode;
- update_request = spider->update_request;
- lock_mode = spider->lock_mode;
- high_priority = spider->high_priority;
- low_priority = spider->low_priority;
-
- if ((error_num = spider_check_trx_and_get_conn(
- spider->wide_handler->trx->thd,
- this, TRUE)))
- {
- DBUG_RETURN(error_num);
- }
- external_lock_cnt = spider->external_lock_cnt;
- }
-
- DBUG_PRINT("info",("spider bulk_access_link->spider->dbton_handler=%p",
- dbton_handler));
- DBUG_PRINT("info",("spider ptr bulk_access_link->spider->dbton_handler=%p",
- &dbton_handler));
- DBUG_RETURN(0);
-}
-#endif
void ha_spider::sync_from_clone_source_base(
ha_spider *spider
@@ -13463,7 +11070,6 @@ int ha_spider::append_update_set_sql_part()
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int ha_spider::append_direct_update_set_sql_part()
{
int error_num;
@@ -13483,9 +11089,7 @@ int ha_spider::append_direct_update_set_sql_part()
}
DBUG_RETURN(0);
}
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int ha_spider::append_dup_update_pushdown_sql_part(
const char *alias,
uint alias_length
@@ -13551,7 +11155,6 @@ int ha_spider::check_update_columns_sql_part()
}
DBUG_RETURN(0);
}
-#endif
int ha_spider::append_delete_sql_part()
{
@@ -13959,7 +11562,6 @@ int ha_spider::append_condition_sql_part(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int ha_spider::append_sum_select_sql_part(
ulong sql_type,
const char *alias,
@@ -13984,7 +11586,6 @@ int ha_spider::append_sum_select_sql_part(
wide_handler->trx->direct_aggregate_count++;
DBUG_RETURN(0);
}
-#endif
int ha_spider::append_match_select_sql_part(
ulong sql_type,
@@ -14042,7 +11643,6 @@ void ha_spider::set_order_to_pos_sql(
DBUG_VOID_RETURN;
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int ha_spider::append_group_by_sql_part(
const char *alias,
uint alias_length,
@@ -14066,7 +11666,6 @@ int ha_spider::append_group_by_sql_part(
}
DBUG_RETURN(0);
}
-#endif
int ha_spider::append_key_order_for_merge_with_alias_sql_part(
const char *alias,
@@ -14077,7 +11676,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_for_merge_with_alias_sql_part");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (result_list.direct_aggregate)
{
st_select_lex *select_lex = spider_get_select_lex(this);
@@ -14088,7 +11686,6 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
DBUG_RETURN(0);
}
}
-#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
@@ -14138,7 +11735,6 @@ int ha_spider::append_key_order_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_with_alias_sql_part");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (result_list.direct_aggregate)
{
st_select_lex *select_lex = spider_get_select_lex(this);
@@ -14149,7 +11745,6 @@ int ha_spider::append_key_order_with_alias_sql_part(
DBUG_RETURN(0);
}
}
-#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
@@ -14782,13 +12377,8 @@ int ha_spider::bulk_tmp_table_rnd_next()
if (tmp_table[roop_count])
{
if (
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
!(error_num = tmp_table[roop_count]->file->ha_rnd_next(
tmp_table[roop_count]->record[0]))
-#else
- !(error_num = tmp_table[roop_count]->file->rnd_next(
- tmp_table[roop_count]->record[0]))
-#endif
) {
DBUG_RETURN(error_num);
}
@@ -15362,102 +12952,11 @@ int ha_spider::dml_init()
conns[roop_count]->semi_trx_isolation = -1;
}
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
if (wide_handler->insert_with_update)
{
check_insert_dup_update_pushdown();
}
-#endif
dml_inited = TRUE;
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int ha_spider::bulk_access_begin(
- void *info
-) {
- DBUG_ENTER("ha_spider::bulk_access_begin");
- DBUG_PRINT("info",("spider this=%p", this));
- if (bulk_access_started)
- {
- if (!bulk_access_link_current->next)
- {
- if (!(bulk_access_link_current->next = create_bulk_access_link()))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- bulk_access_link_current->next->sequence_num =
- bulk_access_link_current->sequence_num + 1;
- }
- bulk_access_link_current = bulk_access_link_current->next;
- } else {
- if (!bulk_access_link_first)
- {
- if (!(bulk_access_link_first = create_bulk_access_link()))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- bulk_access_link_first->sequence_num = 0;
- }
- bulk_access_link_current = bulk_access_link_first;
- bulk_access_started = TRUE;
- bulk_access_executing = FALSE;
- }
- bulk_access_link_current->spider->
- check_access_kind(wide_handler->trx->thd);
- if (
- (error_num = bulk_access_link_current->spider->
- sync_from_clone_source(this)) ||
- (error_num = bulk_access_link_current->spider->
- check_access_kind_for_connection(wide_handler->trx->thd,
- (lock_type >= TL_WRITE_ALLOW_WRITE)))
- ) {
- DBUG_RETURN(error_num);
- }
- bulk_access_link_current->spider->bulk_access_executing = FALSE;
- bulk_access_link_current->spider->bulk_access_pre_called = FALSE;
- bulk_access_link_current->used = TRUE;
- bulk_access_link_current->called = FALSE;
- *((void **) info) = bulk_access_link_current;
- DBUG_RETURN(0);
-}
-
-int ha_spider::bulk_access_current(
- void *info
-) {
- DBUG_ENTER("ha_spider::bulk_access_current");
- DBUG_PRINT("info",("spider this=%p", this));
- bulk_access_executing = TRUE;
- bulk_access_link_exec_tgt = (SPIDER_BULK_ACCESS_LINK *) info;
- if (bulk_access_link_exec_tgt->spider->pt_clone_source_handler != this)
- {
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider pt_clone_source_handler=%p",
- bulk_access_link_exec_tgt->spider->pt_clone_source_handler));
- /* partitioned */
- uint sequence_num = bulk_access_link_exec_tgt->sequence_num;
- for (
- bulk_access_link_exec_tgt = bulk_access_link_first;
- bulk_access_link_exec_tgt;
- bulk_access_link_exec_tgt = bulk_access_link_exec_tgt->next
- ) {
- if (bulk_access_link_exec_tgt->sequence_num >= sequence_num)
- {
- DBUG_ASSERT(
- bulk_access_link_exec_tgt->sequence_num == sequence_num);
- break;
- }
- }
- }
- bulk_access_link_exec_tgt->spider->bulk_access_executing = TRUE;
- DBUG_RETURN(0);
-}
-
-void ha_spider::bulk_access_end()
-{
- DBUG_ENTER("ha_spider::bulk_access_end");
- DBUG_PRINT("info",("spider this=%p", this));
- bulk_access_started = FALSE;
- DBUG_VOID_RETURN;
-}
-#endif
diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h
index cd847760bcf..579700d855b 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -79,27 +79,10 @@ public:
spider_string *blob_buff;
SPIDER_POSITION *pushed_pos;
SPIDER_POSITION pushed_pos_buf;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER *partition_handler;
-#endif
bool wide_handler_owner = FALSE;
SPIDER_WIDE_HANDLER *wide_handler = NULL;
-#ifdef HA_CAN_BULK_ACCESS
- int pre_direct_init_result;
- bool is_bulk_access_clone;
- bool synced_from_clone_source;
- bool bulk_access_started;
- bool bulk_access_executing;
- bool bulk_access_pre_called;
- SPIDER_BULK_ACCESS_LINK *bulk_access_link_first;
- SPIDER_BULK_ACCESS_LINK *bulk_access_link_current;
- SPIDER_BULK_ACCESS_LINK *bulk_access_link_exec_tgt;
-/*
- bool init_ha_mem_root;
- MEM_ROOT ha_mem_root;
-*/
-#endif
bool is_clone;
ha_spider *pt_clone_source_handler;
ha_spider *pt_clone_last_searcher;
@@ -111,31 +94,21 @@ public:
bool da_status;
bool use_spatial_index;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
uint idx_for_direct_join;
bool use_fields;
spider_fields *fields;
SPIDER_LINK_IDX_CHAIN *link_idx_chain;
SPIDER_LINK_IDX_CHAIN *result_link_idx_chain;
-#endif
/* for mrr */
bool mrr_with_cnt;
uint multi_range_cnt;
uint multi_range_hit_point;
-#ifdef HA_MRR_USE_DEFAULT_IMPL
int multi_range_num;
bool have_second_range;
KEY_MULTI_RANGE mrr_second_range;
spider_string *mrr_key_buff;
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
range_id_t *multi_range_keys;
-#else
- char **multi_range_keys;
-#endif
-#else
- KEY_MULTI_RANGE *multi_range_ranges;
-#endif
char *append_tblnm_alias;
uint append_tblnm_alias_length;
@@ -148,9 +121,7 @@ public:
bool use_pre_action;
bool pre_bitmap_checked;
bool bulk_insert;
-#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
bool info_auto_called;
-#endif
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool auto_inc_temporary;
#endif
@@ -170,21 +141,15 @@ public:
uchar *m_handler_opened;
uint *m_handler_id;
char **m_handler_cid;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool do_direct_update;
uint direct_update_kinds;
-#endif
spider_index_rnd_init prev_index_rnd_init;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
SPIDER_ITEM_HLD *direct_aggregate_item_first;
SPIDER_ITEM_HLD *direct_aggregate_item_current;
-#endif
ha_rows table_rows;
-#ifdef HA_HAS_CHECKSUM_EXTENDED
ha_checksum checksum_val;
bool checksum_null;
uint action_flags;
-#endif
/* for fulltext search */
bool ft_init_and_first;
@@ -226,12 +191,6 @@ public:
void check_access_kind(
THD *thd
);
-#ifdef HA_CAN_BULK_ACCESS
- int additional_lock(
- THD *thd,
- enum thr_lock_type lock_type
- );
-#endif
THR_LOCK_DATA **store_lock(
THD *thd,
THR_LOCK_DATA **to,
@@ -253,16 +212,7 @@ public:
uint idx,
bool sorted
);
-#ifdef HA_CAN_BULK_ACCESS
- int pre_index_init(
- uint idx,
- bool sorted
- );
-#endif
int index_end();
-#ifdef HA_CAN_BULK_ACCESS
- int pre_index_end();
-#endif
int index_read_map(
uchar *buf,
const uchar *key,
@@ -300,8 +250,6 @@ public:
int read_range_next();
void reset_no_where_cond();
bool check_no_where_cond();
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
ha_rows multi_range_read_info_const(
uint keyno,
RANGE_SEQ_IF *seq,
@@ -320,26 +268,6 @@ public:
uint *flags,
Cost_estimate *cost
);
-#else
- ha_rows multi_range_read_info_const(
- uint keyno,
- RANGE_SEQ_IF *seq,
- void *seq_init_param,
- uint n_ranges,
- uint *bufsz,
- uint *flags,
- COST_VECT *cost
- );
- ha_rows multi_range_read_info(
- uint keyno,
- uint n_ranges,
- uint keys,
- uint key_parts,
- uint *bufsz,
- uint *flags,
- COST_VECT *cost
- );
-#endif
int multi_range_read_init(
RANGE_SEQ_IF *seq,
void *seq_init_param,
@@ -347,7 +275,6 @@ public:
uint mode,
HANDLER_BUFFER *buf
);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
int multi_range_read_next(
range_id_t *range_info
);
@@ -357,41 +284,10 @@ public:
int multi_range_read_next_next(
range_id_t *range_info
);
-#else
- int multi_range_read_next(
- char **range_info
- );
- int multi_range_read_next_first(
- char **range_info
- );
- int multi_range_read_next_next(
- char **range_info
- );
-#endif
-#else
- int read_multi_range_first(
- KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- HANDLER_BUFFER *buffer
- );
- int read_multi_range_next(
- KEY_MULTI_RANGE **found_range_p
- );
-#endif
int rnd_init(
bool scan
);
-#ifdef HA_CAN_BULK_ACCESS
- int pre_rnd_init(
- bool scan
- );
-#endif
int rnd_end();
-#ifdef HA_CAN_BULK_ACCESS
- int pre_rnd_end();
-#endif
int rnd_next(
uchar *buf
);
@@ -429,20 +325,9 @@ public:
key_part_map keypart_map,
bool use_parallel
);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
int pre_multi_range_read_next(
bool use_parallel
);
-#else
- int pre_read_multi_range_first(
- KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- HANDLER_BUFFER *buffer,
- bool use_parallel
- );
-#endif
int pre_read_range_first(
const key_range *start_key,
const key_range *end_key,
@@ -464,10 +349,8 @@ public:
int check_crd();
int pre_records();
ha_rows records();
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int pre_calculate_checksum();
int calculate_checksum();
-#endif
const char *table_type() const;
ulonglong table_flags() const;
ulong table_flags_for_partition();
@@ -485,9 +368,7 @@ public:
uint max_supported_key_length() const;
uint max_supported_key_part_length() const;
uint8 table_cache_type();
-#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
bool need_info_for_auto_inc();
-#endif
#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
bool can_use_for_auto_inc_init();
#endif
@@ -503,31 +384,18 @@ public:
ulonglong value
);
void release_auto_increment();
-#ifdef SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
void start_bulk_insert(
ha_rows rows,
uint flags
);
-#else
- void start_bulk_insert(
- ha_rows rows
- );
-#endif
int end_bulk_insert();
int write_row(
const uchar *buf
);
-#ifdef HA_CAN_BULK_ACCESS
- int pre_write_row(
- uchar *buf
- );
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
void direct_update_init(
THD *thd,
bool hs_request
);
-#endif
bool start_bulk_update();
int exec_bulk_update(
ha_rows *dup_key_found
@@ -554,41 +422,11 @@ public:
uchar *new_data
);
#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool check_direct_update_sql_part(
st_select_lex *select_lex,
longlong select_limit,
longlong offset_limit
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-#ifdef SPIDER_MDEV_16246
- inline int direct_update_rows_init(
- List<Item> *update_fields
- ) {
- return direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
- }
- int direct_update_rows_init(
- List<Item> *update_fields,
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
- );
-#else
- inline int direct_update_rows_init()
- {
- return direct_update_rows_init(2, NULL, 0, FALSE, NULL);
- }
- int direct_update_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
- );
-#endif
-#else
#ifdef SPIDER_MDEV_16246
int direct_update_rows_init(
List<Item> *update_fields
@@ -596,164 +434,24 @@ public:
#else
int direct_update_rows_init();
#endif
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-#ifdef SPIDER_MDEV_16246
- inline int pre_direct_update_rows_init(
- List<Item> *update_fields
- ) {
- return pre_direct_update_rows_init(update_fields, 2, NULL, 0, FALSE, NULL);
- }
- int pre_direct_update_rows_init(
- List<Item> *update_fields,
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
- );
-#else
- inline int pre_direct_update_rows_init()
- {
- return pre_direct_update_rows_init(2, NULL, 0, FALSE, NULL);
- }
- int pre_direct_update_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data
- );
-#endif
-#else
-#ifdef SPIDER_MDEV_16246
- int pre_direct_update_rows_init(
- List<Item> *update_fields
- );
-#else
- int pre_direct_update_rows_init();
-#endif
-#endif
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows)
- {
- return direct_update_rows(NULL, 0, FALSE, NULL, update_rows, found_rows);
- }
- int direct_update_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data,
- ha_rows *update_rows,
- ha_rows *found_row
- );
-#else
int direct_update_rows(
ha_rows *update_rows,
ha_rows *found_row
);
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int pre_direct_update_rows()
- {
- ha_rows update_rows;
- ha_rows found_rows;
-
- return pre_direct_update_rows(NULL, 0, FALSE, NULL, &update_rows,
- &found_rows);
- }
- int pre_direct_update_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- uchar *new_data,
- ha_rows *update_rows,
- ha_rows *found_row
- );
-#else
- int pre_direct_update_rows();
-#endif
-#endif
-#endif
bool start_bulk_delete();
int end_bulk_delete();
int delete_row(
const uchar *buf
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool check_direct_delete_sql_part(
st_select_lex *select_lex,
longlong select_limit,
longlong offset_limit
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int direct_delete_rows_init()
- {
- return direct_delete_rows_init(2, NULL, 0, FALSE);
- }
- int direct_delete_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted
- );
-#else
int direct_delete_rows_init();
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int pre_direct_delete_rows_init()
- {
- return pre_direct_delete_rows_init(2, NULL, 0, FALSE);
- }
- int pre_direct_delete_rows_init(
- uint mode,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted
- );
-#else
- int pre_direct_delete_rows_init();
-#endif
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int direct_delete_rows(ha_rows *delete_rows)
- {
- return direct_delete_rows(NULL, 0, FALSE, delete_rows);
- }
int direct_delete_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
ha_rows *delete_rows
);
-#else
- int direct_delete_rows(
- ha_rows *delete_rows
- );
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
- inline int pre_direct_delete_rows()
- {
- ha_rows delete_rows;
-
- return pre_direct_delete_rows(NULL, 0, FALSE, &delete_rows);
- }
- int pre_direct_delete_rows(
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- ha_rows *delete_rows
- );
-#else
- int pre_direct_delete_rows();
-#endif
-#endif
-#endif
int delete_all_rows();
int truncate();
double scan_time();
@@ -762,9 +460,6 @@ public:
uint ranges,
ha_rows rows
);
-#ifdef HA_CAN_BULK_ACCESS
- void bulk_req_exec();
-#endif
const key_map *keys_to_use_for_scanning();
ha_rows estimate_rows_upper_bound();
void print_error(
@@ -836,18 +531,14 @@ public:
uint info_type,
void *info
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
void return_record_by_parent();
-#endif
TABLE *get_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
void set_clone_searched_bitmap();
void set_searched_bitmap_from_item_list();
void set_select_column_mode();
-#ifdef WITH_PARTITION_STORAGE_ENGINE
void check_select_column(bool rnd);
-#endif
bool check_and_start_bulk_update(
spider_bulk_upd_start bulk_upd_start
);
@@ -907,34 +598,12 @@ public:
bool eq_range,
bool sorted
);
-#ifdef HA_MRR_USE_DEFAULT_IMPL
-#else
- int read_multi_range_first_internal(
- uchar *buf,
- KEY_MULTI_RANGE **found_range_p,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- bool sorted,
- HANDLER_BUFFER *buffer
- );
-#endif
int ft_read_internal(uchar *buf);
int rnd_next_internal(uchar *buf);
void check_pre_call(
bool use_parallel
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
void check_insert_dup_update_pushdown();
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- SPIDER_BULK_ACCESS_LINK *create_bulk_access_link();
- void delete_bulk_access_link(
- SPIDER_BULK_ACCESS_LINK *bulk_access_link
- );
- int sync_from_clone_source(
- ha_spider *spider
- );
-#endif
void sync_from_clone_source_base(
ha_spider *spider
);
@@ -954,10 +623,7 @@ public:
int append_insert_sql_part();
int append_update_sql_part();
int append_update_set_sql_part();
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_direct_update_set_sql_part();
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_dup_update_pushdown_sql_part(
const char *alias,
uint alias_length
@@ -967,7 +633,6 @@ public:
uint alias_length
);
int check_update_columns_sql_part();
-#endif
int append_delete_sql_part();
int append_select_sql_part(
ulong sql_type
@@ -1031,13 +696,11 @@ public:
ulong sql_type,
bool test_flg
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_sql_part(
ulong sql_type,
const char *alias,
uint alias_length
);
-#endif
int append_match_select_sql_part(
ulong sql_type,
const char *alias,
@@ -1049,13 +712,11 @@ public:
void set_order_to_pos_sql(
ulong sql_type
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_sql_part(
const char *alias,
uint alias_length,
ulong sql_type
);
-#endif
int append_key_order_for_merge_with_alias_sql_part(
const char *alias,
uint alias_length,
@@ -1160,13 +821,4 @@ public:
int append_lock_tables_list();
int lock_tables();
int dml_init();
-#ifdef HA_CAN_BULK_ACCESS
- int bulk_access_begin(
- void *info
- );
- int bulk_access_current(
- void *info
- );
- void bulk_access_end();
-#endif
};
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_2.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc
deleted file mode 100644
index 74c8efa90aa..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_1.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
---source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc
deleted file mode 100644
index f42a980ad23..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_2.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
---source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc
deleted file mode 100644
index 0696fb991cf..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_child3_3.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
---source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_master_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/deinit_slave1_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_deinit_master_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc
deleted file mode 100644
index 2684829408d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_1.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc
deleted file mode 100644
index 205eaa6fe35..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_2.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc
deleted file mode 100644
index 55cb858372c..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child2_3.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc
deleted file mode 100644
index 8357f0bdbc2..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_1.inc
+++ /dev/null
@@ -1,140 +0,0 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc
deleted file mode 100644
index 3ffcec24f51..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_2.inc
+++ /dev/null
@@ -1,140 +0,0 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc
deleted file mode 100644
index 67bd00109f5..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_child3_3.inc
+++ /dev/null
@@ -1,140 +0,0 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc
deleted file mode 100644
index 8ace39ab641..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/ha_init_master_1.inc
+++ /dev/null
@@ -1,109 +0,0 @@
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $MASTER_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $MASTER_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $MASTER_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE", lst "0 2"';
-let $MASTER_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE", lst "0 1"';
-let $MASTER_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "$ORACLE_DATABASE", lst "1 0"';
-let $MASTER_1_COPY_TABLES_2_1=
- SELECT spider_copy_tables('ta_l', '0', '1');
-
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $MASTER_1_COMMENT_HA_2_1=
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE"';
- let $MASTER_1_COMMENT_HA_AS_2_1=
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "$ORACLE_DATABASE"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $MASTER_1_COMMENT_HA_2_1=
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE"';
- let $MASTER_1_COMMENT_HA_AS_2_1=
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "$ORACLE_DATABASE"';
-}
-let $MASTER_1_COMMENT_HA_P_2_1=
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $MASTER_1_COMMENT_HA_AS_P_2_1=
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $MASTER_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $MASTER_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $MASTER_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
-let $MASTER_1_COPY_TABLES_P_2_1=
- SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
-let $MASTER_1_CHECK_HA_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-let $MASTER_1_CHANGE_HA_MON=
- SELECT spider_flush_table_mon_cache();
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_deinit_master_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc
deleted file mode 100644
index f3f92a61e6f..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_1.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-let $CHILD2_1_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "hs_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc
deleted file mode 100644
index 4bd8d49c17c..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_2.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-let $CHILD2_2_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_init_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc
deleted file mode 100644
index 0ff5e2a10d9..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/hs_init_master_1.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-let $MASTER_1_HS_COMMENT_TMP=
- COMMENT='';
-let $MASTER_1_HS_COMMENT_2_1=
- COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"';
-let $MASTER_1_HS_COMMENT_P_2_1=
- COMMENT='uhr "1", uhw "1"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4)
- COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc
deleted file mode 100644
index c24736eefca..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_child2_1.inc
+++ /dev/null
@@ -1,192 +0,0 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ta_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES3=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES3=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES3=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES4=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES4=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES4=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc"
- ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES5=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES6=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES6=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES6=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ft_r2" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "gm_r2" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- "b" VARCHAR(255),
- "c" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc
deleted file mode 100644
index fd4497c0b59..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_child2_2.inc
+++ /dev/null
@@ -1,94 +0,0 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r3" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r3" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc b/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc
deleted file mode 100644
index e16dfeffd81..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_child2_3.inc
+++ /dev/null
@@ -1,15 +0,0 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-let $CHILD2_3_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"');
-let $CHILD2_3_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r4" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a")
- )', '', 'srv "s_2_3"');
-let $CHILD2_3_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"');
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc
deleted file mode 100644
index d2d308cbefe..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_child3_1.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc
deleted file mode 100644
index 3fbe1bd55bb..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_child3_2.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc b/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc
deleted file mode 100644
index 3c7aaa8af84..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_child3_3.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_master_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_master_1.inc
deleted file mode 100644
index 8e79b984364..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_master_1.inc
+++ /dev/null
@@ -1,149 +0,0 @@
---source ../include/init_spider.inc
-SET spider_direct_order_limit= 10000;
-SET spider_init_sql_alloc_size= 1;
-SET spider_conn_recycle_mode= 2;
-let $MASTER_1_COMMENT_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r", wrapper "oracle",
- pk_name "pk_s_2_1_ta_r"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD"';
-let $MASTER_1_COMMENT2_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r_no_idx", wrapper "oracle",
- pk_name "pk_s_2_1_ta_r_no_idx"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", prt "2000000"';
-let $MASTER_1_COMMENT_P_2_1=
- COMMENT='table "ta_r3"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2",
- priority "1000", pk_name "pk_s_2_1_ta_r2"',
- PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001",
- pk_name "pk_s_2_2_ta_r3"'
- );
-let $MASTER_1_COMMENT2_P_2_1=
- COMMENT='table "ta_r3"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
- table "ta_r2", priority "1000", pk_name "pk_s_2_1_ta_r2"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r3"'
- );
-let $MASTER_1_COMMENT3_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r_auto_inc",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_auto_inc"';
-let $MASTER_1_COMMENT3_P_2_1=
- COMMENT='table "s_2_1_ta_r_int"'
- PARTITION BY LIST(MOD(a, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='srv "s_2_1", priority "1000", pk_name "pk_s_2_1_ta_r_int"',
- PARTITION pt2 VALUES IN (1)
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r_int",
- table "s_2_2_ta_r_int"'
- );
-let $MASTER_1_COMMENT4_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "s_2_1_ta_r_int",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_int"';
-let $MASTER_1_COMMENT5_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r_3", wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_3"';
-let $MASTER_1_COMMENT_FT_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ft_r", wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ft_r"';
-let $MASTER_1_COMMENT2_FT_P_2_1=
- COMMENT='table "ft_r3"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
- table "ft_r2", priority "1000", pk_name "pk_s_2_1_ft_r2"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ft_r3"'
- );
-let $MASTER_1_COMMENT_GM_2_1=
- COMMENT='srv "s_2_1", table "gm_r", pk_name "pk_s_2_1_gm_r"';
-let $MASTER_1_COMMENT2_GM_P_2_1=
- COMMENT='table "gm_r3"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
- table "gm_r2", priority "1000", pk_name "pk_s_2_1_gm_r2"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_gm_r3"'
- );
-let $MASTER_1_COMMENT_LOCK1=
- COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2",
- pk_name "pk_s_2_1_t1_1 pk_s_2_2_t1_2"';
-let $MASTER_1_COMMENT_LOCK2=
- COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1",
- pk_name "pk_s_2_2_t2_1 pk_s_2_1_t2_2"';
-let $MASTER_1_COMMENT_INCREMENT1_1=
- COMMENT 'aim "0", tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"';
-let $MASTER_1_COMMENT_INCREMENT1_P_1=
- COMMENT 'aim "0"'
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"',
- PARTITION pt2 VALUES IN (1)
- COMMENT='tbl "t1_2", srv "s_2_2", pk_name "pk_s_2_2_t1_2"'
- );
-let $MASTER_1_COMMENT_READONLY1_1=
- COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1",
- pk_name "pk_s_2_1_t1_1"';
-let $MASTER_1_COMMENT_ERROR_MODE1_1=
- COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1",
- pk_name "pk_s_2_1_ter1_1"';
-let $MASTER_1_COMMENT_TEXT_PK1_1=
- COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"';
-let $MASTER_1_COMMENT_TEXT_KEY1_1=
- COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"';
-let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-let $MASTER_1_CHECK_DIRECT_DELETE_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%';
-let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-let $MASTER_1_AUTO_INCREMENT_INCREMENT1=
- SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_INCREMENT2=
- SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_OFFSET1=
- SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_OFFSET2=
- SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_OFFSET3=
- SET SESSION AUTO_INCREMENT_OFFSET = 1;
-let $MASTER_1_AUTO_INCREMENT_OFFSET4=
- SET SESSION AUTO_INCREMENT_OFFSET = 777;
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc
deleted file mode 100644
index 73c3c6b9ef2..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_slave1_1.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
diff --git a/storage/spider/mysql-test/spider/oracle/include/init_spider.inc b/storage/spider/mysql-test/spider/oracle/include/init_spider.inc
deleted file mode 100644
index ff9ac9aee29..00000000000
--- a/storage/spider/mysql-test/spider/oracle/include/init_spider.inc
+++ /dev/null
@@ -1,105 +0,0 @@
---source ../../include/init_spider.inc
-let $VERSION_COMPILE_OS_WIN=
- `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`;
-if ($VERSION_COMPILE_OS_WIN)
-{
- eval DROP SERVER s_2_1;
- eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_2;
- eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_3;
- eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_3_1;
- eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- PORT $CHILD3_1_MYPORT
- );
- eval DROP SERVER s_3_2;
- eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- PORT $CHILD3_2_MYPORT
- );
- eval DROP SERVER s_3_3;
- eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- PORT $CHILD2_3_MYPORT
- );
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- eval DROP SERVER s_2_1;
- eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_2;
- eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_3;
- eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_3_1;
- eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- SOCKET '$CHILD3_1_MYSOCK'
- );
- eval DROP SERVER s_3_2;
- eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- SOCKET '$CHILD3_2_MYSOCK'
- );
- eval DROP SERVER s_3_3;
- eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- SOCKET '$CHILD3_3_MYSOCK'
- );
-}
diff --git a/storage/spider/mysql-test/spider/oracle/my.cnf b/storage/spider/mysql-test/spider/oracle/my.cnf
deleted file mode 100644
index efa05c8e8b0..00000000000
--- a/storage/spider/mysql-test/spider/oracle/my.cnf
+++ /dev/null
@@ -1,146 +0,0 @@
-# Use default setting for mysqld processes
-!include include/default_mysqld.cnf
-
-[mysqld.1.1]
-log-bin= master-bin
-loose_handlersocket_port= 20000
-loose_handlersocket_port_wr= 20001
-loose_handlersocket_threads= 2
-loose_handlersocket_threads_wr= 1
-loose_handlersocket_support_merge_table= 0
-loose_handlersocket_direct_update_mode= 2
-loose_handlersocket_unlimited_boundary= 65536
-loose_handlersocket_bulk_insert= 0
-loose_handlersocket_bulk_insert_timeout= 0
-loose_handlersocket_general_log= 1
-loose_handlersocket_timeout= 30
-loose_handlersocket_close_table_interval=2
-open_files_limit= 4096
-loose_partition= 1
-
-[mysqld.3.1]
-loose_partition= 1
-
-[mysqld.3.2]
-loose_partition= 1
-
-[mysqld.3.3]
-loose_partition= 1
-
-[mysqld.4.1]
-loose_partition= 1
-
-
-[ENV]
-USE_GEOMETRY_TEST= 0
-USE_FULLTEXT_TEST= 0
-USE_HA_TEST= 1
-USE_GENERAL_LOG= 1
-USE_REPLICATION= 0
-MASTER_1_MYPORT= @mysqld.1.1.port
-MASTER_1_HSRPORT= 20000
-MASTER_1_HSWPORT= 20001
-MASTER_1_MYSOCK= @mysqld.1.1.socket
-MASTER_1_ENGINE_TYPE= Spider
-#MASTER_1_ENGINE_TYPE= MyISAM
-MASTER_1_ENGINE= ENGINE=Spider
-MASTER_1_CHARSET= DEFAULT CHARSET=utf8
-MASTER_1_ENGINE2= ENGINE=MyISAM
-MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
-MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
-SLAVE1_1_MYPORT= @mysqld.4.1.port
-SLAVE1_1_MYSOCK= @mysqld.4.1.socket
-SLAVE1_1_ENGINE_TYPE= MyISAM
-SLAVE1_1_ENGINE= ENGINE=MyISAM
-SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8
-USE_CHILD_GROUP2= 1
-OUTPUT_CHILD_GROUP2= 0
-CHILD2_1_MYPORT= @mysqld.1.1.port
-CHILD2_1_MYSOCK= @mysqld.1.1.socket
-CHILD2_1_ENGINE_TYPE= InnoDB
-CHILD2_1_ENGINE= ENGINE=InnoDB
-CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
-CHILD2_2_MYPORT= @mysqld.1.1.port
-CHILD2_2_MYSOCK= @mysqld.1.1.socket
-CHILD2_2_ENGINE_TYPE= InnoDB
-CHILD2_2_ENGINE= ENGINE=InnoDB
-CHILD2_2_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_3_MYPORT= @mysqld.1.1.port
-CHILD2_3_MYSOCK= @mysqld.1.1.socket
-CHILD2_3_ENGINE_TYPE= InnoDB
-CHILD2_3_ENGINE= ENGINE=InnoDB
-CHILD2_3_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_1_FT_MYPORT= @mysqld.1.1.port
-CHILD2_1_FT_MYSOCK= @mysqld.1.1.socket
-CHILD2_1_FT_ENGINE_TYPE= MyISAM
-CHILD2_1_FT_ENGINE= ENGINE=MyISAM
-CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_2_FT_MYPORT= @mysqld.1.1.port
-CHILD2_2_FT_MYSOCK= @mysqld.1.1.socket
-CHILD2_2_FT_ENGINE_TYPE= MyISAM
-CHILD2_2_FT_ENGINE= ENGINE=MyISAM
-CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_1_GM_MYPORT= @mysqld.1.1.port
-CHILD2_1_GM_MYSOCK= @mysqld.1.1.socket
-CHILD2_1_GM_ENGINE_TYPE= MyISAM
-CHILD2_1_GM_ENGINE= ENGINE=MyISAM
-CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_2_GM_MYPORT= @mysqld.1.1.port
-CHILD2_2_GM_MYSOCK= @mysqld.1.1.socket
-CHILD2_2_GM_ENGINE_TYPE= MyISAM
-CHILD2_2_GM_ENGINE= ENGINE=MyISAM
-CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8
-USE_CHILD_GROUP3= 1
-OUTPUT_CHILD_GROUP3= 0
-CHILD3_1_MYPORT= @mysqld.3.1.port
-CHILD3_1_MYSOCK= @mysqld.3.1.socket
-CHILD3_1_ENGINE_TYPE= InnoDB
-CHILD3_1_ENGINE= ENGINE=InnoDB
-CHILD3_1_CHARSET= DEFAULT CHARSET=utf8
-CHILD3_2_MYPORT= @mysqld.3.2.port
-CHILD3_2_MYSOCK= @mysqld.3.2.socket
-CHILD3_2_ENGINE_TYPE= InnoDB
-CHILD3_2_ENGINE= ENGINE=InnoDB
-CHILD3_2_CHARSET= DEFAULT CHARSET=utf8
-CHILD3_3_MYPORT= @mysqld.3.3.port
-CHILD3_3_MYSOCK= @mysqld.3.3.socket
-CHILD3_3_ENGINE_TYPE= InnoDB
-CHILD3_3_ENGINE= ENGINE=InnoDB
-CHILD3_3_CHARSET= DEFAULT CHARSET=utf8
-ORACLE_HOST= xe
-ORACLE_PORT= 1521
-ORACLE_USER= system
-ORACLE_PASSWORD= oracle
-ORACLE_DATABASE= SYSTEM
-
-STR_SEMICOLON= ;
-
-#The followings are set in include/init_xxx.inc files
-# MASTER_1_COMMENT_2_1
-# MASTER_1_COMMENT2_2_1
-# MASTER_1_COMMENT3_2_1
-# MASTER_1_COMMENT4_2_1
-# MASTER_1_COMMENT5_2_1
-# MASTER_1_COMMENT_P_2_1
-# CHILD2_1_DROP_TABLES
-# CHILD2_1_CREATE_TABLES
-# CHILD2_1_SELECT_TABLES
-# CHILD2_1_DROP_TABLES2
-# CHILD2_1_CREATE_TABLES2
-# CHILD2_1_SELECT_TABLES2
-# CHILD2_1_DROP_TABLES3
-# CHILD2_1_CREATE_TABLES3
-# CHILD2_1_SELECT_TABLES3
-# CHILD2_1_DROP_TABLES4
-# CHILD2_1_CREATE_TABLES4
-# CHILD2_1_SELECT_TABLES4
-# CHILD2_1_DROP_TABLES5
-# CHILD2_1_CREATE_TABLES5
-# CHILD2_1_SELECT_TABLES5
-# CHILD2_1_DROP_TABLES6
-# CHILD2_1_CREATE_TABLES6
-# CHILD2_1_SELECT_TABLES6
-# CHILD2_2_DROP_TABLES
-# CHILD2_2_CREATE_TABLES
-# CHILD2_2_SELECT_TABLES
diff --git a/storage/spider/mysql-test/spider/oracle/r/basic_sql.result b/storage/spider/mysql-test/spider/oracle/r/basic_sql.result
deleted file mode 100644
index 1e9fe78acea..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/basic_sql.result
+++ /dev/null
@@ -1,634 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table select test
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-create table ignore select test
-DROP TABLE IF EXISTS ta_l;
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'f', '2008-07-01 10:21:39'),
-(2, 'g', '2000-02-01 00:00:00'),
-(3, 'j', '2007-05-04 20:03:11'),
-(4, 'i', '2003-10-30 05:01:03'),
-(5, 'h', '2001-10-31 23:59:59');
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-IGNORE SELECT a, b, c FROM tb_l
-Warnings:
-Warning 1062 Duplicate entry '1' for key 'PRIMARY'
-Warning 1062 Duplicate entry '2' for key 'PRIMARY'
-Warning 1062 Duplicate entry '3' for key 'PRIMARY'
-Warning 1062 Duplicate entry '4' for key 'PRIMARY'
-Warning 1062 Duplicate entry '5' for key 'PRIMARY'
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-create table ignore select test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-REPLACE SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-create no index table
-DROP TABLE IF EXISTS ta_l_no_idx;
-CREATE TABLE ta_l_no_idx
-MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
-SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table shared mode
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-LOCK IN SHARE MODE;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table for update
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-FOR UPDATE;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table join
-SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
-WHERE a.a = b.a ORDER BY a.a;
-a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table straight_join
-SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
-FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
-a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_small_result
-SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_big_result
-SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_buffer_result
-SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_cache
-SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_no_cache
-SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_calc_found_rows
-SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a LIMIT 4;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-SELECT found_rows();
-found_rows()
-5
-
-select high_priority
-SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select distinct
-SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select count
-SELECT count(*) FROM ta_l ORDER BY a;
-count(*)
-5
-
-select table join not use index
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
-EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select using pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-select using index and pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.a > 0 AND a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-insert
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert select
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-insert select a
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-
-insert low_priority
-TRUNCATE TABLE ta_l;
-INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert high_priority
-TRUNCATE TABLE ta_l;
-INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
-'2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert ignore
-INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
-Warnings:
-Warning 1062 Duplicate entry '2' for key 'PRIMARY'
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert update (insert)
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert update (update)
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 f 2005-08-08 11:11:11
-
-replace
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 f 2008-02-02 02:02:02
-
-replace select
-REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-replace select a
-REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-replace low_priority
-REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
-'2009-03-03 03:03:03');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-2 g 2000-02-01 00:00:00
-3 g 2009-03-03 03:03:03
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-update
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59');
-UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-2 f 2008-02-02 02:02:02
-
-update select
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
-tb_l);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 g 2009-03-03 03:03:03
-
-update select a
-UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
-tb_l ORDER BY a LIMIT 1);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 h 2010-04-04 04:04:04
-2 g 2009-03-03 03:03:03
-
-update join
-UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-
-update join a
-UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
-a.a = b.a;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 g 2009-03-03 03:03:03
-
-update low_priority
-UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 f 2008-02-02 02:02:02
-
-update ignore
-UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 f 2008-02-02 02:02:02
-
-update pushdown
-update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 j 2009-03-03 03:03:03
-
-update index pushdown
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 g 2009-03-03 03:03:03
-
-delete
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete all
-DELETE FROM ta_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-
-delete select
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete select a
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete join
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete low_priority
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete ignore
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE IGNORE FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete quick
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE QUICK FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE b = 'e';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-10 j 2008-01-01 23:59:59
-
-delete index pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a > 0 AND b = 'e';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-10 j 2008-01-01 23:59:59
-
-truncate
-TRUNCATE TABLE ta_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result b/storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result
deleted file mode 100644
index 9e1201c17c9..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/basic_sql_part.result
+++ /dev/null
@@ -1,121 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'f', '2008-07-01 10:21:39'),
-(2, 'g', '2000-02-01 00:00:00'),
-(3, 'j', '2007-05-04 20:03:11'),
-(4, 'i', '2003-10-30 05:01:03'),
-(5, 'h', '2001-10-31 23:59:59');
-
-create table with partition and select test
-CREATE TABLE ta_l2 (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
-SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select partition using pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
-a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-select partition using index pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
-a.a > 0 AND a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-update partition pushdown
-UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 e 2009-03-03 03:03:03
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-update partition index pushdown
-UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2009-03-03 03:03:03
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-delete partition pushdown
-TRUNCATE TABLE ta_l2;
-INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
-DELETE FROM ta_l2 WHERE b = 'g';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-delete partition index pushdown
-TRUNCATE TABLE ta_l2;
-INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
-DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result b/storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result
deleted file mode 100644
index fe5752cff65..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate.result
+++ /dev/null
@@ -1,91 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table select test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-direct_aggregating test
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 0
-SELECT COUNT(*) FROM ta_l;
-COUNT(*)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MAX(a) FROM ta_l;
-MAX(a)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MIN(a) FROM ta_l;
-MIN(a)
-1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-MAX(a)
-4
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-MIN(a)
-2
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result
deleted file mode 100644
index 9bde4a1746a..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/direct_aggregate_part.result
+++ /dev/null
@@ -1,82 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-with partition test
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 0
-SELECT COUNT(*) FROM ta_l2;
-COUNT(*)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MAX(a) FROM ta_l2;
-MAX(a)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MIN(a) FROM ta_l2;
-MIN(a)
-1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MAX(a) FROM ta_l2 WHERE a < 5;
-MAX(a)
-4
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MIN(a) FROM ta_l2 WHERE a > 1;
-MIN(a)
-2
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_update.result b/storage/spider/mysql-test/spider/oracle/r/direct_update.result
deleted file mode 100644
index 3dc39d5f630..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/direct_update.result
+++ /dev/null
@@ -1,138 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table select test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-direct_updating test
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-update all rows with function
-UPDATE ta_l SET c = ADDDATE(c, 1);
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 e 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key
-UPDATE ta_l SET b = 'x' WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by a column without index
-UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-17 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key with order and limit
-UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by primary key with order and limit
-DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by a column without index
-DELETE FROM ta_l WHERE b = 'c';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-delete by primary key
-DELETE FROM ta_l WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-4 d 2003-12-01 05:01:03
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/direct_update_part.result b/storage/spider/mysql-test/spider/oracle/r/direct_update_part.result
deleted file mode 100644
index 8a22c40a0da..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/direct_update_part.result
+++ /dev/null
@@ -1,129 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-with partition test
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-update all rows with function
-UPDATE ta_l2 SET c = ADDDATE(c, 1);
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 e 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key
-UPDATE ta_l2 SET b = 'x' WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by a column without index
-UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-17 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key with order and limit
-UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by primary key with order and limit
-DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by a column without index
-DELETE FROM ta_l2 WHERE b = 'c';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-delete by primary key
-DELETE FROM ta_l2 WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-4 d 2003-12-01 05:01:03
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/function.result b/storage/spider/mysql-test/spider/oracle/r/function.result
deleted file mode 100644
index 764c774514b..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/function.result
+++ /dev/null
@@ -1,149 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-in()
-CREATE TABLE t1 (
-a VARCHAR(255),
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1
-insert into t1 values ('1');
-insert into t1 select a + 1 from t1;
-insert into t1 select a + 2 from t1;
-insert into t1 select a + 4 from t1;
-insert into t1 select a + 8 from t1;
-insert into t1 select a + 16 from t1;
-insert into t1 select a + 32 from t1;
-insert into t1 select a + 64 from t1;
-insert into t1 select a + 128 from t1;
-insert into t1 select a + 256 from t1;
-insert into t1 select a + 512 from t1;
-flush tables;
-select a from t1 where a in ('15', '120');
-a
-120
-15
-
-date_sub()
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-08-01 10:21:39
-2 b 1999-01-01 00:00:00
-3 e 2006-06-04 20:03:11
-4 d 2002-11-30 05:01:03
-5 c 2000-12-31 23:59:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-11-01 10:21:39
-2 b 1999-04-01 00:00:00
-3 e 2006-09-04 20:03:11
-4 d 2003-02-28 05:01:03
-5 c 2001-03-31 23:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-01 10:21:39
-2 b 1999-03-01 00:00:00
-3 e 2006-08-04 20:03:11
-4 d 2003-01-28 05:01:03
-5 c 2001-02-28 23:59:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-08 10:21:39
-2 b 1999-03-08 00:00:00
-3 e 2006-08-11 20:03:11
-4 d 2003-02-04 05:01:03
-5 c 2001-03-07 23:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 10:21:39
-2 b 1999-03-07 00:00:00
-3 e 2006-08-10 20:03:11
-4 d 2003-02-03 05:01:03
-5 c 2001-03-06 23:59:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 11:21:39
-2 b 1999-03-07 01:00:00
-3 e 2006-08-10 21:03:11
-4 d 2003-02-03 06:01:03
-5 c 2001-03-07 00:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 11:20:39
-2 b 1999-03-07 00:59:00
-3 e 2006-08-10 21:02:11
-4 d 2003-02-03 06:00:03
-5 c 2001-03-07 00:58:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 11:20:40
-2 b 1999-03-07 00:59:01
-3 e 2006-08-10 21:02:12
-4 d 2003-02-03 06:00:04
-5 c 2001-03-07 00:59:00
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/ha.result b/storage/spider/mysql-test/spider/oracle/r/ha.result
deleted file mode 100644
index 8ca64dec6df..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/ha.result
+++ /dev/null
@@ -1,240 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-CREATE DATABASE auto_test_remote3;
-USE auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 0
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r3' get a problem
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 3
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l 1
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l
-CONNECTION='host "xe", user "system",
- password "oracle", msi "2", mkd "2",
- database "SYSTEM", lst "0 2"';
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 2
-SELECT spider_copy_tables('ta_l', '0', '1');
-spider_copy_tables('ta_l', '0', '1')
-1
-ALTER TABLE ta_l
-CONNECTION='host "xe", user "system",
- password "oracle", msi "2", mkd "2",
- database "SYSTEM", lst "0 1"';
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 1
-INSERT INTO ta_l (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-8 g 2011-05-05 21:33:30
-DROP TABLE ta_l;
-SELECT spider_flush_table_mon_cache();
-spider_flush_table_mon_cache()
-1
-
-active standby test
-create table test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 2
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r' get a problem
-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
-auto_test_local ta_l 0 3
-auto_test_local ta_l 1 1
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l 1
-auto_test_local ta_l 0
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 2
-Spider_mon_table_cache_version_req 2
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l
-CONNECTION='host "xe", user "system",
- password "oracle", msi "2", mkd "2", alc "1",
- database "SYSTEM", lst "1 0"';
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 1
-INSERT INTO ta_l (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-8 g 2011-05-05 21:33:30
-DROP TABLE ta_l;
-SELECT spider_flush_table_mon_cache();
-spider_flush_table_mon_cache()
-1
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/ha_part.result b/storage/spider/mysql-test/spider/oracle/r/ha_part.result
deleted file mode 100644
index e11b6f695e0..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/ha_part.result
+++ /dev/null
@@ -1,262 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-CREATE DATABASE auto_test_remote3;
-USE auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table with partition test
-DROP TABLE IF EXISTS ta_l2;
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 0
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r4' get a problem
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 3
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l2#P#pt2 1
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l2
-PARTITION BY KEY(a) (
-PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
-PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 2
-SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
-spider_copy_tables('ta_l2#P#pt2', '0', '1')
-1
-ALTER TABLE ta_l2
-PARTITION BY KEY(a) (
-PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
-PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30'),
-(9, 'h', '2011-05-05 22:32:10');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-8 g 2011-05-05 21:33:30
-9 h 2011-05-05 22:32:10
-DROP TABLE ta_l2;
-
-create table with partition test
-DROP TABLE IF EXISTS ta_l2;
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r2' get a problem
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 3
-auto_test_local ta_l2#P#pt2 1 1
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l2#P#pt2 1
-auto_test_local ta_l2#P#pt2 0
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-3 e 2007-06-04 20:03:11
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l2
-PARTITION BY KEY(a) (
-PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
-PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30'),
-(9, 'h', '2011-05-05 22:32:10');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-3 e 2007-06-04 20:03:11
-5 c 2001-12-31 23:59:59
-8 g 2011-05-05 21:33:30
-9 h 2011-05-05 22:32:10
-DROP TABLE ta_l2;
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result b/storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result
deleted file mode 100644
index 418f8bb31a8..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes.result
+++ /dev/null
@@ -1,194 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-3.1
-auto_increment
-DROP TABLE IF EXISTS t1, t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
-CREATE TABLE t2 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-777
-SELECT MAX(id) FROM t1;
-MAX(id)
-777
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1554
-SELECT MAX(id) FROM t2;
-MAX(id)
-1554
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1555
-SELECT MAX(id) FROM t1;
-MAX(id)
-1555
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2331
-SELECT MAX(id) FROM t2;
-MAX(id)
-2331
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2332
-SELECT id FROM t1 ORDER BY id;
-id
-777
-1554
-1555
-2331
-2332
-3109
-3886
-4663
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5439
-SELECT id FROM t2 ORDER BY id;
-id
-777
-1554
-1555
-2331
-2332
-3109
-3886
-4663
-5439
-6216
-6993
-7770
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-777
-SELECT id FROM t1 ORDER BY id;
-id
-777
-1554
-2331
-3108
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3885
-SELECT id FROM t2 ORDER BY id;
-id
-777
-1554
-2331
-3108
-3885
-4662
-5439
-6216
-SET INSERT_ID=5000;
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-6216
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6993
-SELECT MAX(id) FROM t2;
-MAX(id)
-6993
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6993
-SELECT MAX(id) FROM t1;
-MAX(id)
-10000
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6993
-SELECT MAX(id) FROM t2;
-MAX(id)
-10000
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result
deleted file mode 100644
index accb4607027..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/spider3_fixes_part.result
+++ /dev/null
@@ -1,192 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-auto_increment with partition
-DROP TABLE IF EXISTS t1, t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
-CREATE TABLE t2 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-777
-SELECT MAX(id) FROM t1;
-MAX(id)
-777
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1554
-SELECT MAX(id) FROM t2;
-MAX(id)
-1554
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-778
-SELECT MAX(id) FROM t1;
-MAX(id)
-1554
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2331
-SELECT MAX(id) FROM t2;
-MAX(id)
-2331
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1555
-SELECT id FROM t1 ORDER BY id;
-id
-777
-778
-1554
-1555
-2331
-2332
-3109
-3886
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3108
-SELECT id FROM t2 ORDER BY id;
-id
-777
-778
-1554
-1555
-2331
-2332
-3108
-3109
-3885
-3886
-4662
-5439
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-777
-SELECT id FROM t1 ORDER BY id;
-id
-777
-1554
-2331
-3108
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3885
-SELECT id FROM t2 ORDER BY id;
-id
-777
-1554
-2331
-3108
-3885
-4662
-5439
-6216
-SET INSERT_ID=5000;
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-6216
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6993
-SELECT MAX(id) FROM t2;
-MAX(id)
-6993
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6993
-SELECT MAX(id) FROM t1;
-MAX(id)
-10000
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6993
-SELECT MAX(id) FROM t2;
-MAX(id)
-10000
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/spider_fixes.result b/storage/spider/mysql-test/spider/oracle/r/spider_fixes.result
deleted file mode 100644
index 85efde74061..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/spider_fixes.result
+++ /dev/null
@@ -1,552 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table and insert
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
-2.13
-select table with "order by desc" and "<"
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a < 5 ORDER BY a DESC LIMIT 3;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-4 d 2003-11-30 05:01:03
-3 e 2007-06-04 20:03:11
-2 b 2000-01-01 00:00:00
-
-select table with "order by desc" and "<="
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a <= 5 ORDER BY a DESC LIMIT 3;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-5 c 2001-12-31 23:59:59
-4 d 2003-11-30 05:01:03
-3 e 2007-06-04 20:03:11
-
-2.14
-update table with range scan and split_read
-UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-02-02 00:00:00
-3 e 2000-02-02 00:00:00
-4 d 2000-02-02 00:00:00
-5 c 2000-02-02 00:00:00
-
-2.15
-select table with range scan
-TRUNCATE TABLE ta_l;
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a int(11) NOT NULL DEFAULT '0',
-b char(1) DEFAULT NULL,
-c datetime DEFAULT NULL,
-PRIMARY KEY (a, b, c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
-AND c = '2001-12-31 23:59:59';
-a b c
-5 c 2001-12-31 23:59:59
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-a b c
-2 b 2000-01-01 00:00:00
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-a b c
-2 b 2000-01-01 00:00:00
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND b <= 'd' AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND b < 'e' AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
-AND b >= 'b' AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
-AND b >= 'b' AND c = '2000-01-01 00:00:00';
-a b c
-2 b 2000-01-01 00:00:00
-
-2.16
-auto_increment insert with trigger
-CREATE TABLE ta_l_auto_inc (
-a INT AUTO_INCREMENT,
-b CHAR(1) DEFAULT 'c',
-c DATETIME DEFAULT '1999-10-10 10:10:10',
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
-CREATE TABLE tc_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;;
-INSERT INTO ta_l_auto_inc (a, b, c) VALUES
-(NULL, 's', '2008-12-31 20:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 s 2008-12-31 20:59:59
-
-2.17
-engine-condition-pushdown with "or" and joining
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-2.23
-index merge
-CREATE TABLE ta_l_int (
-a INT AUTO_INCREMENT,
-b INT DEFAULT 10,
-c INT DEFAULT 11,
-PRIMARY KEY(a),
-KEY idx1(b),
-KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
-INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
-SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
-WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
-a b c
-3 4 5
-4 5 6
-5 6 7
-
-2.24
-index scan update without PK
-DROP TABLE IF EXISTS ta_l_int;
-CREATE TABLE ta_l_int (
-a INT NOT NULL,
-b INT DEFAULT 10,
-c INT DEFAULT 11,
-KEY idx1(b),
-KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-a b c
-1 2 3
-2 3 4
-3 4 5
-4 5 6
-5 6 7
-6 7 8
-7 8 9
-8 9 10
-9 10 11
-10 11 12
-11 12 13
-12 13 14
-13 14 15
-14 15 16
-15 16 17
-16 17 18
-INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
-INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
-UPDATE ta_l_int SET c = 4 WHERE b = 2;
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-a b c
-0 2 4
-1 2 4
-2 3 4
-3 4 5
-4 5 6
-5 6 7
-6 7 8
-7 8 9
-8 9 10
-9 10 11
-10 11 12
-11 12 13
-12 13 14
-13 14 15
-14 15 16
-15 16 17
-16 17 18
-18 2 4
-
-2.25
-direct order limit
-SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%';
-Variable_name Value
-Spider_direct_order_limit 0
-SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
-a b c
-1 2 4
-2 3 4
-3 4 5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%';
-Variable_name Value
-Spider_direct_order_limit 0
-
-2.26
-lock tables
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
-CREATE TABLE t2 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
-LOCK TABLES t1 READ, t2 READ;
-UNLOCK TABLES;
-
-auto_increment
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-777
-SELECT MAX(id) FROM t1;
-MAX(id)
-777
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1554
-SELECT MAX(id) FROM t1;
-MAX(id)
-1554
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2331
-SELECT MAX(id) FROM t1;
-MAX(id)
-2331
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3108
-SELECT MAX(id) FROM t1;
-MAX(id)
-3108
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3885
-SELECT id FROM t1 ORDER BY id;
-id
-777
-1554
-2331
-3108
-3885
-4662
-5439
-6216
-SET INSERT_ID=5000;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-6216
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-10000
-INSERT INTO t1 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-10000
-
-read only
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1
-SELECT id FROM t1 ORDER BY id;
-id
-777
-1000
-1554
-2331
-3108
-3885
-4662
-5000
-5439
-6216
-10000
-INSERT INTO t1 (id) VALUES (1);
-ERROR HY000: Table 'auto_test_local.t1' is read only
-UPDATE t1 SET id = 4 WHERE id = 777;
-ERROR HY000: Table 'auto_test_local.t1' is read only
-DELETE FROM t1 WHERE id = 777;
-ERROR HY000: Table 'auto_test_local.t1' is read only
-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
-
-2.27
-error mode
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1
-SELECT id FROM t1 ORDER BY id;
-id
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-INSERT INTO t1 (id) VALUES (1);
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-DELETE FROM t1;
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-TRUNCATE t1;
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-
-3.0
-is null
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-a VARCHAR(255),
-b VARCHAR(255),
-c VARCHAR(255),
-KEY idx1(a,b),
-KEY idx2(b),
-PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1
-insert into t1 values (null, null, '2048');
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a + 32, b + 32, c + 32 from t1;
-insert into t1 select a + 64, b + 64, c + 64 from t1;
-insert into t1 select a + 128, b + 128, c + 128 from t1;
-insert into t1 select a + 256, b + 256, c + 256 from t1;
-insert into t1 select a + 512, b + 512, c + 512 from t1;
-flush tables;
-select a from t1 where a is null order by a limit 30;
-a
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-select b from t1 where b is null order by b limit 30;
-b
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-
-direct_order_limit
-TRUNCATE TABLE t1;
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a, b + 32, c + 32 from t1;
-insert into t1 select a, b + 64, c + 64 from t1;
-insert into t1 select a, b + 128, c + 128 from t1;
-flush tables;
-select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
-a b c
-10 74 74
-10 42 42
-10 234 234
-10 202 202
-10 170 170
-select a, c from t1 where a = '10' order by b desc limit 5;
-a c
-10 74
-10 42
-10 234
-10 202
-10 170
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result
deleted file mode 100644
index 9abe8558416..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/spider_fixes_part.result
+++ /dev/null
@@ -1,199 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-2.17
-partition with sort
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-2.23
-partition update with moving partition
-DROP TABLE IF EXISTS ta_l2;
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
-UPDATE ta_l2 SET a = 4 WHERE a = 3;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-4 B 2010-09-26 00:00:00
-index merge with partition
-DROP TABLE IF EXISTS ta_l_int;
-CREATE TABLE ta_l_int (
-a INT AUTO_INCREMENT,
-b INT DEFAULT 10,
-c INT DEFAULT 11,
-PRIMARY KEY(a),
-KEY idx1(b),
-KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
-INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
-SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
-WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
-a b c
-3 4 5
-4 5 6
-5 6 7
-
-2.26
-auto_increment with partition
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-777
-SELECT MAX(id) FROM t1;
-MAX(id)
-777
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1554
-SELECT MAX(id) FROM t1;
-MAX(id)
-1554
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2331
-SELECT MAX(id) FROM t1;
-MAX(id)
-2331
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3108
-SELECT MAX(id) FROM t1;
-MAX(id)
-3108
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3885
-SELECT id FROM t1 ORDER BY id;
-id
-777
-1554
-2331
-3108
-3885
-4662
-5439
-6216
-SET INSERT_ID=5000;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-6216
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-10000
-INSERT INTO t1 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-5000
-SELECT MAX(id) FROM t1;
-MAX(id)
-10000
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/r/vp_fixes.result b/storage/spider/mysql-test/spider/oracle/r/vp_fixes.result
deleted file mode 100644
index 15dd29aa4d3..00000000000
--- a/storage/spider/mysql-test/spider/oracle/r/vp_fixes.result
+++ /dev/null
@@ -1,80 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table and insert
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
-0.9
-create different primary key table
-CREATE TABLE ta_l_int (
-a INT DEFAULT 10,
-b INT AUTO_INCREMENT,
-c INT DEFAULT 11,
-PRIMARY KEY(b)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-create un-correspond primary key table
-DROP TABLE IF EXISTS ta_l_int;
-CREATE TABLE ta_l_int (
-a INT DEFAULT 10,
-b INT DEFAULT 12,
-c INT DEFAULT 11,
-PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/basic_sql.test b/storage/spider/mysql-test/spider/oracle/t/basic_sql.test
deleted file mode 100644
index 9cf4ce99dc3..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/basic_sql.test
+++ /dev/null
@@ -1,2699 +0,0 @@
-# This test tests by executing basic SQL
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-SELECT a, b, c FROM tb_l;
-if ($MASTER_1_MERGE)
-{
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
- INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_MERGE)
-{
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- SELECT a, b, c FROM tb_l;
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo create table ignore select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'f', '2008-07-01 10:21:39'),
- (2, 'g', '2000-02-01 00:00:00'),
- (3, 'j', '2007-05-04 20:03:11'),
- (4, 'i', '2003-10-30 05:01:03'),
- (5, 'h', '2001-10-31 23:59:59');
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-IGNORE SELECT a, b, c FROM tb_l;
-if ($MASTER_1_MERGE)
-{
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- IGNORE SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
- INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_MERGE)
-{
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- IGNORE SELECT a, b, c FROM tb_l;
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo create table ignore select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-REPLACE SELECT a, b, c FROM tb_l;
-if ($MASTER_1_MERGE)
-{
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- REPLACE SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
- REPLACE INTO ta_l SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_MERGE)
-{
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- REPLACE SELECT a, b, c FROM tb_l;
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo create no index table
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES3;
- echo CHILD2_1_CREATE_TABLES3;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES3;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES3;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l_no_idx;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l_no_idx
-MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
-SELECT a, b, c FROM tb_l;
-if ($MASTER_1_NEEDPK)
-{
- --error ER_REQUIRES_PRIMARY_KEY
- eval CREATE TABLE ta_l_no_idx
- $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l_no_idx (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
- INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_NEEDPK)
-{
- if ($MASTER_1_MERGE)
- {
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l_no_idx
- $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l_no_idx (
- a INT,
- b CHAR(1),
- c DATETIME
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
- INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
- }
- if (!$MASTER_1_MERGE)
- {
- eval CREATE TABLE ta_l_no_idx
- $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
- SELECT a, b, c FROM tb_l;
- }
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES3;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
-
---echo
---echo select table
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table shared mode
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-LOCK IN SHARE MODE;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table for update
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-FOR UPDATE;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table join
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
-WHERE a.a = b.a ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table straight_join
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
-FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_small_result
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_big_result
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_buffer_result
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_cache
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_no_cache
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_calc_found_rows
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a LIMIT 4;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT found_rows();
-
---echo
---echo select high_priority
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select distinct
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select count
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT count(*) FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table join not use index
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
-EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select using pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.b = 'g' ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select using index and pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.a > 0 AND a.b = 'g' ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo insert
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert select
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert select a
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert low_priority
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert high_priority
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
-'2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert ignore
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert update (insert)
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert update (update)
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace
---connection master_1
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace select
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace select a
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace low_priority
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
-'2009-03-03 03:03:03');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update select
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
-tb_l);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update select a
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
-tb_l ORDER BY a LIMIT 1);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update join
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update join a
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
-a.a = b.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update low_priority
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update ignore
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update index pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete all
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete select
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete select a
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete join
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete low_priority
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete ignore
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE IGNORE FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete quick
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE QUICK FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE b = 'e';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete index pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a > 0 AND b = 'e';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo truncate
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test b/storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test
deleted file mode 100644
index 1bb18358d5d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/basic_sql_part.test
+++ /dev/null
@@ -1,571 +0,0 @@
-# This test tests by executing basic SQL
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'f', '2008-07-01 10:21:39'),
- (2, 'g', '2000-02-01 00:00:00'),
- (3, 'j', '2007-05-04 20:03:11'),
- (4, 'i', '2003-10-30 05:01:03'),
- (5, 'h', '2001-10-31 23:59:59');
-
---echo
---echo create table with partition and select test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
- SELECT a, b, c FROM tb_l;
- if ($MASTER_1_MERGE)
- {
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l2 (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- }
- if (!$MASTER_1_MERGE)
- {
- eval CREATE TABLE ta_l2 (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
- SELECT a, b, c FROM tb_l;
- }
- --enable_query_log
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo select partition using pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
- a.b = 'g' ORDER BY a.a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo select partition using index pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
- a.a > 0 AND a.b = 'g' ORDER BY a.a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo update partition pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo update partition index pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo delete partition pushdown
-if ($HAVE_PARTITION)
-{
- TRUNCATE TABLE ta_l2;
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- DELETE FROM ta_l2 WHERE b = 'g';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo delete partition index pushdown
-if ($HAVE_PARTITION)
-{
- TRUNCATE TABLE ta_l2;
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc
deleted file mode 100644
index cd9b0c9ca9b..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_child2_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc
deleted file mode 100644
index e145f66b630..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_child2_2.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc
deleted file mode 100644
index d356348d8ea..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_child2_3.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc
deleted file mode 100644
index 03e5c188c89..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_child3_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc
deleted file mode 100644
index d62a7ada824..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_child3_2.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc
deleted file mode 100644
index fb49f5bfdac..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_child3_3.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc
deleted file mode 100644
index 0c129ce5775..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_master_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc
deleted file mode 100644
index 45a822743e0..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/connect_slave1_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test
deleted file mode 100644
index 5c0c37f483d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate.test
+++ /dev/null
@@ -1,179 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test
deleted file mode 100644
index cb0b55e9788..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/direct_aggregate_part.test
+++ /dev/null
@@ -1,192 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_update.test b/storage/spider/mysql-test/spider/oracle/t/direct_update.test
deleted file mode 100644
index 94f27e2859c..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/direct_update.test
+++ /dev/null
@@ -1,198 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_updating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update all rows with function
-UPDATE ta_l SET c = ADDDATE(c, 1);
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update by primary key
-UPDATE ta_l SET b = 'x' WHERE a = 3;
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update by a column without index
-UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update by primary key with order and limit
-UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo delete by primary key with order and limit
-DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
-eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo delete by a column without index
-DELETE FROM ta_l WHERE b = 'c';
-eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo delete by primary key
-DELETE FROM ta_l WHERE a = 3;
-eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/direct_update_part.test b/storage/spider/mysql-test/spider/oracle/t/direct_update_part.test
deleted file mode 100644
index e8f1882594c..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/direct_update_part.test
+++ /dev/null
@@ -1,211 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update all rows with function
- UPDATE ta_l2 SET c = ADDDATE(c, 1);
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update by primary key
- UPDATE ta_l2 SET b = 'x' WHERE a = 3;
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update by a column without index
- UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update by primary key with order and limit
- UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo delete by primary key with order and limit
- DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
- eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo delete by a column without index
- DELETE FROM ta_l2 WHERE b = 'c';
- eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo delete by primary key
- DELETE FROM ta_l2 WHERE a = 3;
- eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/function.test b/storage/spider/mysql-test/spider/oracle/t/function.test
deleted file mode 100644
index 2472e774782..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/function.test
+++ /dev/null
@@ -1,253 +0,0 @@
-# This test tests for using functions
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo in()
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TEXT_PK_TABLES1;
- echo CHILD2_1_CREATE_TEXT_PK_TABLES1;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TEXT_PK_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_TEXT_PK_TABLES1;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1;
-eval CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1;
---enable_query_log
-insert into t1 values ('1');
-insert into t1 select a + 1 from t1;
-insert into t1 select a + 2 from t1;
-insert into t1 select a + 4 from t1;
-insert into t1 select a + 8 from t1;
-insert into t1 select a + 16 from t1;
-insert into t1 select a + 32 from t1;
-insert into t1 select a + 64 from t1;
-insert into t1 select a + 128 from t1;
-insert into t1 select a + 256 from t1;
-insert into t1 select a + 512 from t1;
-flush tables;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-select a from t1 where a in ('15', '120');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo date_sub()
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/ha.test b/storage/spider/mysql-test/spider/oracle/t/ha.test
deleted file mode 100644
index c36b7363a6d..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/ha.test
+++ /dev/null
@@ -1,878 +0,0 @@
-# This test tests for ha features
-if ($USE_HA_TEST)
-{
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source ha_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
- CREATE DATABASE auto_test_remote3;
- USE auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- --connection child2_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- SELECT 1;
- --connection child3_2
- SELECT 1;
- --connection child3_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo fail-over test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_HA_DROP_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_HA_DROP_TABLES;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_HA_STATUS;
---error 12511
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-eval $MASTER_1_CHECK_LINK_STATUS;
-eval $MASTER_1_CHECK_LINK_FAILED_LOG;
-eval $MASTER_1_CHECK_HA_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo recovery test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_HA_CREATE_TABLES;
- }
- eval $CHILD2_2_HA_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_RECOVERY_STATUS_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_RECOVERY_STATUS_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_RECOVERY_STATUS_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
-eval $MASTER_1_CHECK_LINK_STATUS;
-eval $MASTER_1_COPY_TABLES_2_1;
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_SET_OK_STATUS_2_1;
-eval $MASTER_1_CHECK_LINK_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-DROP TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
-eval $MASTER_1_CHANGE_HA_MON;
-
---echo
---echo active standby test
---echo create table test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo fail-over test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_DROP_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_HA_AS_DROP_TABLES;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_HA_STATUS;
---error 12511
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-eval $MASTER_1_CHECK_LINK_STATUS;
-eval $MASTER_1_CHECK_LINK_FAILED_LOG;
-eval $MASTER_1_CHECK_HA_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo recovery test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_CREATE_TABLES;
- }
- eval $CHILD2_1_HA_AS_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_AS_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_AS_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_AS_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_SET_OK_STATUS_AS_2_1;
-eval $MASTER_1_CHECK_LINK_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-DROP TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
-eval $MASTER_1_CHANGE_HA_MON;
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
-}
---disable_query_log
---disable_result_log
---source ha_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
-}
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/ha_part.test b/storage/spider/mysql-test/spider/oracle/t/ha_part.test
deleted file mode 100644
index 33fe9850b68..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/ha_part.test
+++ /dev/null
@@ -1,1017 +0,0 @@
-# This test tests for ha features
-if ($USE_HA_TEST)
-{
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source ha_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source ha_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
- CREATE DATABASE auto_test_remote3;
- USE auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- --connection child2_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- SELECT 1;
- --connection child3_2
- SELECT 1;
- --connection child3_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-if ($HAVE_PARTITION)
-{
- --echo
- --echo create table with partition test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_DROP_TABLES;
- echo CHILD2_3_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_3_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_3_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_P_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_P_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_P_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
- --echo
- --echo select test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo fail-over test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_HA_DROP_TABLES;
- }
- --disable_warnings
- eval $CHILD2_3_HA_DROP_TABLES;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_CHECK_HA_STATUS;
- --error 12511
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- eval $MASTER_1_CHECK_LINK_STATUS;
- eval $MASTER_1_CHECK_LINK_FAILED_LOG;
- eval $MASTER_1_CHECK_HA_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo recovery test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_HA_CREATE_TABLES;
- }
- eval $CHILD2_3_HA_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
- eval $MASTER_1_CHECK_LINK_STATUS;
- eval $MASTER_1_COPY_TABLES_P_2_1;
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_P_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_P_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_P_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_SET_OK_STATUS_P_2_1;
- eval $MASTER_1_CHECK_LINK_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30'),
- (9, 'h', '2011-05-05 22:32:10');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- DROP TABLE ta_l2;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-if ($HAVE_PARTITION)
-{
- --echo
- --echo create table with partition test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_DROP_TABLES;
- echo CHILD2_3_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_3_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_3_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
- --echo
- --echo select test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo fail-over test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_DROP_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_HA_AS_DROP_TABLES2;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_CHECK_HA_STATUS;
- --error 12511
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- eval $MASTER_1_CHECK_LINK_STATUS;
- eval $MASTER_1_CHECK_LINK_FAILED_LOG;
- eval $MASTER_1_CHECK_HA_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo recovery test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_CREATE_TABLES2;
- }
- eval $CHILD2_1_HA_AS_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_SET_OK_STATUS_AS_P_2_1;
- eval $MASTER_1_CHECK_LINK_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30'),
- (9, 'h', '2011-05-05 22:32:10');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- DROP TABLE ta_l2;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
-}
---disable_query_log
---disable_result_log
---source ha_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
-}
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc
deleted file mode 100644
index 53d0409d066..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/ha_test_deinit.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/ha_deinit_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/ha_deinit_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/ha_deinit_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/ha_deinit_child2_3.inc
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --connection child3_1
- --source ../include/ha_deinit_child3_1.inc
- --echo child3_2
- --connection child3_2
- --source ../include/ha_deinit_child3_2.inc
- --echo child3_3
- --connection child3_3
- --source ../include/ha_deinit_child3_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc b/storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc
deleted file mode 100644
index 70576ab16dc..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/ha_test_init.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/ha_init_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/ha_init_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/ha_init_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/ha_init_child2_3.inc
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --connection child3_1
- --source ../include/ha_init_child3_1.inc
- --echo child3_2
- --connection child3_2
- --source ../include/ha_init_child3_2.inc
- --echo child3_3
- --connection child3_3
- --source ../include/ha_init_child3_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/have_engine.inc b/storage/spider/mysql-test/spider/oracle/t/have_engine.inc
deleted file mode 100644
index 64bef7499cb..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/have_engine.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-if (!`SELECT count(*) FROM information_schema.engines WHERE
- (support = 'YES' OR support = 'DEFAULT') AND
- engine = '$TEST_ENGINE_TYPE'`)
-{
- SELECT engine, support FROM information_schema.engines;
- --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine"
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/have_func.inc b/storage/spider/mysql-test/spider/oracle/t/have_func.inc
deleted file mode 100644
index e0823e73fc8..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/have_func.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`)
-{
- SELECT name FROM mysql.func;
- --let $SKIP_REASON= "Need $TEST_FUNC_NAME function"
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/have_partition.inc b/storage/spider/mysql-test/spider/oracle/t/have_partition.inc
deleted file mode 100644
index b6e699475db..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/have_partition.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc b/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc
deleted file mode 100644
index 32de484b388..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/have_trigger.inc
+++ /dev/null
@@ -1,2 +0,0 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc
deleted file mode 100644
index 7ec2e981fd2..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/hs_test_deinit.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/hs_deinit_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/hs_deinit_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/hs_deinit_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/hs_deinit_child2_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc b/storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc
deleted file mode 100644
index 831bf479524..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/hs_test_init.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/hs_init_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/hs_init_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/hs_init_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/hs_init_child2_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc
deleted file mode 100644
index e9d99b7a960..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/slave_test_deinit.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-# get connection and exist engine test
---echo for slave1_1
---connection slave1_1
-STOP SLAVE;
---source ../include/deinit_slave1_1.inc
---disconnect slave1_1
diff --git a/storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc b/storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc
deleted file mode 100644
index 739d88970c5..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/slave_test_init.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-# get connection and exist engine test
---echo for slave1_1
---source connect_slave1_1.inc
---connection slave1_1
-SET SESSION sql_log_bin= 0;
---let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id`
---let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE
---source have_partition.inc
---source have_trigger.inc
---source ../include/init_slave1_1.inc
---source have_engine.inc
---let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS`
-if (!$SLAVE1_1_SLAVE_STATUS)
-{
- eval CHANGE MASTER TO
- MASTER_HOST = '127.0.0.1',
- MASTER_USER = 'root',
- MASTER_PASSWORD = '',
- MASTER_PORT = $MASTER_1_MYPORT
- ;
-}
-START SLAVE;
---connection master_1
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---connection slave1_1
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child2_2
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child2_3
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child3_2
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child3_3
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test
deleted file mode 100644
index 962abbad19f..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes.test
+++ /dev/null
@@ -1,292 +0,0 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test
deleted file mode 100644
index c609108ca9e..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/spider3_fixes_part.test
+++ /dev/null
@@ -1,345 +0,0 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/spider_fixes.test b/storage/spider/mysql-test/spider/oracle/t/spider_fixes.test
deleted file mode 100644
index d0158c7dc0b..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/spider_fixes.test
+++ /dev/null
@@ -1,1419 +0,0 @@
-# This test tests for Spider's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table and insert
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
---echo
---echo 2.13
---echo select table with "order by desc" and "<"
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a < 5 ORDER BY a DESC LIMIT 3;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table with "order by desc" and "<="
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a <= 5 ORDER BY a DESC LIMIT 3;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.14
---echo update table with range scan and split_read
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo 2.15
---echo select table with range scan
-TRUNCATE TABLE ta_l;
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES6;
- echo CHILD2_1_CREATE_TABLES6;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES6;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES6;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l (
- a int(11) NOT NULL DEFAULT '0',
- b char(1) DEFAULT NULL,
- c datetime DEFAULT NULL,
- PRIMARY KEY (a, b, c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
-eval CREATE TABLE ta_l (
- a int(11) NOT NULL DEFAULT '0',
- b char(1) DEFAULT NULL,
- c datetime DEFAULT NULL,
- PRIMARY KEY (a, b, c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
---enable_query_log
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
-AND c = '2001-12-31 23:59:59';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND b <= 'd' AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND b < 'e' AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
-AND b >= 'b' AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
-AND b >= 'b' AND c = '2000-01-01 00:00:00';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.16
---echo auto_increment insert with trigger
-if ($HAVE_TRIGGER)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES4;
- echo CHILD2_1_CREATE_TABLES4;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES4;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES4;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
- eval CREATE TABLE ta_l_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
- echo CREATE TABLE tc_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
- eval CREATE TABLE tc_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
- --enable_query_log
- --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- INSERT INTO ta_l_auto_inc (a, b, c) VALUES
- (NULL, 's', '2008-12-31 20:59:59');
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES4;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
-}
-
---echo
---echo 2.17
---echo engine-condition-pushdown with "or" and joining
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.23
---echo index merge
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-eval CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
---enable_query_log
-INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
-INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
-WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.24
---echo index scan update without PK
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l_int;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- KEY idx1(b),
- KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-if ($MASTER_1_NEEDPK)
-{
- --error ER_REQUIRES_PRIMARY_KEY
- eval CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
- eval CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
-}
-if (!$MASTER_1_NEEDPK)
-{
- eval CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
-}
---enable_query_log
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
-INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l_int SET c = 4 WHERE b = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-
-
---echo
---echo 2.25
---echo direct order limit
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
-SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
-eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
-
-
---echo
---echo 2.26
---echo lock tables
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_LOCK_TABLES1;
- echo CHILD2_1_DROP_LOCK_TABLES2;
- echo CHILD2_1_CREATE_LOCK_TABLES1;
- echo CHILD2_1_CREATE_LOCK_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_LOCK_TABLES1;
- eval $CHILD2_1_DROP_LOCK_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_LOCK_TABLES1;
- eval $CHILD2_1_CREATE_LOCK_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_LOCK_TABLES1;
- echo CHILD2_2_DROP_LOCK_TABLES2;
- echo CHILD2_2_CREATE_LOCK_TABLES1;
- echo CHILD2_2_CREATE_LOCK_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_LOCK_TABLES1;
- eval $CHILD2_2_DROP_LOCK_TABLES2;
- --enable_warnings
- eval $CHILD2_2_CREATE_LOCK_TABLES1;
- eval $CHILD2_2_CREATE_LOCK_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2;
---enable_query_log
-LOCK TABLES t1 READ, t2 READ;
-UNLOCK TABLES;
-
-
---echo
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-SET INSERT_ID=5000;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo read only
-let $MASTER_1_ENGINE_IS_SPIDER=
- `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR
- '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`;
-if ($MASTER_1_ENGINE_IS_SPIDER)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1;
- --let $MIN_VAL= `SELECT MIN(id) FROM t1`
- --enable_query_log
- SELECT id FROM t1 ORDER BY id;
- --error 12518
- INSERT INTO t1 (id) VALUES (1);
- --error 12518
- eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL;
- --error 12518
- eval DELETE FROM t1 WHERE id = $MIN_VAL;
- --error 12518
- DELETE FROM t1;
- --error 12518
- TRUNCATE t1;
-}
-if (!$MASTER_1_ENGINE_IS_SPIDER)
-{
- --echo skipped
-}
-
-
---echo
---echo 2.27
---echo error mode
-if ($MASTER_1_ENGINE_IS_SPIDER)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1;
- --enable_query_log
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t1 (id) VALUES (1);
- DELETE FROM t1;
- TRUNCATE t1;
-}
-if (!$MASTER_1_ENGINE_IS_SPIDER)
-{
- --echo skipped
-}
-
-
---echo
---echo 3.0
---echo is null
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TEXT_KEY_TABLES1;
- echo CHILD2_1_CREATE_TEXT_KEY_TABLES1;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TEXT_KEY_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1;
-eval CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1;
---enable_query_log
-insert into t1 values (null, null, '2048');
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a + 32, b + 32, c + 32 from t1;
-insert into t1 select a + 64, b + 64, c + 64 from t1;
-insert into t1 select a + 128, b + 128, c + 128 from t1;
-insert into t1 select a + 256, b + 256, c + 256 from t1;
-insert into t1 select a + 512, b + 512, c + 512 from t1;
-flush tables;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-select a from t1 where a is null order by a limit 30;
-select b from t1 where b is null order by b limit 30;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo direct_order_limit
---connection master_1
-TRUNCATE TABLE t1;
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a, b + 32, c + 32 from t1;
-insert into t1 select a, b + 64, c + 64 from t1;
-insert into t1 select a, b + 128, c + 128 from t1;
-flush tables;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
-select a, c from t1 where a = '10' order by b desc limit 5;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test
deleted file mode 100644
index 3053b0008e7..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/spider_fixes_part.test
+++ /dev/null
@@ -1,645 +0,0 @@
-# This test tests for Spider's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo 2.17
---echo partition with sort
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
- ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo 2.23
---echo partition update with moving partition
-if ($HAVE_PARTITION)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l2;
- --enable_warnings
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
- UPDATE ta_l2 SET a = 4 WHERE a = 3;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo index merge with partition
-if ($HAVE_PARTITION)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l_int;
- --enable_warnings
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_2_DROP_TABLES5;
- echo CHILD2_2_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES5;
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1;
- eval CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1;
- --enable_query_log
- INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
- INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
- INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
- INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
- INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
- WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo 2.26
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- SET INSERT_ID=5000;
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle/t/test_deinit.inc b/storage/spider/mysql-test/spider/oracle/t/test_deinit.inc
deleted file mode 100644
index 989bde26d3c..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/test_deinit.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/deinit_master_1.inc
---disconnect master_1
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/deinit_child2_1.inc
- --disconnect child2_1
- --echo child2_2
- --connection child2_2
- --source ../include/deinit_child2_2.inc
- --disconnect child2_2
- --echo child2_3
- --connection child2_3
- --source ../include/deinit_child2_3.inc
- --disconnect child2_3
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --connection child3_1
- --source ../include/deinit_child3_1.inc
- --disconnect child3_1
- --echo child3_2
- --connection child3_2
- --source ../include/deinit_child3_2.inc
- --disconnect child3_2
- --echo child3_3
- --connection child3_3
- --source ../include/deinit_child3_3.inc
- --disconnect child3_3
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/test_init.inc b/storage/spider/mysql-test/spider/oracle/t/test_init.inc
deleted file mode 100644
index f2cd6c0269f..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/test_init.inc
+++ /dev/null
@@ -1,74 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---source connect_master_1.inc
---connection master_1
-CALL mtr.add_suppression("unknown variable");
-SET SESSION sql_log_bin= 0;
---let $MASTER_1_SERVER_ID=`SELECT @@global.server_id`
---let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE
---source have_partition.inc
---source have_trigger.inc
---source ../include/init_master_1.inc
---source have_engine.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --source connect_child2_1.inc
- --connection child2_1
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
- --source ../include/init_child2_1.inc
- --source have_engine.inc
- --echo child2_2
- --source connect_child2_2.inc
- --connection child2_2
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
- --source ../include/init_child2_2.inc
- --source have_engine.inc
- --echo child2_3
- --source connect_child2_3.inc
- --connection child2_3
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
- --source ../include/init_child2_3.inc
- --source have_engine.inc
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --source connect_child3_1.inc
- --connection child3_1
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
- --source ../include/init_child3_1.inc
- --source have_engine.inc
- --echo child3_2
- --source connect_child3_2.inc
- --connection child3_2
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
- --source ../include/init_child3_2.inc
- --source have_engine.inc
- --echo child3_3
- --source connect_child3_3.inc
- --connection child3_3
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
- --source ../include/init_child3_3.inc
- --source have_engine.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle/t/vp_fixes.test b/storage/spider/mysql-test/spider/oracle/t/vp_fixes.test
deleted file mode 100644
index 2c3e1523611..00000000000
--- a/storage/spider/mysql-test/spider/oracle/t/vp_fixes.test
+++ /dev/null
@@ -1,335 +0,0 @@
-# This test tests for VP's bug fixes
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table and insert
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
---echo
---echo 0.9
---echo create different primary key table
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT AUTO_INCREMENT,
- c INT DEFAULT 11,
- PRIMARY KEY(b)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-eval CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT AUTO_INCREMENT,
- c INT DEFAULT 11,
- PRIMARY KEY(b)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)`
-if ($MASTER_1_IS_VP)
-{
- --error 14514
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-}
-if (!$MASTER_1_IS_VP)
-{
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
- --disable_query_log
- --disable_result_log
- TRUNCATE TABLE ta_l_int;
- --enable_query_log
- --enable_result_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES5;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo create un-correspond primary key table
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l_int;
---enable_warnings
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT DEFAULT 12,
- c INT DEFAULT 11,
- PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-eval CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT DEFAULT 12,
- c INT DEFAULT 11,
- PRIMARY KEY(c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($MASTER_1_IS_VP)
-{
- --error 14514
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-}
-if (!$MASTER_1_IS_VP)
-{
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
- --disable_query_log
- --disable_result_log
- TRUNCATE TABLE ta_l_int;
- --enable_query_log
- --enable_result_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES5;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_2.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc
deleted file mode 100644
index 74c8efa90aa..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_1.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE
---source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc
deleted file mode 100644
index f42a980ad23..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_2.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE
---source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc
deleted file mode 100644
index 0696fb991cf..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_child3_3.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE
---source ../../include/deinit_engine.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_master_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/deinit_slave1_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc
deleted file mode 100644
index c19e376d10a..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc
+++ /dev/null
@@ -1 +0,0 @@
---source ../../include/deinit_spider.inc
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc
deleted file mode 100644
index 2684829408d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_1.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-let $CHILD2_1_HA_AS_DROP_TABLES=
- $CHILD2_1_DROP_TABLES;
-let $CHILD2_1_HA_AS_CREATE_TABLES=
- $CHILD2_1_CREATE_TABLES;
-let $CHILD2_1_HA_AS_DROP_TABLES2=
- $CHILD2_1_DROP_TABLES2;
-let $CHILD2_1_HA_AS_CREATE_TABLES2=
- $CHILD2_1_CREATE_TABLES2;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc
deleted file mode 100644
index 205eaa6fe35..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_2.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-let $CHILD2_2_HA_DROP_TABLES=
- $CHILD2_2_DROP_TABLES;
-let $CHILD2_2_HA_CREATE_TABLES=
- $CHILD2_2_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc
deleted file mode 100644
index 55cb858372c..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child2_3.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-let $CHILD2_3_HA_DROP_TABLES=
- $CHILD2_3_DROP_TABLES;
-let $CHILD2_3_HA_CREATE_TABLES=
- $CHILD2_3_CREATE_TABLES;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc
deleted file mode 100644
index 8357f0bdbc2..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_1.inc
+++ /dev/null
@@ -1,140 +0,0 @@
---let $CHILD3_1_ENGINE_TYPE=Spider
---let $CHILD3_1_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_1_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_1_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_1_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_1_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_1_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc
deleted file mode 100644
index 3ffcec24f51..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_2.inc
+++ /dev/null
@@ -1,140 +0,0 @@
---let $CHILD3_2_ENGINE_TYPE=Spider
---let $CHILD3_2_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_2_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_2_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_2_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_2_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_2_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_2_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_2_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_2_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_2_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_2_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_2_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_2_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc
deleted file mode 100644
index 67bd00109f5..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_child3_3.inc
+++ /dev/null
@@ -1,140 +0,0 @@
---let $CHILD3_3_ENGINE_TYPE=Spider
---let $CHILD3_3_ENGINE=ENGINE=Spider
---source ../include/init_spider.inc
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $CHILD3_3_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $CHILD3_3_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $CHILD3_3_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 2"';
-let $CHILD3_3_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2", lst "0 1"';
-let $CHILD3_3_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2", lst "1 0"';
-
-let $CHILD3_3_DROP_TABLES_HA_2_1=
- DROP TABLE IF EXISTS ta_l;
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $CHILD3_3_CREATE_TABLES_HA_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "auto_test_remote auto_test_remote2"';
- let $CHILD3_3_CREATE_TABLES_HA_AS_2_1=
- CREATE TABLE ta_l (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"'
- CONNECTION='host "localhost", user "root", password "",
- msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "auto_test_remote auto_test_remote2"';
-}
-let $CHILD3_3_DROP_TABLES_HA_P_2_1=
- DROP TABLE IF EXISTS ta_l2;
-let $CHILD3_3_CREATE_TABLES_HA_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1=
- CREATE TABLE ta_l2 (
- a INT DEFAULT 10,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $CHILD3_3_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $CHILD3_3_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc
deleted file mode 100644
index 8ace39ab641..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/ha_init_master_1.inc
+++ /dev/null
@@ -1,109 +0,0 @@
-eval INSERT INTO mysql.spider_link_mon_servers
-(db_name, table_name, link_id, sid, server, scheme, host, port, socket,
- username, password, ssl_ca, ssl_capath, ssl_cert, ssl_cipher, ssl_key,
- ssl_verify_server_cert, default_file, default_group) VALUES
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_1_SERVER_ID, 's_3_1', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_2_SERVER_ID, 's_3_2', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL),
-('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
-let $MASTER_1_CHECK_LINK_STATUS=
- SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
- ORDER BY db_name, table_name, link_id;
-let $MASTER_1_CHECK_LINK_FAILED_LOG=
- SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-let $MASTER_1_SET_RECOVERY_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE", lst "0 2"';
-let $MASTER_1_SET_OK_STATUS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE", lst "0 1"';
-let $MASTER_1_SET_OK_STATUS_AS_2_1=
- ALTER TABLE ta_l
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "$ORACLE_DATABASE", lst "1 0"';
-let $MASTER_1_COPY_TABLES_2_1=
- SELECT spider_copy_tables('ta_l', '0', '1');
-
-if ($VERSION_COMPILE_OS_WIN)
-{
- let $MASTER_1_COMMENT_HA_2_1=
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE"';
- let $MASTER_1_COMMENT_HA_AS_2_1=
- COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "$ORACLE_DATABASE"';
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- let $MASTER_1_COMMENT_HA_2_1=
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2",
- database "$ORACLE_DATABASE"';
- let $MASTER_1_COMMENT_HA_AS_2_1=
- COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1",
- database "$ORACLE_DATABASE"';
-}
-let $MASTER_1_COMMENT_HA_P_2_1=
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $MASTER_1_COMMENT_HA_AS_P_2_1=
- COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001"'
- );
-let $MASTER_1_SET_RECOVERY_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-let $MASTER_1_SET_OK_STATUS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-let $MASTER_1_SET_OK_STATUS_AS_P_2_1=
- ALTER TABLE ta_l2
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
- PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
-let $MASTER_1_COPY_TABLES_P_2_1=
- SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
-let $MASTER_1_CHECK_HA_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-let $MASTER_1_CHANGE_HA_MON=
- SELECT spider_flush_table_mon_cache();
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc
deleted file mode 100644
index f3f92a61e6f..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_1.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-let $CHILD2_1_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "hs_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_HS_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc
deleted file mode 100644
index 4bd8d49c17c..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_2.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-let $CHILD2_2_HS_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "hs_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- "d" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_HS_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_child2_3.inc
+++ /dev/null
diff --git a/storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc
deleted file mode 100644
index 0ff5e2a10d9..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/hs_init_master_1.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-let $MASTER_1_HS_COMMENT_TMP=
- COMMENT='';
-let $MASTER_1_HS_COMMENT_2_1=
- COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"';
-let $MASTER_1_HS_COMMENT_P_2_1=
- COMMENT='uhr "1", uhw "1"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4)
- COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"'
- );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc
deleted file mode 100644
index c24736eefca..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_1.inc
+++ /dev/null
@@ -1,192 +0,0 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1" ON "ta_r"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ta_r2" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r2" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES3=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_no_idx"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES3=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_no_idx" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES3=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_no_idx" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES4=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_auto_inc"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES4=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_auto_inc" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_1_ta_r_auto_inc" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES4=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_auto_inc"
- ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_1_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_1_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_1_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_1_ta_r_int" ON "s_2_1_ta_r_int"("c")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES5=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "s_2_1_ta_r_int" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TABLES6=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r_3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TABLES6=
- SELECT spider_direct_sql('CREATE TABLE "ta_r_3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\')
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TABLES6=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r_3" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_FT_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_FT_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "ft_r2" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_1_ft_r2" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_FT_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_GM_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_GM_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "gm_r2" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_1_gm_r2" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_GM_TABLES2=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r2" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t2_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_1_t1_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_1" ORDER BY "id"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("a")
- )', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_PK_TABLES1=
- SELECT spider_direct_sql('SELECT "a" FROM "t1" ORDER BY "a"', '', 'srv "s_2_1"');
-let $CHILD2_1_DROP_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"');
-let $CHILD2_1_CREATE_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1" (
- "a" VARCHAR(255),
- "b" VARCHAR(255),
- "c" VARCHAR(255),
- CONSTRAINT "pk_s_2_1_t1" PRIMARY KEY ("c")
- )', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_t1" ON "t1"("a","b")', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_t1" ON "t1"("b")', '', 'srv "s_2_1"');
-let $CHILD2_1_SELECT_TEXT_KEY_TABLES1=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "t1" ORDER BY "c"', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"');
-let $CHILD2_1_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc
deleted file mode 100644
index fd4497c0b59..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_2.inc
+++ /dev/null
@@ -1,94 +0,0 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r3" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_2_ta_r3" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_TABLES5=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "s_2_2_ta_r_int"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_TABLES5=
- SELECT spider_direct_sql('CREATE TABLE "s_2_2_ta_r_int" (
- "a" INT DEFAULT 3,
- "b" INT DEFAULT 10,
- "c" INT DEFAULT 11,
- CONSTRAINT "pk_s_2_2_ta_r_int" PRIMARY KEY("a")
- )', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx1_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("b")', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE INDEX "idx2_s_2_2_ta_r_int" ON "s_2_2_ta_r_int"("c")', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_FT_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ft_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_FT_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ft_r3" (
- "a" INT DEFAULT 0,
- "b" TEXT,
- "c" TEXT,
- "d" TEXT,
- CONSTRAINT "pk_s_2_2_ft_r3" PRIMARY KEY("a"),
- FULLTEXT INDEX "ft_idx1"("b"),
- FULLTEXT INDEX "ft_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_FT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c", "d" FROM "ft_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_GM_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "gm_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_GM_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "gm_r3" (
- "a" INT DEFAULT 0,
- "b" GEOMETRY NOT NULL,
- "c" GEOMETRY NOT NULL,
- CONSTRAINT "pk_s_2_2_gm_r3" PRIMARY KEY("a"),
- SPATIAL INDEX "sp_idx1"("b"),
- SPATIAL INDEX "sp_idx2"("c")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_GM_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", "c" FROM "gm_r3" ORDER BY "a"', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_LOCK_TABLES2=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t2_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_LOCK_TABLES2=
- SELECT spider_direct_sql('CREATE TABLE "t2_1" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t2_1" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_DROP_INCREMENT_TABLES1=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"');
-let $CHILD2_2_CREATE_INCREMENT_TABLES1=
- SELECT spider_direct_sql('CREATE TABLE "t1_2" (
- "id" INT NOT NULL,
- CONSTRAINT "pk_s_2_2_t1_2" PRIMARY KEY ("id")
- )', '', 'srv "s_2_2"');
-let $CHILD2_2_SELECT_INCREMENT_TABLES1=
- SELECT spider_direct_sql('SELECT "id" FROM "t1_2" ORDER BY "id"', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_INCREMENT2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET1=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $CHILD2_2_AUTO_INCREMENT_OFFSET2=
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc
deleted file mode 100644
index e16dfeffd81..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child2_3.inc
+++ /dev/null
@@ -1,15 +0,0 @@
---connection master_1
-SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"');
-let $CHILD2_3_DROP_TABLES=
- SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"');
-let $CHILD2_3_CREATE_TABLES=
- SELECT spider_direct_sql('CREATE TABLE "ta_r4" (
- "a" INT DEFAULT 10,
- "b" CHAR(1) DEFAULT \'c\',
- "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'),
- CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a")
- )', '', 'srv "s_2_3"');
-let $CHILD2_3_SELECT_TABLES=
- SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"');
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc
deleted file mode 100644
index d2d308cbefe..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_1.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc
deleted file mode 100644
index 3fbe1bd55bb..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_2.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc
deleted file mode 100644
index 3c7aaa8af84..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_child3_3.inc
+++ /dev/null
@@ -1,3 +0,0 @@
---let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
---source ../../include/init_engine.inc
---let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc
deleted file mode 100644
index 00c6f544992..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_master_1.inc
+++ /dev/null
@@ -1,150 +0,0 @@
---source ../include/init_spider.inc
-SET spider_direct_order_limit= 10000;
-SET spider_init_sql_alloc_size= 1;
-SET spider_conn_recycle_mode= 2;
-let $MASTER_1_COMMENT_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r", wrapper "oracle",
- pk_name "pk_s_2_1_ta_r"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD"';
-let $MASTER_1_COMMENT2_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r_no_idx", wrapper "oracle",
- pk_name "pk_s_2_1_ta_r_no_idx"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", prt "2000000"';
-let $MASTER_1_COMMENT_P_2_1=
- COMMENT='table "ta_r3"'
- PARTITION BY KEY(a) (
- PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2",
- priority "1000", pk_name "pk_s_2_1_ta_r2"',
- PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001",
- pk_name "pk_s_2_2_ta_r3"'
- );
-let $MASTER_1_COMMENT2_P_2_1=
- COMMENT='table "ta_r3"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
- table "ta_r2", priority "1000", pk_name "pk_s_2_1_ta_r2"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r3"'
- );
-let $MASTER_1_COMMENT3_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r_auto_inc",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_auto_inc"';
-let $MASTER_1_COMMENT3_P_2_1=
- COMMENT='table "s_2_1_ta_r_int"'
- PARTITION BY LIST(MOD(a, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='srv "s_2_1", priority "1000", pk_name "pk_s_2_1_ta_r_int"',
- PARTITION pt2 VALUES IN (1)
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ta_r_int",
- table "s_2_2_ta_r_int"'
- );
-let $MASTER_1_COMMENT4_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "s_2_1_ta_r_int",
- wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_int"';
-let $MASTER_1_COMMENT5_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ta_r_3", wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ta_r_3"';
-let $MASTER_1_COMMENT_FT_2_1=
- COMMENT='database "$ORACLE_DATABASE", table "ft_r", wrapper "oracle"'
- CONNECTION='host "$ORACLE_HOST", port "$ORACLE_PORT", user "$ORACLE_USER",
- password "$ORACLE_PASSWORD", pk_name "pk_s_2_1_ft_r"';
-let $MASTER_1_COMMENT2_FT_P_2_1=
- COMMENT='table "ft_r3"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
- table "ft_r2", priority "1000", pk_name "pk_s_2_1_ft_r2"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_ft_r3"'
- );
-let $MASTER_1_COMMENT_GM_2_1=
- COMMENT='srv "s_2_1", table "gm_r", pk_name "pk_s_2_1_gm_r"';
-let $MASTER_1_COMMENT2_GM_P_2_1=
- COMMENT='table "gm_r3"'
- PARTITION BY RANGE(a) (
- PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1",
- table "gm_r2", priority "1000", pk_name "pk_s_2_1_gm_r2"',
- PARTITION pt2 VALUES LESS THAN MAXVALUE
- COMMENT='srv "s_2_2", priority "1000001", pk_name "pk_s_2_2_gm_r3"'
- );
-let $MASTER_1_COMMENT_LOCK1=
- COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2",
- pk_name "pk_s_2_1_t1_1 pk_s_2_2_t1_2"';
-let $MASTER_1_COMMENT_LOCK2=
- COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1",
- pk_name "pk_s_2_2_t2_1 pk_s_2_1_t2_2"';
-let $MASTER_1_COMMENT_INCREMENT1_1=
- COMMENT 'aim "2", sqn "seq_t1_1", tbl "t1_1", srv "s_2_1",
- pk_name "pk_s_2_1_t1_1"';
-let $MASTER_1_COMMENT_INCREMENT1_P_1=
- COMMENT 'aim "2"'
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='sqn "seq_t1_1", tbl "t1_1", srv "s_2_1", pk_name "pk_s_2_1_t1_1"',
- PARTITION pt2 VALUES IN (1)
- COMMENT='sqn "seq_t1_2", tbl "t1_2", srv "s_2_2", pk_name "pk_s_2_2_t1_2"'
- );
-let $MASTER_1_COMMENT_READONLY1_1=
- COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1",
- pk_name "pk_s_2_1_t1_1"';
-let $MASTER_1_COMMENT_ERROR_MODE1_1=
- COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1",
- pk_name "pk_s_2_1_ter1_1"';
-let $MASTER_1_COMMENT_TEXT_PK1_1=
- COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"';
-let $MASTER_1_COMMENT_TEXT_KEY1_1=
- COMMENT 'tbl "t1", srv "s_2_1", pk_name "pk_s_2_1_t1"';
-let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-let $MASTER_1_CHECK_DIRECT_DELETE_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%';
-let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS=
- SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-let $MASTER_1_AUTO_INCREMENT_INCREMENT1=
- SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_INCREMENT2=
- SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_OFFSET1=
- SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 1 INCREMENT BY 1', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_OFFSET2=
- SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"')
- $STR_SEMICOLON
- SELECT spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"');
-let $MASTER_1_AUTO_INCREMENT_OFFSET3=
- SET SESSION AUTO_INCREMENT_OFFSET = 1;
-let $MASTER_1_AUTO_INCREMENT_OFFSET4=
- SET SESSION AUTO_INCREMENT_OFFSET = 777;
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc
deleted file mode 100644
index 73c3c6b9ef2..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_slave1_1.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-let $SLAVE1_1_COMMENT_INCREMENT1_1=
- COMMENT '';
-let $SLAVE1_1_COMMENT_INCREMENT1_P_1=
- COMMENT ''
- PARTITION BY LIST(MOD(id, 2)) (
- PARTITION pt1 VALUES IN (0)
- COMMENT='',
- PARTITION pt2 VALUES IN (1)
- COMMENT=''
- );
diff --git a/storage/spider/mysql-test/spider/oracle2/include/init_spider.inc b/storage/spider/mysql-test/spider/oracle2/include/init_spider.inc
deleted file mode 100644
index ff9ac9aee29..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/include/init_spider.inc
+++ /dev/null
@@ -1,105 +0,0 @@
---source ../../include/init_spider.inc
-let $VERSION_COMPILE_OS_WIN=
- `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`;
-if ($VERSION_COMPILE_OS_WIN)
-{
- eval DROP SERVER s_2_1;
- eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_2;
- eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_3;
- eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_3_1;
- eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- PORT $CHILD3_1_MYPORT
- );
- eval DROP SERVER s_3_2;
- eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- PORT $CHILD3_2_MYPORT
- );
- eval DROP SERVER s_3_3;
- eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- PORT $CHILD2_3_MYPORT
- );
-}
-if (!$VERSION_COMPILE_OS_WIN)
-{
- eval DROP SERVER s_2_1;
- eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_2;
- eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_2_3;
- eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS (
- HOST '$ORACLE_HOST',
- DATABASE '$ORACLE_DATABASE',
- USER '$ORACLE_USER',
- PASSWORD '$ORACLE_PASSWORD',
- PORT $ORACLE_PORT
- );
- eval DROP SERVER s_3_1;
- eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- SOCKET '$CHILD3_1_MYSOCK'
- );
- eval DROP SERVER s_3_2;
- eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- SOCKET '$CHILD3_2_MYSOCK'
- );
- eval DROP SERVER s_3_3;
- eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS (
- HOST 'localhost',
- DATABASE 'auto_test_local',
- USER 'root',
- PASSWORD '',
- SOCKET '$CHILD3_3_MYSOCK'
- );
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/my.cnf b/storage/spider/mysql-test/spider/oracle2/my.cnf
deleted file mode 100644
index efa05c8e8b0..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/my.cnf
+++ /dev/null
@@ -1,146 +0,0 @@
-# Use default setting for mysqld processes
-!include include/default_mysqld.cnf
-
-[mysqld.1.1]
-log-bin= master-bin
-loose_handlersocket_port= 20000
-loose_handlersocket_port_wr= 20001
-loose_handlersocket_threads= 2
-loose_handlersocket_threads_wr= 1
-loose_handlersocket_support_merge_table= 0
-loose_handlersocket_direct_update_mode= 2
-loose_handlersocket_unlimited_boundary= 65536
-loose_handlersocket_bulk_insert= 0
-loose_handlersocket_bulk_insert_timeout= 0
-loose_handlersocket_general_log= 1
-loose_handlersocket_timeout= 30
-loose_handlersocket_close_table_interval=2
-open_files_limit= 4096
-loose_partition= 1
-
-[mysqld.3.1]
-loose_partition= 1
-
-[mysqld.3.2]
-loose_partition= 1
-
-[mysqld.3.3]
-loose_partition= 1
-
-[mysqld.4.1]
-loose_partition= 1
-
-
-[ENV]
-USE_GEOMETRY_TEST= 0
-USE_FULLTEXT_TEST= 0
-USE_HA_TEST= 1
-USE_GENERAL_LOG= 1
-USE_REPLICATION= 0
-MASTER_1_MYPORT= @mysqld.1.1.port
-MASTER_1_HSRPORT= 20000
-MASTER_1_HSWPORT= 20001
-MASTER_1_MYSOCK= @mysqld.1.1.socket
-MASTER_1_ENGINE_TYPE= Spider
-#MASTER_1_ENGINE_TYPE= MyISAM
-MASTER_1_ENGINE= ENGINE=Spider
-MASTER_1_CHARSET= DEFAULT CHARSET=utf8
-MASTER_1_ENGINE2= ENGINE=MyISAM
-MASTER_1_CHARSET2= DEFAULT CHARSET=utf8
-MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
-SLAVE1_1_MYPORT= @mysqld.4.1.port
-SLAVE1_1_MYSOCK= @mysqld.4.1.socket
-SLAVE1_1_ENGINE_TYPE= MyISAM
-SLAVE1_1_ENGINE= ENGINE=MyISAM
-SLAVE1_1_CHARSET= DEFAULT CHARSET=utf8
-USE_CHILD_GROUP2= 1
-OUTPUT_CHILD_GROUP2= 0
-CHILD2_1_MYPORT= @mysqld.1.1.port
-CHILD2_1_MYSOCK= @mysqld.1.1.socket
-CHILD2_1_ENGINE_TYPE= InnoDB
-CHILD2_1_ENGINE= ENGINE=InnoDB
-CHILD2_1_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_1_CHARSET2= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
-CHILD2_2_MYPORT= @mysqld.1.1.port
-CHILD2_2_MYSOCK= @mysqld.1.1.socket
-CHILD2_2_ENGINE_TYPE= InnoDB
-CHILD2_2_ENGINE= ENGINE=InnoDB
-CHILD2_2_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_3_MYPORT= @mysqld.1.1.port
-CHILD2_3_MYSOCK= @mysqld.1.1.socket
-CHILD2_3_ENGINE_TYPE= InnoDB
-CHILD2_3_ENGINE= ENGINE=InnoDB
-CHILD2_3_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_1_FT_MYPORT= @mysqld.1.1.port
-CHILD2_1_FT_MYSOCK= @mysqld.1.1.socket
-CHILD2_1_FT_ENGINE_TYPE= MyISAM
-CHILD2_1_FT_ENGINE= ENGINE=MyISAM
-CHILD2_1_FT_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_2_FT_MYPORT= @mysqld.1.1.port
-CHILD2_2_FT_MYSOCK= @mysqld.1.1.socket
-CHILD2_2_FT_ENGINE_TYPE= MyISAM
-CHILD2_2_FT_ENGINE= ENGINE=MyISAM
-CHILD2_2_FT_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_1_GM_MYPORT= @mysqld.1.1.port
-CHILD2_1_GM_MYSOCK= @mysqld.1.1.socket
-CHILD2_1_GM_ENGINE_TYPE= MyISAM
-CHILD2_1_GM_ENGINE= ENGINE=MyISAM
-CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8
-CHILD2_2_GM_MYPORT= @mysqld.1.1.port
-CHILD2_2_GM_MYSOCK= @mysqld.1.1.socket
-CHILD2_2_GM_ENGINE_TYPE= MyISAM
-CHILD2_2_GM_ENGINE= ENGINE=MyISAM
-CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8
-USE_CHILD_GROUP3= 1
-OUTPUT_CHILD_GROUP3= 0
-CHILD3_1_MYPORT= @mysqld.3.1.port
-CHILD3_1_MYSOCK= @mysqld.3.1.socket
-CHILD3_1_ENGINE_TYPE= InnoDB
-CHILD3_1_ENGINE= ENGINE=InnoDB
-CHILD3_1_CHARSET= DEFAULT CHARSET=utf8
-CHILD3_2_MYPORT= @mysqld.3.2.port
-CHILD3_2_MYSOCK= @mysqld.3.2.socket
-CHILD3_2_ENGINE_TYPE= InnoDB
-CHILD3_2_ENGINE= ENGINE=InnoDB
-CHILD3_2_CHARSET= DEFAULT CHARSET=utf8
-CHILD3_3_MYPORT= @mysqld.3.3.port
-CHILD3_3_MYSOCK= @mysqld.3.3.socket
-CHILD3_3_ENGINE_TYPE= InnoDB
-CHILD3_3_ENGINE= ENGINE=InnoDB
-CHILD3_3_CHARSET= DEFAULT CHARSET=utf8
-ORACLE_HOST= xe
-ORACLE_PORT= 1521
-ORACLE_USER= system
-ORACLE_PASSWORD= oracle
-ORACLE_DATABASE= SYSTEM
-
-STR_SEMICOLON= ;
-
-#The followings are set in include/init_xxx.inc files
-# MASTER_1_COMMENT_2_1
-# MASTER_1_COMMENT2_2_1
-# MASTER_1_COMMENT3_2_1
-# MASTER_1_COMMENT4_2_1
-# MASTER_1_COMMENT5_2_1
-# MASTER_1_COMMENT_P_2_1
-# CHILD2_1_DROP_TABLES
-# CHILD2_1_CREATE_TABLES
-# CHILD2_1_SELECT_TABLES
-# CHILD2_1_DROP_TABLES2
-# CHILD2_1_CREATE_TABLES2
-# CHILD2_1_SELECT_TABLES2
-# CHILD2_1_DROP_TABLES3
-# CHILD2_1_CREATE_TABLES3
-# CHILD2_1_SELECT_TABLES3
-# CHILD2_1_DROP_TABLES4
-# CHILD2_1_CREATE_TABLES4
-# CHILD2_1_SELECT_TABLES4
-# CHILD2_1_DROP_TABLES5
-# CHILD2_1_CREATE_TABLES5
-# CHILD2_1_SELECT_TABLES5
-# CHILD2_1_DROP_TABLES6
-# CHILD2_1_CREATE_TABLES6
-# CHILD2_1_SELECT_TABLES6
-# CHILD2_2_DROP_TABLES
-# CHILD2_2_CREATE_TABLES
-# CHILD2_2_SELECT_TABLES
diff --git a/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result b/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result
deleted file mode 100644
index 1e9fe78acea..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/basic_sql.result
+++ /dev/null
@@ -1,634 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table select test
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-create table ignore select test
-DROP TABLE IF EXISTS ta_l;
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'f', '2008-07-01 10:21:39'),
-(2, 'g', '2000-02-01 00:00:00'),
-(3, 'j', '2007-05-04 20:03:11'),
-(4, 'i', '2003-10-30 05:01:03'),
-(5, 'h', '2001-10-31 23:59:59');
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-IGNORE SELECT a, b, c FROM tb_l
-Warnings:
-Warning 1062 Duplicate entry '1' for key 'PRIMARY'
-Warning 1062 Duplicate entry '2' for key 'PRIMARY'
-Warning 1062 Duplicate entry '3' for key 'PRIMARY'
-Warning 1062 Duplicate entry '4' for key 'PRIMARY'
-Warning 1062 Duplicate entry '5' for key 'PRIMARY'
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-create table ignore select test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-REPLACE SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-create no index table
-DROP TABLE IF EXISTS ta_l_no_idx;
-CREATE TABLE ta_l_no_idx
-MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
-SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table shared mode
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-LOCK IN SHARE MODE;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table for update
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-FOR UPDATE;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table join
-SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
-WHERE a.a = b.a ORDER BY a.a;
-a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select table straight_join
-SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
-FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
-a b date_format(b.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_small_result
-SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_big_result
-SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_buffer_result
-SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_cache
-SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_no_cache
-SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select sql_calc_found_rows
-SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a LIMIT 4;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-SELECT found_rows();
-found_rows()
-5
-
-select high_priority
-SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select distinct
-SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select count
-SELECT count(*) FROM ta_l ORDER BY a;
-count(*)
-5
-
-select table join not use index
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
-EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select using pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-select using index and pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.a > 0 AND a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-insert
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert select
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-insert select a
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-
-insert low_priority
-TRUNCATE TABLE ta_l;
-INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert high_priority
-TRUNCATE TABLE ta_l;
-INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
-'2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert ignore
-INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
-Warnings:
-Warning 1062 Duplicate entry '2' for key 'PRIMARY'
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert update (insert)
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-
-insert update (update)
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 f 2005-08-08 11:11:11
-
-replace
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 f 2008-02-02 02:02:02
-
-replace select
-REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-replace select a
-REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-replace low_priority
-REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
-'2009-03-03 03:03:03');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-2 g 2000-02-01 00:00:00
-3 g 2009-03-03 03:03:03
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-update
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59');
-UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-2 f 2008-02-02 02:02:02
-
-update select
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
-tb_l);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 g 2009-03-03 03:03:03
-
-update select a
-UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
-tb_l ORDER BY a LIMIT 1);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 h 2010-04-04 04:04:04
-2 g 2009-03-03 03:03:03
-
-update join
-UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-
-update join a
-UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
-a.a = b.a;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 g 2009-03-03 03:03:03
-
-update low_priority
-UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 f 2008-02-02 02:02:02
-
-update ignore
-UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 f 2008-02-02 02:02:02
-
-update pushdown
-update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 j 2009-03-03 03:03:03
-
-update index pushdown
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 g 2009-03-03 03:03:03
-2 g 2009-03-03 03:03:03
-
-delete
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete all
-DELETE FROM ta_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-
-delete select
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete select a
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete join
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete low_priority
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete ignore
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE IGNORE FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete quick
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE QUICK FROM ta_l WHERE a = 2;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 e 2008-01-01 23:59:59
-3 e 2008-01-01 23:59:59
-4 e 2008-01-01 23:59:59
-5 e 2008-01-01 23:59:59
-6 e 2008-01-01 23:59:59
-7 e 2008-01-01 23:59:59
-8 e 2008-01-01 23:59:59
-9 e 2008-01-01 23:59:59
-10 j 2008-01-01 23:59:59
-
-delete pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE b = 'e';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-10 j 2008-01-01 23:59:59
-
-delete index pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-DELETE FROM ta_l WHERE a > 0 AND b = 'e';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-10 j 2008-01-01 23:59:59
-
-truncate
-TRUNCATE TABLE ta_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result b/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result
deleted file mode 100644
index 9e1201c17c9..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/basic_sql_part.result
+++ /dev/null
@@ -1,121 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'f', '2008-07-01 10:21:39'),
-(2, 'g', '2000-02-01 00:00:00'),
-(3, 'j', '2007-05-04 20:03:11'),
-(4, 'i', '2003-10-30 05:01:03'),
-(5, 'h', '2001-10-31 23:59:59');
-
-create table with partition and select test
-CREATE TABLE ta_l2 (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
-SELECT a, b, c FROM tb_l
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-select partition using pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
-a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-select partition using index pushdown
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
-a.a > 0 AND a.b = 'g' ORDER BY a.a;
-a b date_format(a.c, '%Y-%m-%d %H:%i:%s')
-2 g 2000-02-01 00:00:00
-
-update partition pushdown
-UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 e 2009-03-03 03:03:03
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-update partition index pushdown
-UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-2 g 2000-02-01 00:00:00
-3 j 2009-03-03 03:03:03
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-delete partition pushdown
-TRUNCATE TABLE ta_l2;
-INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
-DELETE FROM ta_l2 WHERE b = 'g';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-delete partition index pushdown
-TRUNCATE TABLE ta_l2;
-INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
-DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 f 2008-07-01 10:21:39
-3 j 2007-05-04 20:03:11
-4 i 2003-10-30 05:01:03
-5 h 2001-10-31 23:59:59
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result
deleted file mode 100644
index fe5752cff65..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate.result
+++ /dev/null
@@ -1,91 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table select test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-direct_aggregating test
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 0
-SELECT COUNT(*) FROM ta_l;
-COUNT(*)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MAX(a) FROM ta_l;
-MAX(a)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MIN(a) FROM ta_l;
-MIN(a)
-1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-MAX(a)
-4
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-MIN(a)
-2
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 1
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result b/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result
deleted file mode 100644
index 9bde4a1746a..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/direct_aggregate_part.result
+++ /dev/null
@@ -1,82 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-with partition test
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 0
-SELECT COUNT(*) FROM ta_l2;
-COUNT(*)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MAX(a) FROM ta_l2;
-MAX(a)
-5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MIN(a) FROM ta_l2;
-MIN(a)
-1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MAX(a) FROM ta_l2 WHERE a < 5;
-MAX(a)
-4
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-SELECT MIN(a) FROM ta_l2 WHERE a > 1;
-MIN(a)
-2
-SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%';
-Variable_name Value
-Spider_direct_aggregate 2
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_update.result b/storage/spider/mysql-test/spider/oracle2/r/direct_update.result
deleted file mode 100644
index 3dc39d5f630..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/direct_update.result
+++ /dev/null
@@ -1,138 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table select test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-direct_updating test
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-update all rows with function
-UPDATE ta_l SET c = ADDDATE(c, 1);
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 e 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key
-UPDATE ta_l SET b = 'x' WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by a column without index
-UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-17 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key with order and limit
-UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by primary key with order and limit
-DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by a column without index
-DELETE FROM ta_l WHERE b = 'c';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-delete by primary key
-DELETE FROM ta_l WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-4 d 2003-12-01 05:01:03
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result b/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result
deleted file mode 100644
index 8a22c40a0da..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/direct_update_part.result
+++ /dev/null
@@ -1,129 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-with partition test
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-update all rows with function
-UPDATE ta_l2 SET c = ADDDATE(c, 1);
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 e 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key
-UPDATE ta_l2 SET b = 'x' WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2007-06-05 20:03:11
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by a column without index
-UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-17 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-update by primary key with order and limit
-UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_update%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-2 b 2000-01-02 00:00:00
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by primary key with order and limit
-DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-5 c 2002-01-01 23:59:59
-delete by a column without index
-DELETE FROM ta_l2 WHERE b = 'c';
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-3 x 2011-10-18 00:00:00
-4 d 2003-12-01 05:01:03
-delete by primary key
-DELETE FROM ta_l2 WHERE a = 3;
-SHOW GLOBAL STATUS LIKE 'Spider_direct_delete%';
-Variable_name Value
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-02 10:21:39
-4 d 2003-12-01 05:01:03
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/function.result b/storage/spider/mysql-test/spider/oracle2/r/function.result
deleted file mode 100644
index 764c774514b..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/function.result
+++ /dev/null
@@ -1,149 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-in()
-CREATE TABLE t1 (
-a VARCHAR(255),
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1
-insert into t1 values ('1');
-insert into t1 select a + 1 from t1;
-insert into t1 select a + 2 from t1;
-insert into t1 select a + 4 from t1;
-insert into t1 select a + 8 from t1;
-insert into t1 select a + 16 from t1;
-insert into t1 select a + 32 from t1;
-insert into t1 select a + 64 from t1;
-insert into t1 select a + 128 from t1;
-insert into t1 select a + 256 from t1;
-insert into t1 select a + 512 from t1;
-flush tables;
-select a from t1 where a in ('15', '120');
-a
-120
-15
-
-date_sub()
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-08-01 10:21:39
-2 b 1999-01-01 00:00:00
-3 e 2006-06-04 20:03:11
-4 d 2002-11-30 05:01:03
-5 c 2000-12-31 23:59:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-11-01 10:21:39
-2 b 1999-04-01 00:00:00
-3 e 2006-09-04 20:03:11
-4 d 2003-02-28 05:01:03
-5 c 2001-03-31 23:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-01 10:21:39
-2 b 1999-03-01 00:00:00
-3 e 2006-08-04 20:03:11
-4 d 2003-01-28 05:01:03
-5 c 2001-02-28 23:59:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-08 10:21:39
-2 b 1999-03-08 00:00:00
-3 e 2006-08-11 20:03:11
-4 d 2003-02-04 05:01:03
-5 c 2001-03-07 23:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 10:21:39
-2 b 1999-03-07 00:00:00
-3 e 2006-08-10 20:03:11
-4 d 2003-02-03 05:01:03
-5 c 2001-03-06 23:59:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 11:21:39
-2 b 1999-03-07 01:00:00
-3 e 2006-08-10 21:03:11
-4 d 2003-02-03 06:01:03
-5 c 2001-03-07 00:59:59
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 11:20:39
-2 b 1999-03-07 00:59:00
-3 e 2006-08-10 21:02:11
-4 d 2003-02-03 06:00:03
-5 c 2001-03-07 00:58:59
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2007-10-07 11:20:40
-2 b 1999-03-07 00:59:01
-3 e 2006-08-10 21:02:12
-4 d 2003-02-03 06:00:04
-5 c 2001-03-07 00:59:00
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/ha.result b/storage/spider/mysql-test/spider/oracle2/r/ha.result
deleted file mode 100644
index 8ca64dec6df..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/ha.result
+++ /dev/null
@@ -1,240 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-CREATE DATABASE auto_test_remote3;
-USE auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 0
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r3' get a problem
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 3
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l 1
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l
-CONNECTION='host "xe", user "system",
- password "oracle", msi "2", mkd "2",
- database "SYSTEM", lst "0 2"';
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 2
-SELECT spider_copy_tables('ta_l', '0', '1');
-spider_copy_tables('ta_l', '0', '1')
-1
-ALTER TABLE ta_l
-CONNECTION='host "xe", user "system",
- password "oracle", msi "2", mkd "2",
- database "SYSTEM", lst "0 1"';
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 1
-INSERT INTO ta_l (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-8 g 2011-05-05 21:33:30
-DROP TABLE ta_l;
-SELECT spider_flush_table_mon_cache();
-spider_flush_table_mon_cache()
-1
-
-active standby test
-create table test
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
-INSERT INTO ta_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 2
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r' get a problem
-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
-auto_test_local ta_l 0 3
-auto_test_local ta_l 1 1
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l 1
-auto_test_local ta_l 0
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 2
-Spider_mon_table_cache_version_req 2
-INSERT INTO ta_l (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l
-CONNECTION='host "xe", user "system",
- password "oracle", msi "2", mkd "2", alc "1",
- database "SYSTEM", lst "1 0"';
-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
-auto_test_local ta_l 0 1
-auto_test_local ta_l 1 1
-INSERT INTO ta_l (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-8 g 2011-05-05 21:33:30
-DROP TABLE ta_l;
-SELECT spider_flush_table_mon_cache();
-spider_flush_table_mon_cache()
-1
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/ha_part.result b/storage/spider/mysql-test/spider/oracle2/r/ha_part.result
deleted file mode 100644
index e11b6f695e0..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/ha_part.result
+++ /dev/null
@@ -1,262 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-CREATE DATABASE auto_test_remote3;
-USE auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table with partition test
-DROP TABLE IF EXISTS ta_l2;
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 0
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r4' get a problem
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 3
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l2#P#pt2 1
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l2
-PARTITION BY KEY(a) (
-PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
-PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 2"'
- );
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 2
-SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1');
-spider_copy_tables('ta_l2#P#pt2', '0', '1')
-1
-ALTER TABLE ta_l2
-PARTITION BY KEY(a) (
-PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
-PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "0 1"'
- );
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30'),
-(9, 'h', '2011-05-05 22:32:10');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-8 g 2011-05-05 21:33:30
-9 h 2011-05-05 22:32:10
-DROP TABLE ta_l2;
-
-create table with partition test
-DROP TABLE IF EXISTS ta_l2;
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-select test
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-fail-over test
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-ERROR HY000: Table 'SYSTEM.ta_r2' get a problem
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 3
-auto_test_local ta_l2#P#pt2 1 1
-SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log;
-db_name table_name link_id
-auto_test_local ta_l2#P#pt2 1
-auto_test_local ta_l2#P#pt2 0
-SHOW GLOBAL STATUS LIKE 'Spider_mon_table_cache_version%';
-Variable_name Value
-Spider_mon_table_cache_version 1
-Spider_mon_table_cache_version_req 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-3 e 2007-06-04 20:03:11
-5 c 2001-12-31 23:59:59
-6 e 2011-05-05 20:04:05
-
-recovery test
-ALTER TABLE ta_l2
-PARTITION BY KEY(a) (
-PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
- priority "1000"',
-PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
- priority "1000001", lst "1 0"'
- );
-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
-auto_test_local ta_l2#P#pt1 0 1
-auto_test_local ta_l2#P#pt1 1 1
-auto_test_local ta_l2#P#pt2 0 1
-auto_test_local ta_l2#P#pt2 1 1
-INSERT INTO ta_l2 (a, b, c) VALUES
-(8, 'g', '2011-05-05 21:33:30'),
-(9, 'h', '2011-05-05 22:32:10');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-3 e 2007-06-04 20:03:11
-5 c 2001-12-31 23:59:59
-8 g 2011-05-05 21:33:30
-9 h 2011-05-05 22:32:10
-DROP TABLE ta_l2;
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-DROP DATABASE IF EXISTS auto_test_remote3;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_local;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result
deleted file mode 100644
index dd6c8715648..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes.result
+++ /dev/null
@@ -1,210 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-3.1
-auto_increment
-DROP TABLE IF EXISTS t1, t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
-CREATE TABLE t2 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2
-SELECT MAX(id) FROM t1;
-MAX(id)
-2
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6
-SELECT MAX(id) FROM t2;
-MAX(id)
-6
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-10
-SELECT MAX(id) FROM t1;
-MAX(id)
-10
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-14
-SELECT MAX(id) FROM t2;
-MAX(id)
-14
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-18
-SELECT id FROM t1 ORDER BY id;
-id
-2
-6
-10
-14
-18
-22
-26
-30
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-34
-SELECT id FROM t2 ORDER BY id;
-id
-2
-6
-10
-14
-18
-22
-26
-30
-34
-38
-42
-46
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-50
-SELECT id FROM t1 ORDER BY id;
-id
-50
-54
-58
-62
-INSERT INTO t2 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-66
-SELECT id FROM t2 ORDER BY id;
-id
-50
-54
-58
-62
-66
-70
-74
-78
-SET INSERT_ID=5000;
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-82
-SELECT MAX(id) FROM t1;
-MAX(id)
-82
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-86
-SELECT MAX(id) FROM t2;
-MAX(id)
-86
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-90
-SELECT MAX(id) FROM t1;
-MAX(id)
-90
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-94
-SELECT MAX(id) FROM t2;
-MAX(id)
-94
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result
deleted file mode 100644
index 38875214eb8..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/spider3_fixes_part.result
+++ /dev/null
@@ -1,208 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-auto_increment with partition
-DROP TABLE IF EXISTS t1, t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
-CREATE TABLE t2 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3
-SELECT MAX(id) FROM t1;
-MAX(id)
-3
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-7
-SELECT MAX(id) FROM t2;
-MAX(id)
-7
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2
-SELECT MAX(id) FROM t1;
-MAX(id)
-7
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6
-SELECT MAX(id) FROM t2;
-MAX(id)
-7
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-10
-SELECT id FROM t1 ORDER BY id;
-id
-2
-3
-6
-7
-10
-11
-14
-15
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-18
-SELECT id FROM t2 ORDER BY id;
-id
-2
-3
-6
-7
-10
-11
-14
-15
-18
-19
-22
-23
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-26
-SELECT id FROM t1 ORDER BY id;
-id
-26
-27
-30
-31
-INSERT INTO t2 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-34
-SELECT id FROM t2 ORDER BY id;
-id
-26
-27
-30
-31
-34
-35
-38
-39
-SET INSERT_ID=5000;
-MASTER_1_AUTO_INCREMENT_OFFSET3
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-42
-SELECT MAX(id) FROM t1;
-MAX(id)
-42
-MASTER_1_AUTO_INCREMENT_OFFSET4
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-43
-SELECT MAX(id) FROM t2;
-MAX(id)
-43
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-46
-SELECT MAX(id) FROM t1;
-MAX(id)
-46
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-50
-SELECT MAX(id) FROM t2;
-MAX(id)
-50
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result
deleted file mode 100644
index 5a41603c746..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes.result
+++ /dev/null
@@ -1,556 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table and insert
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
-2.13
-select table with "order by desc" and "<"
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a < 5 ORDER BY a DESC LIMIT 3;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-4 d 2003-11-30 05:01:03
-3 e 2007-06-04 20:03:11
-2 b 2000-01-01 00:00:00
-
-select table with "order by desc" and "<="
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a <= 5 ORDER BY a DESC LIMIT 3;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-5 c 2001-12-31 23:59:59
-4 d 2003-11-30 05:01:03
-3 e 2007-06-04 20:03:11
-
-2.14
-update table with range scan and split_read
-UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-02-02 00:00:00
-3 e 2000-02-02 00:00:00
-4 d 2000-02-02 00:00:00
-5 c 2000-02-02 00:00:00
-
-2.15
-select table with range scan
-TRUNCATE TABLE ta_l;
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-a int(11) NOT NULL DEFAULT '0',
-b char(1) DEFAULT NULL,
-c datetime DEFAULT NULL,
-PRIMARY KEY (a, b, c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
-AND c = '2001-12-31 23:59:59';
-a b c
-5 c 2001-12-31 23:59:59
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
-AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-a b c
-2 b 2000-01-01 00:00:00
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-a b c
-2 b 2000-01-01 00:00:00
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND b <= 'd' AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND b < 'e' AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
-AND b >= 'b' AND c = '2003-11-30 05:01:03';
-a b c
-4 d 2003-11-30 05:01:03
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
-AND b >= 'b' AND c = '2000-01-01 00:00:00';
-a b c
-2 b 2000-01-01 00:00:00
-
-2.16
-auto_increment insert with trigger
-CREATE TABLE ta_l_auto_inc (
-a INT AUTO_INCREMENT,
-b CHAR(1) DEFAULT 'c',
-c DATETIME DEFAULT '1999-10-10 10:10:10',
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1
-CREATE TABLE tc_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;;
-INSERT INTO ta_l_auto_inc (a, b, c) VALUES
-(NULL, 's', '2008-12-31 20:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 s 2008-12-31 20:59:59
-
-2.17
-engine-condition-pushdown with "or" and joining
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-1 a 2008-08-01 10:21:39
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-2.23
-index merge
-CREATE TABLE ta_l_int (
-a INT AUTO_INCREMENT,
-b INT DEFAULT 10,
-c INT DEFAULT 11,
-PRIMARY KEY(a),
-KEY idx1(b),
-KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
-INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
-SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
-WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
-a b c
-3 4 5
-4 5 6
-5 6 7
-
-2.24
-index scan update without PK
-DROP TABLE IF EXISTS ta_l_int;
-CREATE TABLE ta_l_int (
-a INT NOT NULL,
-b INT DEFAULT 10,
-c INT DEFAULT 11,
-KEY idx1(b),
-KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-a b c
-1 2 3
-2 3 4
-3 4 5
-4 5 6
-5 6 7
-6 7 8
-7 8 9
-8 9 10
-9 10 11
-10 11 12
-11 12 13
-12 13 14
-13 14 15
-14 15 16
-15 16 17
-16 17 18
-INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
-INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
-UPDATE ta_l_int SET c = 4 WHERE b = 2;
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-a b c
-0 2 4
-1 2 4
-2 3 4
-3 4 5
-4 5 6
-5 6 7
-6 7 8
-7 8 9
-8 9 10
-9 10 11
-10 11 12
-11 12 13
-12 13 14
-13 14 15
-14 15 16
-15 16 17
-16 17 18
-18 2 4
-
-2.25
-direct order limit
-SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%';
-Variable_name Value
-Spider_direct_order_limit 0
-SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
-a b c
-1 2 4
-2 3 4
-3 4 5
-SHOW GLOBAL STATUS LIKE 'Spider_direct_order_limit%';
-Variable_name Value
-Spider_direct_order_limit 0
-
-2.26
-lock tables
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-CREATE TABLE t1 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
-CREATE TABLE t2 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
-LOCK TABLES t1 READ, t2 READ;
-UNLOCK TABLES;
-
-auto_increment
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2
-SELECT MAX(id) FROM t1;
-MAX(id)
-2
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6
-SELECT MAX(id) FROM t1;
-MAX(id)
-6
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-10
-SELECT MAX(id) FROM t1;
-MAX(id)
-10
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-14
-SELECT MAX(id) FROM t1;
-MAX(id)
-14
-INSERT INTO t1 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-18
-SELECT id FROM t1 ORDER BY id;
-id
-2
-6
-10
-14
-18
-22
-26
-30
-SET INSERT_ID=5000;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-34
-SELECT MAX(id) FROM t1;
-MAX(id)
-34
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-38
-SELECT MAX(id) FROM t1;
-MAX(id)
-38
-INSERT INTO t1 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-42
-SELECT MAX(id) FROM t1;
-MAX(id)
-42
-
-read only
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1
-SELECT id FROM t1 ORDER BY id;
-id
-2
-6
-10
-14
-18
-22
-26
-30
-34
-38
-42
-INSERT INTO t1 (id) VALUES (1);
-ERROR HY000: Table 'auto_test_local.t1' is read only
-UPDATE t1 SET id = 4 WHERE id = 2;
-ERROR HY000: Table 'auto_test_local.t1' is read only
-DELETE FROM t1 WHERE id = 2;
-ERROR HY000: Table 'auto_test_local.t1' is read only
-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
-
-2.27
-error mode
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1
-SELECT id FROM t1 ORDER BY id;
-id
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-INSERT INTO t1 (id) VALUES (1);
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-DELETE FROM t1;
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-TRUNCATE t1;
-Warnings:
-Error 12712 Error from Oracle -1 942 ORA-00942: ???????????????
-
-Error 12712 Oracle error
-
-3.0
-is null
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-a VARCHAR(255),
-b VARCHAR(255),
-c VARCHAR(255),
-KEY idx1(a,b),
-KEY idx2(b),
-PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1
-insert into t1 values (null, null, '2048');
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a + 32, b + 32, c + 32 from t1;
-insert into t1 select a + 64, b + 64, c + 64 from t1;
-insert into t1 select a + 128, b + 128, c + 128 from t1;
-insert into t1 select a + 256, b + 256, c + 256 from t1;
-insert into t1 select a + 512, b + 512, c + 512 from t1;
-flush tables;
-select a from t1 where a is null order by a limit 30;
-a
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-select b from t1 where b is null order by b limit 30;
-b
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-
-direct_order_limit
-TRUNCATE TABLE t1;
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a, b + 32, c + 32 from t1;
-insert into t1 select a, b + 64, c + 64 from t1;
-insert into t1 select a, b + 128, c + 128 from t1;
-flush tables;
-select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
-a b c
-10 74 74
-10 42 42
-10 234 234
-10 202 202
-10 170 170
-select a, c from t1 where a = '10' order by b desc limit 5;
-a c
-10 74
-10 42
-10 234
-10 202
-10 170
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result
deleted file mode 100644
index 20a5ca1812b..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/spider_fixes_part.result
+++ /dev/null
@@ -1,203 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-for slave1_1
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-
-2.17
-partition with sort
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
-ORDER BY a;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-2 b 2000-01-01 00:00:00
-3 e 2007-06-04 20:03:11
-4 d 2003-11-30 05:01:03
-5 c 2001-12-31 23:59:59
-
-2.23
-partition update with moving partition
-DROP TABLE IF EXISTS ta_l2;
-CREATE TABLE ta_l2 (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
-INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
-UPDATE ta_l2 SET a = 4 WHERE a = 3;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
-a b date_format(c, '%Y-%m-%d %H:%i:%s')
-4 B 2010-09-26 00:00:00
-index merge with partition
-DROP TABLE IF EXISTS ta_l_int;
-CREATE TABLE ta_l_int (
-a INT AUTO_INCREMENT,
-b INT DEFAULT 10,
-c INT DEFAULT 11,
-PRIMARY KEY(a),
-KEY idx1(b),
-KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
-INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
-SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
-WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
-a b c
-3 4 5
-4 5 6
-5 6 7
-
-2.26
-auto_increment with partition
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
-id int(11) NOT NULL AUTO_INCREMENT,
-PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
-MASTER_1_AUTO_INCREMENT_INCREMENT2
-MASTER_1_AUTO_INCREMENT_OFFSET2
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_1"\'; exception when others then null; end;', '', 'srv "s_2_1"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_1" START WITH 2 INCREMENT BY 4', '', 'srv "s_2_1"')
-1
-spider_direct_sql('begin execute immediate \'DROP SEQUENCE "seq_t1_2"\'; exception when others then null; end;', '', 'srv "s_2_2"')
-1
-spider_direct_sql('CREATE SEQUENCE "seq_t1_2" START WITH 3 INCREMENT BY 4', '', 'srv "s_2_2"')
-1
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-3
-SELECT MAX(id) FROM t1;
-MAX(id)
-3
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-2
-SELECT MAX(id) FROM t1;
-MAX(id)
-3
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-7
-SELECT MAX(id) FROM t1;
-MAX(id)
-7
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-6
-SELECT MAX(id) FROM t1;
-MAX(id)
-7
-INSERT INTO t1 () VALUES (),(),(),();
-Warnings:
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-Note 12520 Binlog's auto-inc value is probably different from linked table's auto-inc value
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-10
-SELECT id FROM t1 ORDER BY id;
-id
-2
-3
-6
-7
-10
-11
-14
-15
-SET INSERT_ID=5000;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-18
-SELECT MAX(id) FROM t1;
-MAX(id)
-18
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-22
-SELECT MAX(id) FROM t1;
-MAX(id)
-22
-INSERT INTO t1 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-26
-SELECT MAX(id) FROM t1;
-MAX(id)
-26
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for slave1_1
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result b/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result
deleted file mode 100644
index 15dd29aa4d3..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/r/vp_fixes.result
+++ /dev/null
@@ -1,80 +0,0 @@
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-drop and create databases
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-CREATE DATABASE auto_test_remote;
-USE auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-CREATE DATABASE auto_test_remote2;
-USE auto_test_remote2;
-
-test select 1
-SELECT 1;
-1
-1
-
-create table and insert
-DROP TABLE IF EXISTS tb_l;
-CREATE TABLE tb_l (
-a INT,
-b CHAR(1),
-c DATETIME,
-PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2
-INSERT INTO tb_l (a, b, c) VALUES
-(1, 'a', '2008-08-01 10:21:39'),
-(2, 'b', '2000-01-01 00:00:00'),
-(3, 'e', '2007-06-04 20:03:11'),
-(4, 'd', '2003-11-30 05:01:03'),
-(5, 'c', '2001-12-31 23:59:59');
-DROP TABLE IF EXISTS ta_l;
-CREATE TABLE ta_l (
-PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
-0.9
-create different primary key table
-CREATE TABLE ta_l_int (
-a INT DEFAULT 10,
-b INT AUTO_INCREMENT,
-c INT DEFAULT 11,
-PRIMARY KEY(b)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-create un-correspond primary key table
-DROP TABLE IF EXISTS ta_l_int;
-CREATE TABLE ta_l_int (
-a INT DEFAULT 10,
-b INT DEFAULT 12,
-c INT DEFAULT 11,
-PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1
-INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-
-deinit
-DROP DATABASE IF EXISTS auto_test_local;
-DROP DATABASE IF EXISTS auto_test_remote;
-DROP DATABASE IF EXISTS auto_test_remote2;
-for master_1
-for child2
-child2_1
-child2_2
-child2_3
-for child3
-child3_1
-child3_2
-child3_3
-
-end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/basic_sql.test b/storage/spider/mysql-test/spider/oracle2/t/basic_sql.test
deleted file mode 100644
index 9cf4ce99dc3..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/basic_sql.test
+++ /dev/null
@@ -1,2699 +0,0 @@
-# This test tests by executing basic SQL
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-SELECT a, b, c FROM tb_l;
-if ($MASTER_1_MERGE)
-{
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
- INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_MERGE)
-{
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- SELECT a, b, c FROM tb_l;
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo create table ignore select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'f', '2008-07-01 10:21:39'),
- (2, 'g', '2000-02-01 00:00:00'),
- (3, 'j', '2007-05-04 20:03:11'),
- (4, 'i', '2003-10-30 05:01:03'),
- (5, 'h', '2001-10-31 23:59:59');
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-IGNORE SELECT a, b, c FROM tb_l;
-if ($MASTER_1_MERGE)
-{
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- IGNORE SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
- INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_MERGE)
-{
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- IGNORE SELECT a, b, c FROM tb_l;
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo create table ignore select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
-REPLACE SELECT a, b, c FROM tb_l;
-if ($MASTER_1_MERGE)
-{
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- REPLACE SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
- REPLACE INTO ta_l SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_MERGE)
-{
- eval CREATE TABLE ta_l (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1
- REPLACE SELECT a, b, c FROM tb_l;
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo create no index table
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES3;
- echo CHILD2_1_CREATE_TABLES3;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES3;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES3;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l_no_idx;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l_no_idx
-MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1
-SELECT a, b, c FROM tb_l;
-if ($MASTER_1_NEEDPK)
-{
- --error ER_REQUIRES_PRIMARY_KEY
- eval CREATE TABLE ta_l_no_idx
- $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l_no_idx (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
- INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
-}
-if (!$MASTER_1_NEEDPK)
-{
- if ($MASTER_1_MERGE)
- {
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l_no_idx
- $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l_no_idx (
- a INT,
- b CHAR(1),
- c DATETIME
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1;
- INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l;
- }
- if (!$MASTER_1_MERGE)
- {
- eval CREATE TABLE ta_l_no_idx
- $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1
- SELECT a, b, c FROM tb_l;
- }
-}
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES3;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a;
-
---echo
---echo select table
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table shared mode
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-LOCK IN SHARE MODE;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table for update
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a
-FOR UPDATE;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table join
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b
-WHERE a.a = b.a ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table straight_join
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s')
-FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_small_result
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_big_result
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_buffer_result
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_cache
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_no_cache
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select sql_calc_found_rows
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT SQL_CALC_FOUND_ROWS a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a LIMIT 4;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT found_rows();
-
---echo
---echo select high_priority
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select distinct
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select count
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT count(*) FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table join not use index
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
-EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select using pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.b = 'g' ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select using index and pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE
-a.a > 0 AND a.b = 'g' ORDER BY a.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo insert
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert select
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert select a
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert low_priority
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert high_priority
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e',
-'2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert ignore
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert update (insert)
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo insert update (update)
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE
-KEY UPDATE b = 'f', c = '2005-08-08 11:11:11';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace
---connection master_1
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace select
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace select a
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1),
-'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo replace low_priority
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g',
-'2009-03-03 03:03:03');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update select
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM
-tb_l);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update select a
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM
-tb_l ORDER BY a LIMIT 1);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update join
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update join a
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE
-a.a = b.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update low_priority
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update ignore
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo update index pushdown
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete all
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete select
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete select a
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete join
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete low_priority
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE LOW_PRIORITY FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete ignore
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE IGNORE FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete quick
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE QUICK FROM ta_l WHERE a = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE b = 'e';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo delete index pushdown
-TRUNCATE TABLE ta_l;
-INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'),
-(2, 'e', '2008-01-01 23:59:59'), (3, 'e', '2008-01-01 23:59:59'),
-(4, 'e', '2008-01-01 23:59:59'), (5, 'e', '2008-01-01 23:59:59'),
-(6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'),
-(8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'),
-(10, 'j', '2008-01-01 23:59:59');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-DELETE FROM ta_l WHERE a > 0 AND b = 'e';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo truncate
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-TRUNCATE TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test b/storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test
deleted file mode 100644
index 1bb18358d5d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/basic_sql_part.test
+++ /dev/null
@@ -1,571 +0,0 @@
-# This test tests by executing basic SQL
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'f', '2008-07-01 10:21:39'),
- (2, 'g', '2000-02-01 00:00:00'),
- (3, 'j', '2007-05-04 20:03:11'),
- (4, 'i', '2003-10-30 05:01:03'),
- (5, 'h', '2001-10-31 23:59:59');
-
---echo
---echo create table with partition and select test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1
- SELECT a, b, c FROM tb_l;
- if ($MASTER_1_MERGE)
- {
- --error ER_WRONG_OBJECT
- eval CREATE TABLE ta_l2 (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
- SELECT a, b, c FROM tb_l;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1;
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- }
- if (!$MASTER_1_MERGE)
- {
- eval CREATE TABLE ta_l2 (
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1
- SELECT a, b, c FROM tb_l;
- }
- --enable_query_log
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo select partition using pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
- a.b = 'g' ORDER BY a.a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo select partition using index pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE
- a.a > 0 AND a.b = 'g' ORDER BY a.a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo update partition pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo update partition index pushdown
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo delete partition pushdown
-if ($HAVE_PARTITION)
-{
- TRUNCATE TABLE ta_l2;
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- DELETE FROM ta_l2 WHERE b = 'g';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo delete partition index pushdown
-if ($HAVE_PARTITION)
-{
- TRUNCATE TABLE ta_l2;
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- DELETE FROM ta_l2 WHERE a > 0 AND b = 'g';
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc
deleted file mode 100644
index cd9b0c9ca9b..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc
deleted file mode 100644
index e145f66b630..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_2.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc
deleted file mode 100644
index d356348d8ea..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_child2_3.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc
deleted file mode 100644
index 03e5c188c89..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc
deleted file mode 100644
index d62a7ada824..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_2.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc
deleted file mode 100644
index fb49f5bfdac..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_child3_3.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc
deleted file mode 100644
index 0c129ce5775..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_master_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc b/storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc
deleted file mode 100644
index 45a822743e0..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/connect_slave1_1.inc
+++ /dev/null
@@ -1 +0,0 @@
---connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK)
diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test
deleted file mode 100644
index 5c0c37f483d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate.test
+++ /dev/null
@@ -1,179 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_aggregating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT COUNT(*) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MAX(a) FROM ta_l WHERE a < 5;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-SELECT MIN(a) FROM ta_l WHERE a > 1;
-eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test
deleted file mode 100644
index cb0b55e9788..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/direct_aggregate_part.test
+++ /dev/null
@@ -1,192 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT COUNT(*) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MAX(a) FROM ta_l2 WHERE a < 5;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- SELECT MIN(a) FROM ta_l2 WHERE a > 1;
- eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_update.test b/storage/spider/mysql-test/spider/oracle2/t/direct_update.test
deleted file mode 100644
index 94f27e2859c..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/direct_update.test
+++ /dev/null
@@ -1,198 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo direct_updating test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update all rows with function
-UPDATE ta_l SET c = ADDDATE(c, 1);
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update by primary key
-UPDATE ta_l SET b = 'x' WHERE a = 3;
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update by a column without index
-UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x';
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo update by primary key with order and limit
-UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
-eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo delete by primary key with order and limit
-DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1;
-eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo delete by a column without index
-DELETE FROM ta_l WHERE b = 'c';
-eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
---echo delete by primary key
-DELETE FROM ta_l WHERE a = 3;
-eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test b/storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test
deleted file mode 100644
index e8f1882594c..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/direct_update_part.test
+++ /dev/null
@@ -1,211 +0,0 @@
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo with partition test
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
- --enable_query_log
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update all rows with function
- UPDATE ta_l2 SET c = ADDDATE(c, 1);
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update by primary key
- UPDATE ta_l2 SET b = 'x' WHERE a = 3;
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update by a column without index
- UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x';
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo update by primary key with order and limit
- UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1;
- eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo delete by primary key with order and limit
- DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1;
- eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo delete by a column without index
- DELETE FROM ta_l2 WHERE b = 'c';
- eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- --echo delete by primary key
- DELETE FROM ta_l2 WHERE a = 3;
- eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/function.test b/storage/spider/mysql-test/spider/oracle2/t/function.test
deleted file mode 100644
index 2472e774782..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/function.test
+++ /dev/null
@@ -1,253 +0,0 @@
-# This test tests for using functions
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo in()
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TEXT_PK_TABLES1;
- echo CHILD2_1_CREATE_TEXT_PK_TABLES1;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TEXT_PK_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_TEXT_PK_TABLES1;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1;
-eval CREATE TABLE t1 (
- a VARCHAR(255),
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1;
---enable_query_log
-insert into t1 values ('1');
-insert into t1 select a + 1 from t1;
-insert into t1 select a + 2 from t1;
-insert into t1 select a + 4 from t1;
-insert into t1 select a + 8 from t1;
-insert into t1 select a + 16 from t1;
-insert into t1 select a + 32 from t1;
-insert into t1 select a + 64 from t1;
-insert into t1 select a + 128 from t1;
-insert into t1 select a + 256 from t1;
-insert into t1 select a + 512 from t1;
-flush tables;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-select a from t1 where a in ('15', '120');
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo date_sub()
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 YEAR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 QUARTER);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MONTH);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 WEEK);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 DAY);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 HOUR);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE);
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha.test b/storage/spider/mysql-test/spider/oracle2/t/ha.test
deleted file mode 100644
index c36b7363a6d..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/ha.test
+++ /dev/null
@@ -1,878 +0,0 @@
-# This test tests for ha features
-if ($USE_HA_TEST)
-{
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source ha_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
- CREATE DATABASE auto_test_remote3;
- USE auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- --connection child2_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- SELECT 1;
- --connection child3_2
- SELECT 1;
- --connection child3_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo fail-over test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_HA_DROP_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_HA_DROP_TABLES;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_HA_STATUS;
---error 12511
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-eval $MASTER_1_CHECK_LINK_STATUS;
-eval $MASTER_1_CHECK_LINK_FAILED_LOG;
-eval $MASTER_1_CHECK_HA_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo recovery test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_HA_CREATE_TABLES;
- }
- eval $CHILD2_2_HA_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_RECOVERY_STATUS_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_RECOVERY_STATUS_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_RECOVERY_STATUS_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
-eval $MASTER_1_CHECK_LINK_STATUS;
-eval $MASTER_1_COPY_TABLES_2_1;
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_SET_OK_STATUS_2_1;
-eval $MASTER_1_CHECK_LINK_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-DROP TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
-eval $MASTER_1_CHANGE_HA_MON;
-
---echo
---echo active standby test
---echo create table test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1;
---enable_query_log
-INSERT INTO ta_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo select test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo fail-over test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_DROP_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_HA_AS_DROP_TABLES;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_CHECK_HA_STATUS;
---error 12511
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-eval $MASTER_1_CHECK_LINK_STATUS;
-eval $MASTER_1_CHECK_LINK_FAILED_LOG;
-eval $MASTER_1_CHECK_HA_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo recovery test
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_CREATE_TABLES;
- }
- eval $CHILD2_1_HA_AS_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_AS_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_AS_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_AS_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-eval $MASTER_1_SET_OK_STATUS_AS_2_1;
-eval $MASTER_1_CHECK_LINK_STATUS;
-INSERT INTO ta_l (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30');
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-DROP TABLE ta_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
-eval $MASTER_1_CHANGE_HA_MON;
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
-}
---disable_query_log
---disable_result_log
---source ha_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
-}
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha_part.test b/storage/spider/mysql-test/spider/oracle2/t/ha_part.test
deleted file mode 100644
index 33fe9850b68..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/ha_part.test
+++ /dev/null
@@ -1,1017 +0,0 @@
-# This test tests for ha features
-if ($USE_HA_TEST)
-{
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source ha_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source ha_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
- CREATE DATABASE auto_test_remote3;
- USE auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- --connection child2_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-if ($USE_CHILD_GROUP3)
-{
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- SELECT 1;
- --connection child3_2
- SELECT 1;
- --connection child3_3
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-if ($HAVE_PARTITION)
-{
- --echo
- --echo create table with partition test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_DROP_TABLES;
- echo CHILD2_3_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_3_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_3_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_P_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_P_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_P_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
- --echo
- --echo select test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo fail-over test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_HA_DROP_TABLES;
- }
- --disable_warnings
- eval $CHILD2_3_HA_DROP_TABLES;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_CHECK_HA_STATUS;
- --error 12511
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- eval $MASTER_1_CHECK_LINK_STATUS;
- eval $MASTER_1_CHECK_LINK_FAILED_LOG;
- eval $MASTER_1_CHECK_HA_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo recovery test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_HA_CREATE_TABLES;
- }
- eval $CHILD2_3_HA_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
- eval $MASTER_1_CHECK_LINK_STATUS;
- eval $MASTER_1_COPY_TABLES_P_2_1;
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_P_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_P_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_P_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_SET_OK_STATUS_P_2_1;
- eval $MASTER_1_CHECK_LINK_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30'),
- (9, 'h', '2011-05-05 22:32:10');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- DROP TABLE ta_l2;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-if ($HAVE_PARTITION)
-{
- --echo
- --echo create table with partition test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_3_DROP_TABLES;
- echo CHILD2_3_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_3_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_3_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1;
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1;
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
- --echo
- --echo select test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo fail-over test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_DROP_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_HA_AS_DROP_TABLES2;
- --enable_warnings
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_CHECK_HA_STATUS;
- --error 12511
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- eval $MASTER_1_CHECK_LINK_STATUS;
- eval $MASTER_1_CHECK_LINK_FAILED_LOG;
- eval $MASTER_1_CHECK_HA_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (6, 'e', '2011-05-05 20:04:05');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_CHECK_LINK_STATUS;
- eval $CHILD3_1_CHECK_LINK_FAILED_LOG;
- --connection child3_2
- eval $CHILD3_2_CHECK_LINK_STATUS;
- eval $CHILD3_2_CHECK_LINK_FAILED_LOG;
- --connection child3_3
- eval $CHILD3_3_CHECK_LINK_STATUS;
- eval $CHILD3_3_CHECK_LINK_FAILED_LOG;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-
- --echo
- --echo recovery test
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_HA_AS_CREATE_TABLES2;
- }
- eval $CHILD2_1_HA_AS_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1;
- eval $CHILD3_1_CHECK_LINK_STATUS;
- --connection child3_2
- eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1;
- eval $CHILD3_2_CHECK_LINK_STATUS;
- --connection child3_3
- eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1;
- eval $CHILD3_3_CHECK_LINK_STATUS;
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- eval $MASTER_1_SET_OK_STATUS_AS_P_2_1;
- eval $MASTER_1_CHECK_LINK_STATUS;
- INSERT INTO ta_l2 (a, b, c) VALUES
- (8, 'g', '2011-05-05 21:33:30'),
- (9, 'h', '2011-05-05 22:32:10');
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a;
- DROP TABLE ta_l2;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES;
- eval $CHILD2_1_SELECT_TABLES2;
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_3
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_3_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- if ($USE_CHILD_GROUP3)
- {
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child3_1
- --disable_warnings
- eval $CHILD3_1_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_2
- --disable_warnings
- eval $CHILD3_2_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- --connection child3_3
- --disable_warnings
- eval $CHILD3_3_DROP_TABLES_HA_P_2_1;
- --enable_warnings
- if (!$OUTPUT_CHILD_GROUP3)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- --connection child2_3
- DROP DATABASE IF EXISTS auto_test_remote3;
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_2
- DROP DATABASE IF EXISTS auto_test_local;
- --connection child3_3
- DROP DATABASE IF EXISTS auto_test_local;
-}
---disable_query_log
---disable_result_log
---source ha_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
-}
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc
deleted file mode 100644
index 53d0409d066..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/ha_test_deinit.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/ha_deinit_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/ha_deinit_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/ha_deinit_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/ha_deinit_child2_3.inc
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --connection child3_1
- --source ../include/ha_deinit_child3_1.inc
- --echo child3_2
- --connection child3_2
- --source ../include/ha_deinit_child3_2.inc
- --echo child3_3
- --connection child3_3
- --source ../include/ha_deinit_child3_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc
deleted file mode 100644
index 70576ab16dc..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/ha_test_init.inc
+++ /dev/null
@@ -1,30 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/ha_init_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/ha_init_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/ha_init_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/ha_init_child2_3.inc
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --connection child3_1
- --source ../include/ha_init_child3_1.inc
- --echo child3_2
- --connection child3_2
- --source ../include/ha_init_child3_2.inc
- --echo child3_3
- --connection child3_3
- --source ../include/ha_init_child3_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_engine.inc b/storage/spider/mysql-test/spider/oracle2/t/have_engine.inc
deleted file mode 100644
index 64bef7499cb..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/have_engine.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-if (!`SELECT count(*) FROM information_schema.engines WHERE
- (support = 'YES' OR support = 'DEFAULT') AND
- engine = '$TEST_ENGINE_TYPE'`)
-{
- SELECT engine, support FROM information_schema.engines;
- --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine"
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_func.inc b/storage/spider/mysql-test/spider/oracle2/t/have_func.inc
deleted file mode 100644
index e0823e73fc8..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/have_func.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`)
-{
- SELECT name FROM mysql.func;
- --let $SKIP_REASON= "Need $TEST_FUNC_NAME function"
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc b/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc
deleted file mode 100644
index b6e699475db..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/have_partition.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-let $HAVE_PARTITION= 0;
-if (`SELECT count(*) FROM information_schema.plugins WHERE
- plugin_status = 'ACTIVE' AND
- plugin_name = 'partition'`)
-{
- let $HAVE_PARTITION= 1;
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc b/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc
deleted file mode 100644
index 32de484b388..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/have_trigger.inc
+++ /dev/null
@@ -1,2 +0,0 @@
-let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables
- WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`;
diff --git a/storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc
deleted file mode 100644
index 7ec2e981fd2..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/hs_test_deinit.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/hs_deinit_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/hs_deinit_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/hs_deinit_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/hs_deinit_child2_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc
deleted file mode 100644
index 831bf479524..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/hs_test_init.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/hs_init_master_1.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/hs_init_child2_1.inc
- --echo child2_2
- --connection child2_2
- --source ../include/hs_init_child2_2.inc
- --echo child2_3
- --connection child2_3
- --source ../include/hs_init_child2_3.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc
deleted file mode 100644
index e9d99b7a960..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/slave_test_deinit.inc
+++ /dev/null
@@ -1,6 +0,0 @@
-# get connection and exist engine test
---echo for slave1_1
---connection slave1_1
-STOP SLAVE;
---source ../include/deinit_slave1_1.inc
---disconnect slave1_1
diff --git a/storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc
deleted file mode 100644
index 739d88970c5..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/slave_test_init.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-# get connection and exist engine test
---echo for slave1_1
---source connect_slave1_1.inc
---connection slave1_1
-SET SESSION sql_log_bin= 0;
---let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id`
---let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE
---source have_partition.inc
---source have_trigger.inc
---source ../include/init_slave1_1.inc
---source have_engine.inc
---let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS`
-if (!$SLAVE1_1_SLAVE_STATUS)
-{
- eval CHANGE MASTER TO
- MASTER_HOST = '127.0.0.1',
- MASTER_USER = 'root',
- MASTER_PASSWORD = '',
- MASTER_PORT = $MASTER_1_MYPORT
- ;
-}
-START SLAVE;
---connection master_1
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---connection slave1_1
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child2_2
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child2_3
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-}
-if ($USE_CHILD_GROUP3)
-{
- --connection child3_1
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child3_2
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
- --connection child3_3
- call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test
deleted file mode 100644
index 962abbad19f..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes.test
+++ /dev/null
@@ -1,292 +0,0 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo 3.1
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-INSERT INTO t2 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t2 ORDER BY id;
-SET INSERT_ID=5000;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET3;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
---disable_query_log
-echo MASTER_1_AUTO_INCREMENT_OFFSET4;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
---enable_query_log
-INSERT INTO t2 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t2 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t2;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test
deleted file mode 100644
index c609108ca9e..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/spider3_fixes_part.test
+++ /dev/null
@@ -1,345 +0,0 @@
-# This test tests for Spider 3.0's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1, t2;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- echo CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- TRUNCATE TABLE t1;
- TRUNCATE TABLE t2;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t2 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t2 ORDER BY id;
- SET INSERT_ID=5000;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET3;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET3;
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- --disable_query_log
- echo MASTER_1_AUTO_INCREMENT_OFFSET4;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET4;
- --enable_query_log
- INSERT INTO t2 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t2 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t2;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test
deleted file mode 100644
index d0158c7dc0b..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes.test
+++ /dev/null
@@ -1,1419 +0,0 @@
-# This test tests for Spider's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table and insert
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
---echo
---echo 2.13
---echo select table with "order by desc" and "<"
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a < 5 ORDER BY a DESC LIMIT 3;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo select table with "order by desc" and "<="
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l
-WHERE a <= 5 ORDER BY a DESC LIMIT 3;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.14
---echo update table with range scan and split_read
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a;
-
---echo
---echo 2.15
---echo select table with range scan
-TRUNCATE TABLE ta_l;
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES6;
- echo CHILD2_1_CREATE_TABLES6;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES6;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES6;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l (
- a int(11) NOT NULL DEFAULT '0',
- b char(1) DEFAULT NULL,
- c datetime DEFAULT NULL,
- PRIMARY KEY (a, b, c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1;
-eval CREATE TABLE ta_l (
- a int(11) NOT NULL DEFAULT '0',
- b char(1) DEFAULT NULL,
- c datetime DEFAULT NULL,
- PRIMARY KEY (a, b, c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1;
---enable_query_log
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c'
-AND c = '2001-12-31 23:59:59';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e'
-AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b'
-AND c = '2000-01-01 00:00:00';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b'
-AND b <= 'd' AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b'
-AND b < 'e' AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1
-AND b >= 'b' AND c = '2003-11-30 05:01:03';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1
-AND b >= 'b' AND c = '2000-01-01 00:00:00';
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.16
---echo auto_increment insert with trigger
-if ($HAVE_TRIGGER)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES4;
- echo CHILD2_1_CREATE_TABLES4;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES4;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES4;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1;
- eval CREATE TABLE ta_l_auto_inc (
- a INT AUTO_INCREMENT,
- b CHAR(1) DEFAULT 'c',
- c DATETIME DEFAULT '1999-10-10 10:10:10',
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1;
- echo CREATE TABLE tc_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
- eval CREATE TABLE tc_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
- --enable_query_log
- --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- INSERT INTO ta_l_auto_inc (a, b, c) VALUES
- (NULL, 's', '2008-12-31 20:59:59');
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES4;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a;
-}
-
---echo
---echo 2.17
---echo engine-condition-pushdown with "or" and joining
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.23
---echo index merge
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-eval CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
---enable_query_log
-INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
-INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
-INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
-WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo 2.24
---echo index scan update without PK
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l_int;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- KEY idx1(b),
- KEY idx2(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-if ($MASTER_1_NEEDPK)
-{
- --error ER_REQUIRES_PRIMARY_KEY
- eval CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
- eval CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
-}
-if (!$MASTER_1_NEEDPK)
-{
- eval CREATE TABLE ta_l_int (
- a INT NOT NULL,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
-}
---enable_query_log
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3);
-INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3);
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-UPDATE ta_l_int SET c = 4 WHERE b = 2;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-SELECT a, b, c FROM ta_l_int ORDER BY a;
-
-
---echo
---echo 2.25
---echo direct order limit
---connection master_1
-eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
-SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3;
-eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS;
-
-
---echo
---echo 2.26
---echo lock tables
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_LOCK_TABLES1;
- echo CHILD2_1_DROP_LOCK_TABLES2;
- echo CHILD2_1_CREATE_LOCK_TABLES1;
- echo CHILD2_1_CREATE_LOCK_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_LOCK_TABLES1;
- eval $CHILD2_1_DROP_LOCK_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_LOCK_TABLES1;
- eval $CHILD2_1_CREATE_LOCK_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_LOCK_TABLES1;
- echo CHILD2_2_DROP_LOCK_TABLES2;
- echo CHILD2_2_CREATE_LOCK_TABLES1;
- echo CHILD2_2_CREATE_LOCK_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_LOCK_TABLES1;
- eval $CHILD2_2_DROP_LOCK_TABLES2;
- --enable_warnings
- eval $CHILD2_2_CREATE_LOCK_TABLES1;
- eval $CHILD2_2_CREATE_LOCK_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1;
-echo CREATE TABLE t2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2;
-eval CREATE TABLE t2 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2;
---enable_query_log
-LOCK TABLES t1 READ, t2 READ;
-UNLOCK TABLES;
-
-
---echo
---echo auto_increment
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1;
-echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
-echo MASTER_1_AUTO_INCREMENT_OFFSET2;
-eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1;
-eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
-eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
-if ($USE_REPLICATION)
-{
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1;
- --connection master_1
-}
---enable_query_log
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (null);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 () VALUES (),(),(),();
-SELECT LAST_INSERT_ID();
-SELECT id FROM t1 ORDER BY id;
-SET INSERT_ID=5000;
-INSERT INTO t1 () VALUES ();
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (10000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-INSERT INTO t1 (id) VALUES (1000);
-SELECT LAST_INSERT_ID();
-SELECT MAX(id) FROM t1;
-if ($USE_REPLICATION)
-{
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo read only
-let $MASTER_1_ENGINE_IS_SPIDER=
- `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR
- '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`;
-if ($MASTER_1_ENGINE_IS_SPIDER)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1;
- --let $MIN_VAL= `SELECT MIN(id) FROM t1`
- --enable_query_log
- SELECT id FROM t1 ORDER BY id;
- --error 12518
- INSERT INTO t1 (id) VALUES (1);
- --error 12518
- eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL;
- --error 12518
- eval DELETE FROM t1 WHERE id = $MIN_VAL;
- --error 12518
- DELETE FROM t1;
- --error 12518
- TRUNCATE t1;
-}
-if (!$MASTER_1_ENGINE_IS_SPIDER)
-{
- --echo skipped
-}
-
-
---echo
---echo 2.27
---echo error mode
-if ($MASTER_1_ENGINE_IS_SPIDER)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1;
- --enable_query_log
- SELECT id FROM t1 ORDER BY id;
- INSERT INTO t1 (id) VALUES (1);
- DELETE FROM t1;
- TRUNCATE t1;
-}
-if (!$MASTER_1_ENGINE_IS_SPIDER)
-{
- --echo skipped
-}
-
-
---echo
---echo 3.0
---echo is null
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TEXT_KEY_TABLES1;
- echo CHILD2_1_CREATE_TEXT_KEY_TABLES1;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TEXT_KEY_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
---disable_query_log
-echo CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1;
-eval CREATE TABLE t1 (
- a VARCHAR(255),
- b VARCHAR(255),
- c VARCHAR(255),
- KEY idx1(a,b),
- KEY idx2(b),
- PRIMARY KEY(c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1;
---enable_query_log
-insert into t1 values (null, null, '2048');
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a + 32, b + 32, c + 32 from t1;
-insert into t1 select a + 64, b + 64, c + 64 from t1;
-insert into t1 select a + 128, b + 128, c + 128 from t1;
-insert into t1 select a + 256, b + 256, c + 256 from t1;
-insert into t1 select a + 512, b + 512, c + 512 from t1;
-flush tables;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-select a from t1 where a is null order by a limit 30;
-select b from t1 where b is null order by b limit 30;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo direct_order_limit
---connection master_1
-TRUNCATE TABLE t1;
-insert into t1 values ('1', '1', '1');
-insert into t1 select a + 1, b + 1, c + 1 from t1;
-insert into t1 select a + 2, b + 2, c + 2 from t1;
-insert into t1 select a + 4, b + 4, c + 4 from t1;
-insert into t1 select a + 8, b + 8, c + 8 from t1;
-insert into t1 select a + 16, b + 16, c + 16 from t1;
-insert into t1 select a, b + 32, c + 32 from t1;
-insert into t1 select a, b + 64, c + 64 from t1;
-insert into t1 select a, b + 128, c + 128 from t1;
-flush tables;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5;
-select a, c from t1 where a = '10' order by b desc limit 5;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TEXT_PK_TABLES1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test
deleted file mode 100644
index 3053b0008e7..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/spider_fixes_part.test
+++ /dev/null
@@ -1,645 +0,0 @@
-# This test tests for Spider's bug fixes
-source include/have_log_bin.inc;
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---source slave_test_init.inc
---enable_result_log
---enable_query_log
-if (!$HAVE_PARTITION)
-{
- --disable_query_log
- --disable_result_log
- --source slave_test_deinit.inc
- --source test_deinit.inc
- --enable_result_log
- --enable_query_log
- --enable_warnings
- skip Test requires partitioning;
-}
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
- CREATE DATABASE auto_test_local;
- USE auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
-
---echo
---echo 2.17
---echo partition with sort
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
- ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo
---echo 2.23
---echo partition update with moving partition
-if ($HAVE_PARTITION)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l2;
- --enable_warnings
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_TABLES;
- echo CHILD2_2_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES2;
- echo CHILD2_1_CREATE_TABLES2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES2;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1;
- eval CREATE TABLE ta_l2 (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
- ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1;
- --enable_query_log
- INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
- UPDATE ta_l2 SET a = 4 WHERE a = 3;
- SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_2_SELECT_TABLES;
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %';
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %';
- }
- eval $CHILD2_1_SELECT_TABLES2;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
---echo index merge with partition
-if ($HAVE_PARTITION)
-{
- --connection master_1
- --disable_warnings
- DROP TABLE IF EXISTS ta_l_int;
- --enable_warnings
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_2_DROP_TABLES5;
- echo CHILD2_2_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_2_CREATE_TABLES5;
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
- }
- --connection master_1
- --disable_query_log
- echo CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1;
- eval CREATE TABLE ta_l_int (
- a INT AUTO_INCREMENT,
- b INT DEFAULT 10,
- c INT DEFAULT 11,
- PRIMARY KEY(a),
- KEY idx1(b),
- KEY idx2(c)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1;
- --enable_query_log
- INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
- INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
- INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
- INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
- INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
- WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %';
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo 2.26
---echo auto_increment with partition
-if ($HAVE_PARTITION)
-{
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_INCREMENT_TABLES1;
- echo CHILD2_1_CREATE_INCREMENT_TABLES1;
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_1_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- --connection child2_2
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_DROP_INCREMENT_TABLES1;
- echo CHILD2_2_CREATE_INCREMENT_TABLES1;
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET2;
- }
- --disable_warnings
- eval $CHILD2_2_DROP_INCREMENT_TABLES1;
- --enable_warnings
- eval $CHILD2_2_CREATE_INCREMENT_TABLES1;
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET2;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
- --connection master_1
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- --disable_query_log
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1;
- echo MASTER_1_AUTO_INCREMENT_INCREMENT2;
- echo MASTER_1_AUTO_INCREMENT_OFFSET2;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1;
- eval $MASTER_1_AUTO_INCREMENT_INCREMENT2;
- eval $MASTER_1_AUTO_INCREMENT_OFFSET2;
- if ($USE_REPLICATION)
- {
- SET SESSION sql_log_bin= 1;
- --connection slave1_1
- --disable_warnings
- DROP TABLE IF EXISTS t1;
- --enable_warnings
- echo CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1;
- eval CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
- ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1;
- --connection master_1
- }
- --enable_query_log
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (null);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 () VALUES (),(),(),();
- SELECT LAST_INSERT_ID();
- SELECT id FROM t1 ORDER BY id;
- SET INSERT_ID=5000;
- INSERT INTO t1 () VALUES ();
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (10000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- INSERT INTO t1 (id) VALUES (1000);
- SELECT LAST_INSERT_ID();
- SELECT MAX(id) FROM t1;
- if ($USE_REPLICATION)
- {
- save_master_pos;
- --connection slave1_1
- sync_with_master;
- SELECT id FROM t1 ORDER BY id;
- --connection master_1
- --disable_query_log
- SET SESSION sql_log_bin= 0;
- --enable_query_log
- }
- if ($USE_CHILD_GROUP2)
- {
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_1_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_1_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- --connection child2_2
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_2_SELECT_INCREMENT_TABLES1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- echo CHILD2_2_AUTO_INCREMENT_OFFSET1;
- }
- eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1;
- eval $CHILD2_2_AUTO_INCREMENT_OFFSET1;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
- }
-}
-
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_REPLICATION)
-{
- --connection slave1_1
- DROP DATABASE IF EXISTS auto_test_local;
-}
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source slave_test_deinit.inc
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc b/storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc
deleted file mode 100644
index 989bde26d3c..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/test_deinit.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---connection master_1
---source ../include/deinit_master_1.inc
---disconnect master_1
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --connection child2_1
- --source ../include/deinit_child2_1.inc
- --disconnect child2_1
- --echo child2_2
- --connection child2_2
- --source ../include/deinit_child2_2.inc
- --disconnect child2_2
- --echo child2_3
- --connection child2_3
- --source ../include/deinit_child2_3.inc
- --disconnect child2_3
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --connection child3_1
- --source ../include/deinit_child3_1.inc
- --disconnect child3_1
- --echo child3_2
- --connection child3_2
- --source ../include/deinit_child3_2.inc
- --disconnect child3_2
- --echo child3_3
- --connection child3_3
- --source ../include/deinit_child3_3.inc
- --disconnect child3_3
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/test_init.inc b/storage/spider/mysql-test/spider/oracle2/t/test_init.inc
deleted file mode 100644
index f2cd6c0269f..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/test_init.inc
+++ /dev/null
@@ -1,74 +0,0 @@
-# get connection and exist engine test
---echo for master_1
---source connect_master_1.inc
---connection master_1
-CALL mtr.add_suppression("unknown variable");
-SET SESSION sql_log_bin= 0;
---let $MASTER_1_SERVER_ID=`SELECT @@global.server_id`
---let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE
---source have_partition.inc
---source have_trigger.inc
---source ../include/init_master_1.inc
---source have_engine.inc
---echo for child2
-if ($USE_CHILD_GROUP2)
-{
- --echo child2_1
- --source connect_child2_1.inc
- --connection child2_1
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE
- --source ../include/init_child2_1.inc
- --source have_engine.inc
- --echo child2_2
- --source connect_child2_2.inc
- --connection child2_2
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE
- --source ../include/init_child2_2.inc
- --source have_engine.inc
- --echo child2_3
- --source connect_child2_3.inc
- --connection child2_3
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE
- --source ../include/init_child2_3.inc
- --source have_engine.inc
-}
---echo for child3
-if ($USE_CHILD_GROUP3)
-{
- --echo child3_1
- --source connect_child3_1.inc
- --connection child3_1
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE
- --source ../include/init_child3_1.inc
- --source have_engine.inc
- --echo child3_2
- --source connect_child3_2.inc
- --connection child3_2
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE
- --source ../include/init_child3_2.inc
- --source have_engine.inc
- --echo child3_3
- --source connect_child3_3.inc
- --connection child3_3
- CALL mtr.add_suppression("unknown variable *");
- SET SESSION sql_log_bin= 0;
- --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id`
- --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE
- --source ../include/init_child3_3.inc
- --source have_engine.inc
-}
diff --git a/storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test b/storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test
deleted file mode 100644
index 2c3e1523611..00000000000
--- a/storage/spider/mysql-test/spider/oracle2/t/vp_fixes.test
+++ /dev/null
@@ -1,335 +0,0 @@
-# This test tests for VP's bug fixes
---disable_warnings
---disable_query_log
---disable_result_log
---source test_init.inc
---enable_result_log
---enable_query_log
-
---echo
---echo drop and create databases
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-CREATE DATABASE auto_test_local;
-USE auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- CREATE DATABASE auto_test_remote;
- USE auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
- CREATE DATABASE auto_test_remote2;
- USE auto_test_remote2;
-}
---enable_warnings
-
---echo
---echo test select 1
---connection master_1
-SELECT 1;
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- SELECT 1;
- --connection child2_2
- SELECT 1;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo create table and insert
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- echo CHILD2_1_DROP_TABLES;
- echo CHILD2_1_CREATE_TABLES;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES;
- if ($OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- }
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS tb_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) MASTER_1_ENGINE2 MASTER_1_CHARSET2;
-eval CREATE TABLE tb_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2;
---enable_query_log
-INSERT INTO tb_l (a, b, c) VALUES
- (1, 'a', '2008-08-01 10:21:39'),
- (2, 'b', '2000-01-01 00:00:00'),
- (3, 'e', '2007-06-04 20:03:11'),
- (4, 'd', '2003-11-30 05:01:03'),
- (5, 'c', '2001-12-31 23:59:59');
---disable_warnings
-DROP TABLE IF EXISTS ta_l;
---enable_warnings
---disable_query_log
-echo CREATE TABLE ta_l (
- PRIMARY KEY(a)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
-eval CREATE TABLE ta_l (
- a INT,
- b CHAR(1),
- c DATETIME,
- PRIMARY KEY(a)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
---enable_query_log
-INSERT INTO ta_l SELECT a, b, c FROM tb_l;
-
---echo
---echo 0.9
---echo create different primary key table
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT AUTO_INCREMENT,
- c INT DEFAULT 11,
- PRIMARY KEY(b)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-eval CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT AUTO_INCREMENT,
- c INT DEFAULT 11,
- PRIMARY KEY(b)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
---let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)`
-if ($MASTER_1_IS_VP)
-{
- --error 14514
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-}
-if (!$MASTER_1_IS_VP)
-{
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
- --disable_query_log
- --disable_result_log
- TRUNCATE TABLE ta_l_int;
- --enable_query_log
- --enable_result_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES5;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo create un-correspond primary key table
---connection master_1
---disable_warnings
-DROP TABLE IF EXISTS ta_l_int;
---enable_warnings
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_result_log
- }
- --disable_query_log
- --connection child2_1
- if ($OUTPUT_CHILD_GROUP2)
- {
- echo CHILD2_1_DROP_TABLES5;
- echo CHILD2_1_CREATE_TABLES5;
- }
- --disable_warnings
- eval $CHILD2_1_DROP_TABLES5;
- --enable_warnings
- eval $CHILD2_1_CREATE_TABLES5;
- --enable_query_log
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_result_log
- }
-}
---connection master_1
---disable_query_log
-echo CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT DEFAULT 12,
- c INT DEFAULT 11,
- PRIMARY KEY(c)
-) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1;
-eval CREATE TABLE ta_l_int (
- a INT DEFAULT 10,
- b INT DEFAULT 12,
- c INT DEFAULT 11,
- PRIMARY KEY(c)
-) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1;
---enable_query_log
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- TRUNCATE TABLE mysql.general_log;
- }
- eval $CHILD2_1_SELECT_TABLES;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
---connection master_1
-if ($MASTER_1_IS_VP)
-{
- --error 14514
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
-}
-if (!$MASTER_1_IS_VP)
-{
- INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3);
- --disable_query_log
- --disable_result_log
- TRUNCATE TABLE ta_l_int;
- --enable_query_log
- --enable_result_log
-}
-if ($USE_CHILD_GROUP2)
-{
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --disable_query_log
- --disable_result_log
- }
- --connection child2_1
- if ($USE_GENERAL_LOG)
- {
- SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %';
- }
- eval $CHILD2_1_SELECT_TABLES5;
- if (!$OUTPUT_CHILD_GROUP2)
- {
- --enable_query_log
- --enable_result_log
- }
-}
-
---echo
---echo deinit
---disable_warnings
---connection master_1
-DROP DATABASE IF EXISTS auto_test_local;
-if ($USE_CHILD_GROUP2)
-{
- --connection child2_1
- DROP DATABASE IF EXISTS auto_test_remote;
- --connection child2_2
- DROP DATABASE IF EXISTS auto_test_remote2;
-}
---disable_query_log
---disable_result_log
---source test_deinit.inc
---enable_result_log
---enable_query_log
---enable_warnings
---echo
---echo end of test
diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index 5495f40cd86..feb3cab6a7f 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -18,17 +18,12 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_partition.h"
#include "sql_table.h"
#include "tztime.h"
-#endif
#include "spd_err.h"
#include "spd_param.h"
#include "spd_db_include.h"
@@ -63,7 +58,6 @@ pthread_mutex_t spider_conn_id_mutex;
pthread_mutex_t spider_ipport_conn_mutex;
ulonglong spider_conn_id = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
extern pthread_attr_t spider_pt_attr;
#ifdef HAVE_PSI_INTERFACE
@@ -71,7 +65,6 @@ extern PSI_mutex_key spd_key_mutex_mta_conn;
extern PSI_mutex_key spd_key_mutex_conn_i;
extern PSI_mutex_key spd_key_mutex_conn_loop_check;
extern PSI_cond_key spd_key_cond_conn_i;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
extern PSI_mutex_key spd_key_mutex_bg_conn_chain;
extern PSI_mutex_key spd_key_mutex_bg_conn_sync;
extern PSI_mutex_key spd_key_mutex_bg_conn;
@@ -90,8 +83,6 @@ extern PSI_thread_key spd_key_thd_bg_sts;
extern PSI_thread_key spd_key_thd_bg_crd;
extern PSI_thread_key spd_key_thd_bg_mon;
#endif
-#endif
-#endif
/* UTC time zone for timestamp columns */
extern Time_zone *UTC;
@@ -160,12 +151,8 @@ int spider_conn_init(
) {
int error_num = HA_ERR_OUT_OF_MEM;
DBUG_ENTER("spider_conn_init");
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->loop_check_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_conn_loop_check, &conn->loop_check_mutex,
MY_MUTEX_INIT_FAST))
-#endif
{
goto error_loop_check_mutex_init;
}
@@ -277,9 +264,7 @@ int spider_free_conn_alloc(
SPIDER_CONN *conn
) {
DBUG_ENTER("spider_free_conn_alloc");
-#ifndef WITHOUT_SPIDER_BG_SEARCH
spider_free_conn_thread(conn);
-#endif
spider_db_disconnect(conn);
if (conn->db_conn)
{
@@ -320,12 +305,7 @@ void spider_free_conn_from_trx(
if (another)
{
ha_spider *next_spider;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&trx->trx_another_conn_hash,
- conn->conn_key_hash_value, (uchar*) conn);
-#else
my_hash_delete(&trx->trx_another_conn_hash, (uchar*) conn);
-#endif
spider = (ha_spider*) conn->another_ha_first;
while (spider)
{
@@ -340,12 +320,7 @@ void spider_free_conn_from_trx(
conn->another_ha_first = NULL;
conn->another_ha_last = NULL;
} else {
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&trx->trx_conn_hash,
- conn->conn_key_hash_value, (uchar*) conn);
-#else
my_hash_delete(&trx->trx_conn_hash, (uchar*) conn);
-#endif
}
if (
@@ -365,12 +340,7 @@ void spider_free_conn_from_trx(
} else {
pthread_mutex_lock(&spider_conn_mutex);
uint old_elements = spider_open_connections.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&spider_open_connections,
- conn->conn_key_hash_value, (uchar*) conn))
-#else
if (my_hash_insert(&spider_open_connections, (uchar*) conn))
-#endif
{
pthread_mutex_unlock(&spider_conn_mutex);
spider_free_conn(conn);
@@ -485,9 +455,7 @@ SPIDER_CONN *spider_create_conn(
conn->conn_key = tmp_name;
memcpy(conn->conn_key, share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx]);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
conn->conn_key_hash_value = share->conn_keys_hash_value[link_idx];
-#endif
conn->tgt_host_length = share->tgt_hosts_lengths[link_idx];
conn->tgt_host = tmp_host;
memcpy(conn->tgt_host, share->tgt_hosts[link_idx],
@@ -641,12 +609,8 @@ SPIDER_CONN *spider_create_conn(
else
conn->need_mon = need_mon;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->mta_conn_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex,
MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_mta_conn_mutex_init;
@@ -666,14 +630,9 @@ SPIDER_CONN *spider_create_conn(
pthread_mutex_unlock(&spider_conn_id_mutex);
pthread_mutex_lock(&spider_ipport_conn_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
&spider_ipport_conns, conn->conn_key_hash_value,
(uchar*)conn->conn_key, conn->conn_key_length)))
-#else
- if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
- &spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length)))
-#endif
{ /* exists, +1 */
pthread_mutex_unlock(&spider_ipport_conn_mutex);
pthread_mutex_lock(&ip_port_conn->mutex);
@@ -746,7 +705,6 @@ SPIDER_CONN *spider_get_conn(
#ifdef DBUG_TRACE
spider_print_keys(conn_key, share->conn_keys_lengths[link_idx]);
#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (
(another &&
!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
@@ -759,16 +717,6 @@ SPIDER_CONN *spider_get_conn(
share->conn_keys_hash_value[link_idx],
(uchar*) conn_key, share->conn_keys_lengths[link_idx])))
)
-#else
- if (
- (another &&
- !(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_another_conn_hash,
- (uchar*) conn_key, share->conn_keys_lengths[link_idx]))) ||
- (!another &&
- !(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash,
- (uchar*) conn_key, share->conn_keys_lengths[link_idx])))
- )
-#endif
{
if (
!trx->thd ||
@@ -778,16 +726,10 @@ SPIDER_CONN *spider_get_conn(
)
) {
pthread_mutex_lock(&spider_conn_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
&spider_open_connections, share->conn_keys_hash_value[link_idx],
(uchar*) share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx])))
-#else
- if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
- (uchar*) share->conn_keys[link_idx],
- share->conn_keys_lengths[link_idx])))
-#endif
{
pthread_mutex_unlock(&spider_conn_mutex);
if (spider_param_max_connections())
@@ -813,12 +755,7 @@ SPIDER_CONN *spider_get_conn(
}
}
} else {
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_open_connections,
- conn->conn_key_hash_value, (uchar*) conn);
-#else
my_hash_delete(&spider_open_connections, (uchar*) conn);
-#endif
pthread_mutex_unlock(&spider_conn_mutex);
DBUG_PRINT("info",("spider get global conn"));
if (spider)
@@ -848,13 +785,7 @@ SPIDER_CONN *spider_get_conn(
if (another)
{
uint old_elements = trx->trx_another_conn_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&trx->trx_another_conn_hash,
- share->conn_keys_hash_value[link_idx],
- (uchar*) conn))
-#else
if (my_hash_insert(&trx->trx_another_conn_hash, (uchar*) conn))
-#endif
{
spider_free_conn(conn);
*error_num = HA_ERR_OUT_OF_MEM;
@@ -869,13 +800,7 @@ SPIDER_CONN *spider_get_conn(
}
} else {
uint old_elements = trx->trx_conn_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&trx->trx_conn_hash,
- share->conn_keys_hash_value[link_idx],
- (uchar*) conn))
-#else
if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn))
-#endif
{
spider_free_conn(conn);
*error_num = HA_ERR_OUT_OF_MEM;
@@ -999,9 +924,7 @@ int spider_check_and_init_casual_read(
(!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
(
result_list->direct_order_limit
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
|| result_list->direct_aggregate
-#endif
)
) {
if (!result_list->casual_read[link_idx])
@@ -1177,16 +1100,10 @@ int spider_conn_queue_and_merge_loop_check(
SPIDER_CONN_LOOP_CHECK *lcqptr, *lcrptr;
DBUG_ENTER("spider_conn_queue_and_merge_loop_check");
DBUG_PRINT("info", ("spider conn=%p", conn));
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (unlikely(!(lcqptr = (SPIDER_CONN_LOOP_CHECK *)
my_hash_search_using_hash_value(&conn->loop_check_queue,
lcptr->hash_value_to,
(uchar *) lcptr->to_name.str, lcptr->to_name.length))))
-#else
- if (unlikely(!(lcqptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search(
- &conn->loop_check_queue,
- (uchar *) lcptr->to_name.str, lcptr->to_name.length))))
-#endif
{
DBUG_PRINT("info", ("spider create merged_value and insert"));
lcptr->merged_value.length = spider_unique_id.length +
@@ -1199,12 +1116,7 @@ int spider_conn_queue_and_merge_loop_check(
*tmp_name = '-';
++tmp_name;
memcpy(tmp_name, lcptr->from_value.str, lcptr->from_value.length + 1);
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (unlikely(my_hash_insert_with_hash_value(&conn->loop_check_queue,
- lcptr->hash_value_to, (uchar *) lcptr)))
-#else
if (unlikely(my_hash_insert(&conn->loop_check_queue, (uchar *) lcptr)))
-#endif
{
goto error_hash_insert_queue;
}
@@ -1225,10 +1137,8 @@ int spider_conn_queue_and_merge_loop_check(
)) {
goto error_alloc_loop_check_replace;
}
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lcrptr->hash_value_to = lcqptr->hash_value_to;
lcrptr->hash_value_full = lcqptr->hash_value_full;
-#endif
lcrptr->from_name.str = from_name;
lcrptr->from_name.length = lcqptr->from_name.length;
memcpy(from_name, lcqptr->from_name.str, lcqptr->from_name.length + 1);
@@ -1258,33 +1168,16 @@ int spider_conn_queue_and_merge_loop_check(
memcpy(merged_value, lcptr->from_value.str, lcptr->from_value.length + 1);
DBUG_PRINT("info", ("spider free lcqptr"));
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&conn->loop_checked,
- lcqptr->hash_value_full, (uchar *) lcqptr);
- my_hash_delete_with_hash_value(&conn->loop_check_queue,
- lcqptr->hash_value_to, (uchar *) lcqptr);
-#else
my_hash_delete(&conn->loop_checked, (uchar*) lcqptr);
my_hash_delete(&conn->loop_check_queue, (uchar*) lcqptr);
-#endif
spider_free(spider_current_trx, lcqptr, MYF(0));
lcptr = lcrptr;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked,
- lcptr->hash_value_full, (uchar *) lcptr)))
-#else
if (unlikely(my_hash_insert(&conn->loop_checked, (uchar *) lcptr)))
-#endif
{
goto error_hash_insert;
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (unlikely(my_hash_insert_with_hash_value(&conn->loop_check_queue,
- lcptr->hash_value_to, (uchar *) lcptr)))
-#else
if (unlikely(my_hash_insert(&conn->loop_check_queue, (uchar *) lcptr)))
-#endif
{
goto error_hash_insert_queue;
}
@@ -1303,12 +1196,7 @@ int spider_conn_queue_and_merge_loop_check(
error_alloc_loop_check_replace:
error_hash_insert_queue:
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&conn->loop_checked,
- lcptr->hash_value_full, (uchar *) lcptr);
-#else
my_hash_delete(&conn->loop_checked, (uchar*) lcptr);
-#endif
error_hash_insert:
spider_free(spider_current_trx, lcptr, MYF(0));
pthread_mutex_unlock(&conn->loop_check_mutex);
@@ -1329,12 +1217,7 @@ int spider_conn_reset_queue_loop_check(
if (!lcptr->flag)
{
DBUG_PRINT("info", ("spider free lcptr"));
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&conn->loop_checked,
- lcptr->hash_value_full, (uchar *) lcptr);
-#else
my_hash_delete(&conn->loop_checked, (uchar*) lcptr);
-#endif
spider_free(spider_current_trx, lcptr, MYF(0));
}
++l;
@@ -1466,19 +1349,12 @@ int spider_conn_queue_loop_check(
memcpy(tmp_name, to_str.str, to_str.length);
tmp_name += to_str.length;
*tmp_name = '\0';
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&conn->loop_checked,
(uchar *) loop_check_buf, buf_sz - 1);
-#endif
pthread_mutex_lock(&conn->loop_check_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lcptr = (SPIDER_CONN_LOOP_CHECK *)
my_hash_search_using_hash_value(&conn->loop_checked, hash_value,
(uchar *) loop_check_buf, buf_sz - 1);
-#else
- lcptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_search(
- &conn->loop_checked, (uchar *) loop_check_buf, buf_sz - 1);
-#endif
if (unlikely(
!lcptr ||
(
@@ -1493,12 +1369,7 @@ int spider_conn_queue_loop_check(
if (unlikely(lcptr))
{
DBUG_PRINT("info", ("spider free lcptr"));
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&conn->loop_checked,
- lcptr->hash_value_full, (uchar *) lcptr);
-#else
my_hash_delete(&conn->loop_checked, (uchar*) lcptr);
-#endif
spider_free(spider_current_trx, lcptr, MYF(0));
}
DBUG_PRINT("info", ("spider alloc_lcptr"));
@@ -1533,17 +1404,10 @@ int spider_conn_queue_loop_check(
lcptr->from_value.length = lex_str.length;
memcpy(from_value, lex_str.str, lex_str.length + 1);
lcptr->merged_value.str = merged_value;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lcptr->hash_value_to = my_calc_hash(&conn->loop_checked,
(uchar *) to_str.str, to_str.length);
lcptr->hash_value_full = hash_value;
-#endif
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (unlikely(my_hash_insert_with_hash_value(&conn->loop_checked,
- lcptr->hash_value_full, (uchar *) lcptr)))
-#else
if (unlikely(my_hash_insert(&conn->loop_checked, (uchar *) lcptr)))
-#endif
{
my_afree(loop_check_buf);
goto error_hash_insert;
@@ -1843,7 +1707,6 @@ SPIDER_CONN *spider_tree_delete(
DBUG_RETURN(top);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_set_conn_bg_param(
ha_spider *spider
) {
@@ -1895,7 +1758,6 @@ int spider_set_conn_bg_param(
if (result_list->bgs_phase > 0)
{
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
if (spider->use_fields)
{
SPIDER_LINK_IDX_CHAIN *link_idx_chain;
@@ -1907,7 +1769,6 @@ int spider_set_conn_bg_param(
DBUG_RETURN(error_num);
}
} else {
-#endif
for (
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, -1, share->link_count,
@@ -1922,9 +1783,7 @@ int spider_set_conn_bg_param(
if ((error_num = spider_create_conn_thread(spider->conns[roop_count])))
DBUG_RETURN(error_num);
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
}
-#endif
}
DBUG_RETURN(0);
}
@@ -1936,43 +1795,27 @@ int spider_create_conn_thread(
DBUG_ENTER("spider_create_conn_thread");
if (conn && !conn->bg_init)
{
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->bg_conn_chain_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_conn_chain,
&conn->bg_conn_chain_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_chain_mutex_init;
}
conn->bg_conn_chain_mutex_ptr = NULL;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->bg_conn_sync_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_conn_sync,
&conn->bg_conn_sync_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->bg_conn_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_conn, &conn->bg_conn_mutex,
MY_MUTEX_INIT_FAST))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->bg_job_stack_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_job_stack, &conn->bg_job_stack_mutex,
MY_MUTEX_INIT_FAST))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_job_stack_mutex_init;
@@ -1989,36 +1832,22 @@ int spider_create_conn_thread(
conn->bg_job_stack.max_element *
conn->bg_job_stack.size_of_element);
conn->bg_job_stack_cur_pos = 0;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&conn->bg_conn_sync_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_conn_sync,
&conn->bg_conn_sync_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&conn->bg_conn_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_conn,
&conn->bg_conn_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init;
}
pthread_mutex_lock(&conn->bg_conn_mutex);
-#if MYSQL_VERSION_ID < 50500
- if (pthread_create(&conn->bg_thread, &spider_pt_attr,
- spider_bg_conn_action, (void *) conn)
- )
-#else
if (mysql_thread_create(spd_key_thd_bg, &conn->bg_thread,
&spider_pt_attr, spider_bg_conn_action, (void *) conn)
)
-#endif
{
pthread_mutex_unlock(&conn->bg_conn_mutex);
error_num = HA_ERR_OUT_OF_MEM;
@@ -2120,10 +1949,8 @@ void spider_bg_all_conn_wait(
SPIDER_LINK_STATUS_RECOVERY)
) {
conn = spider->conns[roop_count];
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (conn && result_list->bgs_working)
spider_bg_conn_wait(conn);
-#endif
}
DBUG_VOID_RETURN;
}
@@ -2132,13 +1959,10 @@ int spider_bg_all_conn_pre_next(
ha_spider *spider,
int link_idx
) {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int roop_start, roop_end, roop_count, lock_mode, link_ok, error_num;
SPIDER_RESULT_LIST *result_list = &spider->result_list;
SPIDER_SHARE *share = spider->share;
-#endif
DBUG_ENTER("spider_bg_all_conn_pre_next");
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list->bgs_phase > 0)
{
lock_mode = spider_conn_lock_mode(spider);
@@ -2168,7 +1992,6 @@ int spider_bg_all_conn_pre_next(
DBUG_RETURN(error_num);
}
}
-#endif
DBUG_RETURN(0);
}
@@ -2214,10 +2037,8 @@ void spider_bg_all_conn_break(
SPIDER_LINK_STATUS_RECOVERY)
) {
conn = spider->conns[roop_count];
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (conn && result_list->bgs_working)
spider_bg_conn_break(conn, spider);
-#endif
if (spider->quick_targets[roop_count])
{
spider_db_free_one_quick_result((SPIDER_RESULT *) result_list->current);
@@ -2404,9 +2225,7 @@ int spider_bg_conn_search(
conn->bg_target = spider;
conn->link_idx = link_idx;
conn->bg_discard_result = discard_result;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
conn->link_idx_chain = spider->link_idx_chain;
-#endif
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
pthread_cond_signal(&conn->bg_conn_cond);
pthread_mutex_unlock(&conn->bg_conn_mutex);
@@ -2548,9 +2367,7 @@ int spider_bg_conn_search(
conn->bg_target = spider;
conn->link_idx = link_idx;
conn->bg_discard_result = discard_result;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
conn->link_idx_chain = spider->link_idx_chain;
-#endif
result_list->bgs_working = TRUE;
conn->bg_search = TRUE;
if (with_lock)
@@ -2769,13 +2586,6 @@ void *spider_bg_conn_action(
}
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
-#ifdef HA_CAN_BULK_ACCESS
- if (spider->is_bulk_access_clone)
- {
- spider->connection_ids[conn->link_idx] = conn->connection_id;
- spider_trx_add_bulk_access_conn(spider->trx, conn);
- }
-#endif
if (!result_list->bgs_error)
{
conn->need_mon = &spider->need_mons[conn->link_idx];
@@ -2783,10 +2593,6 @@ void *spider_bg_conn_action(
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = TRUE;
conn->mta_conn_mutex_unlock_later = TRUE;
-#ifdef HA_CAN_BULK_ACCESS
- if (!spider->is_bulk_access_clone)
- {
-#endif
if (!(result_list->bgs_error =
spider_db_set_names(spider, conn, conn->link_idx)))
{
@@ -2855,9 +2661,6 @@ void *spider_bg_conn_action(
strmov(result_list->bgs_error_msg,
spider_stmt_da_message(thd));
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
@@ -3008,35 +2811,21 @@ int spider_create_sts_thread(
DBUG_ENTER("spider_create_sts_thread");
if (!share->bg_sts_init)
{
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&share->bg_sts_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_sts,
&share->bg_sts_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&share->bg_sts_sync_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_sts_sync,
&share->bg_sts_sync_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_create(&share->bg_sts_thread, &spider_pt_attr,
- spider_bg_sts_action, (void *) share)
- )
-#else
if (mysql_thread_create(spd_key_thd_bg_sts, &share->bg_sts_thread,
&spider_pt_attr, spider_bg_sts_action, (void *) share)
)
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create;
@@ -3293,18 +3082,11 @@ void *spider_bg_sts_action(
}
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (spider_get_sts(share, spider.search_link_idx,
share->bg_sts_try_time, &spider,
share->bg_sts_interval, share->bg_sts_mode,
share->bg_sts_sync,
2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
-#else
- if (spider_get_sts(share, spider.search_link_idx,
- share->bg_sts_try_time, &spider,
- share->bg_sts_interval, share->bg_sts_mode,
- 2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
-#endif
{
/*
if (
@@ -3349,35 +3131,21 @@ int spider_create_crd_thread(
DBUG_ENTER("spider_create_crd_thread");
if (!share->bg_crd_init)
{
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&share->bg_crd_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_crd,
&share->bg_crd_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&share->bg_crd_sync_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_crd_sync,
&share->bg_crd_sync_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_create(&share->bg_crd_thread, &spider_pt_attr,
- spider_bg_crd_action, (void *) share)
- )
-#else
if (mysql_thread_create(spd_key_thd_bg_crd, &share->bg_crd_thread,
&spider_pt_attr, spider_bg_crd_action, (void *) share)
)
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create;
@@ -3639,18 +3407,11 @@ void *spider_bg_crd_action(
}
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (spider_get_crd(share, spider.search_link_idx,
share->bg_crd_try_time, &spider, &table,
share->bg_crd_interval, share->bg_crd_mode,
share->bg_crd_sync,
2))
-#else
- if (spider_get_crd(share, spider.search_link_idx,
- share->bg_crd_try_time, &spider, &table,
- share->bg_crd_interval, share->bg_crd_mode,
- 2))
-#endif
{
/*
if (
@@ -3770,13 +3531,8 @@ int spider_create_mon_threads(
{
if (
share->monitoring_bg_kind[roop_count] &&
-#if MYSQL_VERSION_ID < 50500
- pthread_mutex_init(&share->bg_mon_mutexes[roop_count],
- MY_MUTEX_INIT_FAST)
-#else
mysql_mutex_init(spd_key_mutex_bg_mon,
&share->bg_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST)
-#endif
) {
error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf);
@@ -3788,12 +3544,8 @@ int spider_create_mon_threads(
{
if (
share->monitoring_bg_kind[roop_count] &&
-#if MYSQL_VERSION_ID < 50500
- pthread_cond_init(&share->bg_mon_conds[roop_count], NULL)
-#else
mysql_cond_init(spd_key_cond_bg_mon,
&share->bg_mon_conds[roop_count], NULL)
-#endif
) {
error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf);
@@ -3805,12 +3557,8 @@ int spider_create_mon_threads(
{
if (
share->monitoring_bg_kind[roop_count] &&
-#if MYSQL_VERSION_ID < 50500
- pthread_cond_init(&share->bg_mon_sleep_conds[roop_count], NULL)
-#else
mysql_cond_init(spd_key_cond_bg_mon_sleep,
&share->bg_mon_sleep_conds[roop_count], NULL)
-#endif
) {
error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf);
@@ -3825,16 +3573,10 @@ int spider_create_mon_threads(
{
link_pack.link_idx = roop_count;
pthread_mutex_lock(&share->bg_mon_mutexes[roop_count]);
-#if MYSQL_VERSION_ID < 50500
- if (pthread_create(&share->bg_mon_threads[roop_count],
- &spider_pt_attr, spider_bg_mon_action, (void *) &link_pack)
- )
-#else
if (mysql_thread_create(spd_key_thd_bg_mon,
&share->bg_mon_threads[roop_count], &spider_pt_attr,
spider_bg_mon_action, (void *) &link_pack)
)
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
my_afree(buf);
@@ -4044,7 +3786,6 @@ void *spider_bg_mon_action(
}
}
}
-#endif
int spider_conn_first_link_idx(
THD *thd,
@@ -4088,17 +3829,9 @@ int spider_conn_first_link_idx(
my_afree(link_idxs);
DBUG_RETURN(-1);
}
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
DBUG_PRINT("info",("spider server_id=%lu", thd->variables.server_id));
-#else
- DBUG_PRINT("info",("spider server_id=%u", thd->server_id));
-#endif
DBUG_PRINT("info",("spider thread_id=%lu", thd_get_thread_id(thd)));
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
rand_val = spider_rand(thd->variables.server_id + thd_get_thread_id(thd));
-#else
- rand_val = spider_rand(thd->server_id + thd_get_thread_id(thd));
-#endif
DBUG_PRINT("info",("spider rand_val=%f", rand_val));
balance_val = (longlong) (rand_val * balance_total);
DBUG_PRINT("info",("spider balance_val=%lld", balance_val));
@@ -4216,7 +3949,6 @@ bool spider_conn_use_handler(
DBUG_PRINT("info",("spider use_handler=%d", use_handler));
DBUG_PRINT("info",("spider spider->conn_kind[link_idx]=%u",
spider->conn_kind[link_idx]));
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
if (spider->do_direct_update)
{
spider->sql_kinds |= SPIDER_SQL_KIND_SQL;
@@ -4225,7 +3957,6 @@ bool spider_conn_use_handler(
DBUG_PRINT("info",("spider FALSE by using direct_update"));
DBUG_RETURN(FALSE);
}
-#endif
if (spider->use_spatial_index)
{
DBUG_PRINT("info",("spider FALSE by use_spatial_index"));
@@ -4315,15 +4046,9 @@ SPIDER_CONN* spider_get_conn_from_idle_connection(
set_timespec(abstime, 0);
pthread_mutex_lock(&spider_ipport_conn_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
&spider_ipport_conns, share->conn_keys_hash_value[link_idx],
(uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx])))
-#else
- if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
- &spider_ipport_conns,
- (uchar*) share->conn_keys[link_idx], share->conn_keys_lengths[link_idx])))
-#endif
{ /* exists */
pthread_mutex_unlock(&spider_ipport_conn_mutex);
pthread_mutex_lock(&ip_port_conn->mutex);
@@ -4362,24 +4087,13 @@ SPIDER_CONN* spider_get_conn_from_idle_connection(
}
pthread_mutex_lock(&spider_conn_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
&spider_open_connections, share->conn_keys_hash_value[link_idx],
(uchar*) share->conn_keys[link_idx],
share->conn_keys_lengths[link_idx])))
-#else
- if ((conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
- (uchar*) share->conn_keys[link_idx],
- share->conn_keys_lengths[link_idx])))
-#endif
{
/* get conn from spider_open_connections, then delete conn in spider_open_connections */
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_open_connections,
- conn->conn_key_hash_value, (uchar*) conn);
-#else
my_hash_delete(&spider_open_connections, (uchar*) conn);
-#endif
pthread_mutex_unlock(&spider_conn_mutex);
DBUG_PRINT("info",("spider get global conn"));
if (spider)
@@ -4428,21 +4142,13 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
goto err_return_direct;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&ret->mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_conn_i, &ret->mutex, MY_MUTEX_INIT_FAST))
-#endif
{
//error
goto err_malloc_key;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&ret->cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_conn_i, &ret->cond, NULL))
-#endif
{
pthread_mutex_destroy(&ret->mutex);
goto err_malloc_key;
@@ -4472,9 +4178,7 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
ret->conn_id = conn->conn_id;
ret->ip_port_count = 1; // init
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
ret->key_hash_value = conn->conn_key_hash_value;
-#endif
DBUG_RETURN(ret);
err_malloc_key:
spider_my_free(ret, MYF(0));
diff --git a/storage/spider/spd_conn.h b/storage/spider/spd_conn.h
index 92da278eecc..53c10572687 100644
--- a/storage/spider/spd_conn.h
+++ b/storage/spider/spd_conn.h
@@ -22,9 +22,7 @@
#define SPIDER_SIMPLE_CONNECT 1
#define SPIDER_SIMPLE_DISCONNECT 2
#define SPIDER_SIMPLE_RECORDS 3
-#ifdef HA_HAS_CHECKSUM_EXTENDED
#define SPIDER_SIMPLE_CHECKSUM_TABLE 4
-#endif
#define SPIDER_LOP_CHK_QUEUED (1 << 0)
#define SPIDER_LOP_CHK_MERAGED (1 << 1)
@@ -33,10 +31,8 @@
typedef struct st_spider_conn_loop_check
{
uint flag;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value_to;
my_hash_value_type hash_value_full;
-#endif
LEX_CSTRING from_name;
LEX_CSTRING cur_name;
LEX_CSTRING to_name;
@@ -256,7 +252,6 @@ SPIDER_CONN *spider_tree_delete(
SPIDER_CONN *top
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_set_conn_bg_param(
ha_spider *spider
);
@@ -353,7 +348,6 @@ void spider_free_mon_threads(
void *spider_bg_mon_action(
void *arg
);
-#endif
int spider_conn_first_link_idx(
THD *thd,
diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc
index 51e3b920eea..4b2f5174ce0 100644
--- a/storage/spider/spd_copy_tables.cc
+++ b/storage/spider/spd_copy_tables.cc
@@ -18,17 +18,12 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_base.h"
#include "sql_partition.h"
#include "transaction.h"
-#endif
#include "spd_err.h"
#include "spd_param.h"
#include "spd_db_include.h"
@@ -73,10 +68,8 @@ int spider_udf_set_copy_tables_param_default(
copy_tables->use_table_charset = 1;
if (copy_tables->use_transaction == -1)
copy_tables->use_transaction = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (copy_tables->bg_mode == -1)
copy_tables->bg_mode = 0;
-#endif
DBUG_RETURN(0);
}
@@ -226,9 +219,7 @@ int spider_udf_parse_copy_tables_param(
copy_tables->bulk_insert_rows = -1;
copy_tables->use_table_charset = -1;
copy_tables->use_transaction = -1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
copy_tables->bg_mode = -1;
-#endif
if (param_length == 0)
goto set_default;
@@ -281,9 +272,7 @@ int spider_udf_parse_copy_tables_param(
goto error;
continue;
case 3:
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_INT_WITH_MAX("bgm", bg_mode, 0, 1);
-#endif
SPIDER_PARAM_INT("bii", bulk_insert_interval, 0);
SPIDER_PARAM_LONGLONG("bir", bulk_insert_rows, 1);
SPIDER_PARAM_STR("dtb", database);
@@ -291,12 +280,10 @@ int spider_udf_parse_copy_tables_param(
SPIDER_PARAM_INT_WITH_MAX("utr", use_transaction, 0, 1);
error_num = param_string_parse.print_param_error();
goto error;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
case 7:
SPIDER_PARAM_INT_WITH_MAX("bg_mode", bg_mode, 0, 1);
error_num = param_string_parse.print_param_error();
goto error;
-#endif
case 8:
SPIDER_PARAM_STR("database", database);
error_num = param_string_parse.print_param_error();
@@ -422,10 +409,8 @@ int spider_udf_get_copy_tgt_tables(
if (
(error_num = spider_set_connect_info_default(
tmp_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
NULL,
-#endif
NULL
)) ||
(error_num = spider_set_connect_info_default_db_table(
@@ -787,7 +772,6 @@ int spider_udf_copy_tables_create_table_list(
DBUG_RETURN(0);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_udf_bg_copy_exec_sql(
SPIDER_COPY_TABLE_CONN *table_conn
) {
@@ -816,7 +800,6 @@ int spider_udf_bg_copy_exec_sql(
conn->bg_caller_sync_wait = FALSE;
DBUG_RETURN(0);
}
-#endif
long long spider_copy_tables_body(
UDF_INIT *initid,
@@ -847,13 +830,8 @@ long long spider_copy_tables_body(
thd->handler_tables_hash.records != 0 ||
thd->derived_tables != 0 ||
thd->lock != 0 ||
-#if MYSQL_VERSION_ID < 50500
- thd->locked_tables != 0 ||
- thd->prelocked_mode != NON_PRELOCKED
-#else
thd->locked_tables_list.locked_tables() ||
thd->locked_tables_mode != LTM_NONE
-#endif
) {
if (thd->open_tables != 0)
{
@@ -876,18 +854,6 @@ long long spider_copy_tables_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
"thd->lock", thd->lock);
-#if MYSQL_VERSION_ID < 50500
- } else if (thd->locked_tables != 0)
- {
- my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
- ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
- "thd->locked_tables", thd->locked_tables);
- } else if (thd->prelocked_mode != NON_PRELOCKED)
- {
- my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
- ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
- "thd->prelocked_mode", (longlong) thd->prelocked_mode);
-#else
} else if (thd->locked_tables_list.locked_tables())
{
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
@@ -899,7 +865,6 @@ long long spider_copy_tables_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
"thd->locked_tables_mode", (longlong) thd->locked_tables_mode);
-#endif
}
goto error;
}
@@ -991,9 +956,7 @@ long long spider_copy_tables_body(
copy_tables->trx->trx_start = TRUE;
copy_tables->trx->updated_in_this_trx = FALSE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=FALSE"));
-#if MYSQL_VERSION_ID < 50500
- if (open_and_lock_tables(thd, table_list))
-#else
+
MDL_REQUEST_INIT(&table_list->mdl_request,
MDL_key::TABLE,
SPIDER_TABLE_LIST_db_str(table_list),
@@ -1002,7 +965,6 @@ long long spider_copy_tables_body(
MDL_TRANSACTION
);
if (open_and_lock_tables(thd, table_list, FALSE, 0))
-#endif
{
thd->m_reprepare_observer = reprepare_observer_backup;
copy_tables->trx->trx_start = FALSE;
@@ -1223,11 +1185,7 @@ long long spider_copy_tables_body(
*/
if (table_list->table)
{
-#if MYSQL_VERSION_ID < 50500
- ha_autocommit_or_rollback(thd, 0);
-#else
(thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
-#endif
close_thread_tables(thd);
}
if (spider)
@@ -1285,11 +1243,7 @@ error:
}
if (table_list && table_list->table)
{
-#if MYSQL_VERSION_ID < 50500
- ha_autocommit_or_rollback(thd, 0);
-#else
(thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd));
-#endif
close_thread_tables(thd);
}
if (spider)
diff --git a/storage/spider/spd_copy_tables.h b/storage/spider/spd_copy_tables.h
index 8c06e115dea..4f7ba7791cb 100644
--- a/storage/spider/spd_copy_tables.h
+++ b/storage/spider/spd_copy_tables.h
@@ -48,8 +48,6 @@ int spider_udf_copy_tables_create_table_list(
uint dst_link_idx_list_length
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_udf_bg_copy_exec_sql(
SPIDER_COPY_TABLE_CONN *table_conn
);
-#endif
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 09bc66f09b4..055dcd984b1 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -18,10 +18,6 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
@@ -30,10 +26,7 @@
#include "sql_base.h"
#include "tztime.h"
#include "errmsg.h"
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
-#endif
-#endif
#include "sql_common.h"
#include <errmsg.h>
#include "spd_err.h"
@@ -71,9 +64,7 @@ extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
#define SPIDER_SQL_PING_TABLE_STR "spider_ping_table("
#define SPIDER_SQL_PING_TABLE_LEN (sizeof(SPIDER_SQL_PING_TABLE_STR) - 1)
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
extern HASH spider_open_connections;
-#endif
pthread_mutex_t spider_open_conn_mutex;
const char spider_dig_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@@ -588,10 +579,8 @@ int spider_db_before_query(
int error_num;
DBUG_ENTER("spider_db_before_query");
DBUG_ASSERT(need_mon);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (conn->bg_search)
spider_bg_conn_break(conn, NULL);
-#endif
conn->in_before_query = TRUE;
pthread_mutex_assert_owner(&conn->mta_conn_mutex);
DBUG_ASSERT(conn->mta_conn_mutex_file_pos.file_name);
@@ -1411,14 +1400,12 @@ int spider_db_append_select_columns(
DBUG_ENTER("spider_db_append_select_columns");
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
{
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (
result_list->direct_aggregate &&
(error_num = spider->append_sum_select_sql_part(
SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0))
)
DBUG_RETURN(error_num);
-#endif
if ((error_num = spider->append_match_select_sql_part(
SPIDER_SQL_TYPE_SELECT_SQL, NULL, 0)))
DBUG_RETURN(error_num);
@@ -1812,12 +1799,6 @@ int spider_db_append_key_where_internal(
if (use_key == start_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
@@ -1828,17 +1809,14 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
} else {
DBUG_PRINT("info", ("spider start_key->flag=%d", start_key->flag));
switch (start_key->flag)
{
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
case HA_READ_PREFIX_LAST:
result_list->desc_flg = TRUE;
-#endif
/* fall through */
case HA_READ_KEY_EXACT:
if (sql_kind == SPIDER_SQL_KIND_SQL)
@@ -1878,18 +1856,6 @@ int spider_db_append_key_where_internal(
if (use_key == start_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !end_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_EQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
@@ -1900,7 +1866,6 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
@@ -1949,18 +1914,6 @@ int spider_db_append_key_where_internal(
if (use_key == start_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !end_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_GT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_GT_LEN))
@@ -1971,7 +1924,6 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
@@ -2021,18 +1973,6 @@ int spider_db_append_key_where_internal(
if (use_key == start_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !end_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_LT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_LT_LEN))
@@ -2043,16 +1983,9 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-#else
- case HA_READ_PREFIX_LAST:
- result_list->limit_num = 1;
- /* fall through */
-#endif
case HA_READ_KEY_OR_PREV:
case HA_READ_PREFIX_LAST_OR_PREV:
result_list->desc_flg = TRUE;
@@ -2094,18 +2027,6 @@ int spider_db_append_key_where_internal(
if (use_key == start_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !end_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LTEQUAL_STR, SPIDER_SQL_LTEQUAL_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
@@ -2116,7 +2037,6 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
@@ -2238,18 +2158,6 @@ int spider_db_append_key_where_internal(
if (use_key == start_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !end_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_GTEQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_GTEQUAL_STR, SPIDER_SQL_GTEQUAL_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_GTEQUAL_LEN))
@@ -2260,7 +2168,6 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
@@ -2279,14 +2186,6 @@ int spider_db_append_key_where_internal(
str_part2->q_append(SPIDER_SQL_AND_STR,
SPIDER_SQL_AND_LEN);
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (use_key == start_key)
- {
- if (str_part->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
-#endif
}
}
@@ -2337,12 +2236,6 @@ int spider_db_append_key_where_internal(
if (use_key == end_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
@@ -2353,7 +2246,6 @@ int spider_db_append_key_where_internal(
share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
} else {
@@ -2404,18 +2296,6 @@ int spider_db_append_key_where_internal(
if (use_key == end_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !start_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_LT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LT_STR, SPIDER_SQL_LT_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_LT_LEN))
@@ -2426,7 +2306,6 @@ int spider_db_append_key_where_internal(
false, share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
@@ -2468,18 +2347,6 @@ int spider_db_append_key_where_internal(
if (use_key == end_key)
{
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_key_part_map == 1 || !start_key_part_map)
- {
- if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LTEQUAL_STR, SPIDER_SQL_LTEQUAL_LEN);
- }
- if (spider_dbton[dbton_id].db_util->
- append_column_value(spider, str_part, field, ptr, false,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_LTEQUAL_LEN))
@@ -2490,7 +2357,6 @@ int spider_db_append_key_where_internal(
false, share->access_charset))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
-#endif
}
}
break;
@@ -2508,14 +2374,6 @@ int spider_db_append_key_where_internal(
str_part2->q_append(SPIDER_SQL_AND_STR,
SPIDER_SQL_AND_LEN);
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (use_key == end_key)
- {
- if (str_part->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str_part->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
-#endif
}
}
if (use_both && (!start_key_part_map || !end_key_part_map))
@@ -2582,7 +2440,6 @@ int spider_db_append_charset_name_before_string(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_refetch_for_item_sum_funcs(
ha_spider *spider
) {
@@ -2775,7 +2632,6 @@ int spider_db_fetch_for_item_sum_func(
}
DBUG_RETURN(0);
}
-#endif
int spider_db_append_match_fetch(
ha_spider *spider,
@@ -2870,13 +2726,8 @@ int spider_db_get_row_from_tmp_tbl(
current->result_tmp_tbl_inited = 1;
}
if (
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = current->result_tmp_tbl->file->ha_rnd_next(
current->result_tmp_tbl->record[0]))
-#else
- (error_num = current->result_tmp_tbl->file->rnd_next(
- current->result_tmp_tbl->record[0]))
-#endif
) {
DBUG_RETURN(error_num);
}
@@ -2904,13 +2755,8 @@ int spider_db_get_row_from_tmp_tbl_pos(
result->result_tmp_tbl_inited = 2;
}
if (
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = tmp_tbl->file->ha_rnd_pos(tmp_tbl->record[0],
(uchar *) &pos->tmp_tbl_pos))
-#else
- (error_num = tmp_tbl->file->rnd_pos(tmp_tbl->record[0],
- (uchar *) &pos->tmp_tbl_pos))
-#endif
) {
DBUG_RETURN(error_num);
}
@@ -2984,13 +2830,11 @@ int spider_db_fetch_table(
}
DBUG_PRINT("info", ("spider row=%p", row));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info", ("spider direct_aggregate=%s",
result_list->direct_aggregate ? "TRUE" : "FALSE"));
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
result_list->snap_direct_aggregate = result_list->direct_aggregate;
result_list->snap_row = row;
-#endif
/* for mrr */
if (spider->mrr_with_cnt)
@@ -3000,43 +2844,33 @@ int spider_db_fetch_table(
{
if (!row->is_null())
spider->multi_range_hit_point = row->val_int();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list->direct_aggregate)
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-#endif
else
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
row->next();
} else {
spider->multi_range_hit_point = 0;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
result_list->snap_mrr_with_cnt = FALSE;
-#endif
}
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (result_list->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
-#endif
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
if (!spider->use_fields)
{
-#endif
if ((error_num = spider_db_append_match_fetch(spider,
spider->ft_first, spider->ft_current, row)))
DBUG_RETURN(error_num);
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
}
-#endif
for (
field = table->field;
@@ -3114,13 +2948,11 @@ int spider_db_fetch_key(
}
DBUG_PRINT("info", ("spider row=%p", row));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info", ("spider direct_aggregate=%s",
result_list->direct_aggregate ? "TRUE" : "FALSE"));
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
result_list->snap_direct_aggregate = result_list->direct_aggregate;
result_list->snap_row = row;
-#endif
/* for mrr */
if (spider->mrr_with_cnt)
@@ -3128,26 +2960,22 @@ int spider_db_fetch_key(
DBUG_PRINT("info", ("spider mrr_with_cnt"));
if (!row->is_null())
spider->multi_range_hit_point = row->val_int();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list->direct_aggregate)
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-#endif
else
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
row->next();
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (result_list->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
-#endif
if ((error_num = spider_db_append_match_fetch(spider,
spider->ft_first, spider->ft_current, row)))
@@ -3231,13 +3059,11 @@ int spider_db_fetch_minimum_columns(
}
DBUG_PRINT("info", ("spider row=%p", row));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info", ("spider direct_aggregate=%s",
result_list->direct_aggregate ? "TRUE" : "FALSE"));
result_list->snap_mrr_with_cnt = spider->mrr_with_cnt;
result_list->snap_direct_aggregate = result_list->direct_aggregate;
result_list->snap_row = row;
-#endif
/* for mrr */
if (spider->mrr_with_cnt)
@@ -3245,26 +3071,22 @@ int spider_db_fetch_minimum_columns(
DBUG_PRINT("info", ("spider mrr_with_cnt"));
if (!row->is_null())
spider->multi_range_hit_point = row->val_int();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (result_list->direct_aggregate)
{
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
-#endif
else
DBUG_RETURN(ER_SPIDER_UNKNOWN_NUM);
row->next();
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (result_list->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
-#endif
if ((error_num = spider_db_append_match_fetch(spider,
spider->ft_first, spider->ft_current, row)))
@@ -3624,9 +3446,7 @@ int spider_db_free_result(
DBUG_PRINT("info",("spider result_list->finish_flg = FALSE"));
result_list->finish_flg = FALSE;
result_list->quick_phase = 0;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase = 0;
-#endif
DBUG_RETURN(0);
}
@@ -3688,9 +3508,7 @@ int spider_db_store_result(
current = (SPIDER_RESULT*) result_list->current;
} else {
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase > 0 ||
-#endif
result_list->quick_phase > 0
) {
if (result_list->bgs_current == result_list->last)
@@ -3718,9 +3536,7 @@ int spider_db_store_result(
result_list->bgs_current = result_list->bgs_current->next;
}
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase == 1 ||
-#endif
result_list->quick_phase == 2
) {
if (result_list->low_mem_read &&
@@ -3805,15 +3621,11 @@ int spider_db_store_result(
DBUG_PRINT("info",("spider result_list->finish_flg = TRUE"));
current->finish_flg = TRUE;
result_list->finish_flg = TRUE;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list->bgs_phase <= 1)
{
-#endif
result_list->current_row_num = 0;
table->status = STATUS_NOT_FOUND;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
if (!conn->mta_conn_mutex_unlock_later && !call_db_errorno)
{
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
@@ -3849,14 +3661,10 @@ int spider_db_store_result(
current->finish_flg = TRUE;
result_list->finish_flg = TRUE;
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list->bgs_phase <= 1)
{
-#endif
result_list->current_row_num = 0;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
} else {
/* has_result() for case of result with result_tmp_tbl */
@@ -3927,9 +3735,7 @@ int spider_db_store_result(
conn->quick_target = NULL;
spider->quick_targets[link_idx] = NULL;
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase <= 1 &&
-#endif
result_list->quick_phase == 0
) {
result_list->current_row_num = 0;
@@ -4105,14 +3911,10 @@ int spider_db_store_result(
spider->quick_targets[link_idx] = NULL;
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
DBUG_PRINT("info", ("spider bgs_phase=%d", result_list->bgs_phase));
-#endif
DBUG_PRINT("info", ("spider quick_phase=%d", result_list->quick_phase));
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase <= 1 &&
-#endif
result_list->quick_phase == 0
) {
result_list->current_row_num = 0;
@@ -4171,9 +3973,7 @@ int spider_db_store_result_for_reuse_cursor(
current = (SPIDER_RESULT*) result_list->current;
} else {
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase > 0 ||
-#endif
result_list->quick_phase > 0
) {
if (result_list->bgs_current == result_list->last)
@@ -4195,9 +3995,7 @@ int spider_db_store_result_for_reuse_cursor(
result_list->bgs_current = result_list->bgs_current->next;
}
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase == 1 ||
-#endif
result_list->quick_phase == 2
) {
result_list->current = result_list->bgs_current;
@@ -4257,14 +4055,10 @@ int spider_db_store_result_for_reuse_cursor(
current->finish_flg = TRUE;
result_list->finish_flg = TRUE;
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list->bgs_phase <= 1)
{
-#endif
result_list->current_row_num = 0;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
} else {
DBUG_ASSERT(current->prev);
DBUG_ASSERT(current->prev->result);
@@ -4303,9 +4097,7 @@ int spider_db_store_result_for_reuse_cursor(
conn->quick_target = NULL;
spider->quick_targets[link_idx] = NULL;
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase <= 1 &&
-#endif
result_list->quick_phase == 0
) {
result_list->current_row_num = 0;
@@ -4478,14 +4270,10 @@ int spider_db_store_result_for_reuse_cursor(
spider->quick_targets[link_idx] = NULL;
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
DBUG_PRINT("info", ("spider bgs_phase=%d", result_list->bgs_phase));
-#endif
DBUG_PRINT("info", ("spider quick_phase=%d", result_list->quick_phase));
if (
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_phase <= 1 &&
-#endif
result_list->quick_phase == 0
) {
result_list->current_row_num = 0;
@@ -4557,42 +4345,6 @@ void spider_db_discard_multiple_result(
DBUG_VOID_RETURN;
}
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_store_result(
- ha_spider *spider,
- SPIDER_CONN *conn,
- int link_idx,
- bool discard_result
-) {
- int error_num, tmp_error_num;
- DBUG_ENTER("spider_db_bulk_store_result");
- DBUG_PRINT("info",("spider spider=%p", spider));
- DBUG_PRINT("info",("spider conn=%p", conn));
- DBUG_PRINT("info",("spider link_idx=%d", link_idx));
- if (conn->conn_kind == SPIDER_CONN_KIND_MYSQL)
- {
- /* already stored */
- DBUG_RETURN(0);
- }
- error_num = spider_db_bulk_open_handler(spider, conn, link_idx);
- if (!discard_result)
- {
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((tmp_error_num = spider_db_store_result(spider, link_idx,
- spider->get_table())))
- {
- error_num = tmp_error_num;
- }
- conn->mta_conn_mutex_unlock_later = FALSE;
- } else {
- if (spider->connection_ids[link_idx] == conn->connection_id)
- spider_db_discard_result(spider, link_idx, conn);
- }
- DBUG_RETURN(error_num);
-}
-#endif
int spider_db_fetch(
uchar *buf,
@@ -4677,10 +4429,8 @@ int spider_db_seek_next(
(SPIDER_RESULT*) result_list->current);
int roop_start = 0, roop_end = 1, roop_count, lock_mode, link_ok = 0;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
if (!spider->use_fields)
{
-#endif
lock_mode = spider_conn_lock_mode(spider);
if (lock_mode)
{
@@ -4697,14 +4447,10 @@ int spider_db_seek_next(
roop_start = link_idx;
roop_end = link_idx + 1;
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
}
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list->bgs_phase > 0)
{
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
if (spider->use_fields)
{
SPIDER_LINK_IDX_CHAIN *link_idx_chain;
@@ -4728,7 +4474,6 @@ int spider_db_seek_next(
}
}
} else {
-#endif
for (roop_count = roop_start; roop_count < roop_end;
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, roop_count, share->link_count,
@@ -4741,11 +4486,8 @@ int spider_db_seek_next(
DBUG_RETURN(error_num);
}
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
}
-#endif
} else {
-#endif
if (result_list->current == result_list->bgs_current)
{
if (result_list->finish_flg)
@@ -4795,7 +4537,6 @@ int spider_db_seek_next(
}
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
if (spider->use_fields)
{
SPIDER_LINK_IDX_CHAIN *link_idx_chain;
@@ -4920,7 +4661,6 @@ int spider_db_seek_next(
}
}
} else {
-#endif
for (roop_count = roop_start; roop_count < roop_end;
roop_count = spider_conn_link_idx_next(share->link_statuses,
spider->conn_link_idx, roop_count, share->link_count,
@@ -5091,9 +4831,7 @@ int spider_db_seek_next(
}
}
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
}
-#endif
} else {
spider->connection_ids[link_idx] = conn->connection_id;
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
@@ -5119,9 +4857,7 @@ int spider_db_seek_next(
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
DBUG_RETURN(spider_db_fetch(buf, spider, table));
} else
DBUG_RETURN(spider_db_fetch(buf, spider, table));
@@ -5664,9 +5400,7 @@ void spider_db_create_position(
current->use_position = TRUE;
pos->use_position = TRUE;
pos->mrr_with_cnt = spider->mrr_with_cnt;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
pos->direct_aggregate = result_list->direct_aggregate;
-#endif
pos->sql_kind = spider->sql_kind[spider->result_link_idx];
pos->position_bitmap = spider->wide_handler->position_bitmap;
pos->ft_first = spider->ft_first;
@@ -5732,7 +5466,6 @@ int spider_db_seek_tmp_table(
}
DBUG_PRINT("info", ("spider row=%p", row));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (!spider->result_list.in_cmp_ref)
{
DBUG_PRINT("info", ("spider direct_aggregate=%s",
@@ -5741,7 +5474,6 @@ int spider_db_seek_tmp_table(
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
spider->result_list.snap_row = row;
}
-#endif
/* for mrr */
if (pos->mrr_with_cnt)
@@ -5751,20 +5483,16 @@ int spider_db_seek_tmp_table(
{
row->next();
} else {
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.snap_mrr_with_cnt = FALSE;
-#endif
}
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (pos->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
-#endif
if ((error_num = spider_db_append_match_fetch(spider,
pos->ft_first, pos->ft_current, row)))
@@ -5824,7 +5552,6 @@ int spider_db_seek_tmp_key(
}
DBUG_PRINT("info", ("spider row=%p", row));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (!spider->result_list.in_cmp_ref)
{
DBUG_PRINT("info", ("spider direct_aggregate=%s",
@@ -5833,7 +5560,6 @@ int spider_db_seek_tmp_key(
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
spider->result_list.snap_row = row;
}
-#endif
/* for mrr */
if (pos->mrr_with_cnt)
@@ -5842,14 +5568,12 @@ int spider_db_seek_tmp_key(
row->next();
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (pos->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
-#endif
if ((error_num = spider_db_append_match_fetch(spider,
pos->ft_first, pos->ft_current, row)))
@@ -5909,7 +5633,6 @@ int spider_db_seek_tmp_minimum_columns(
}
DBUG_PRINT("info", ("spider row=%p", row));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (!spider->result_list.in_cmp_ref)
{
DBUG_PRINT("info", ("spider direct_aggregate=%s",
@@ -5918,7 +5641,6 @@ int spider_db_seek_tmp_minimum_columns(
spider->result_list.snap_direct_aggregate = pos->direct_aggregate;
spider->result_list.snap_row = row;
}
-#endif
/* for mrr */
if (pos->mrr_with_cnt)
@@ -5927,14 +5649,12 @@ int spider_db_seek_tmp_minimum_columns(
row->next();
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
/* for direct_aggregate */
if (pos->direct_aggregate)
{
if ((error_num = spider_db_fetch_for_item_sum_funcs(row, spider)))
DBUG_RETURN(error_num);
}
-#endif
if ((error_num = spider_db_append_match_fetch(spider,
pos->ft_first, pos->ft_current, row)))
@@ -6017,14 +5737,12 @@ int spider_db_simple_action(
link_idx
);
break;
-#ifdef HA_HAS_CHECKSUM_EXTENDED
case SPIDER_SIMPLE_CHECKSUM_TABLE:
DBUG_PRINT("info",("spider simple checksum_table"));
error_num = db_handler->checksum_table(
link_idx
);
break;
-#endif
default:
DBUG_ASSERT(0);
error_num = HA_ERR_CRASHED;
@@ -6239,10 +5957,6 @@ int spider_db_bulk_insert(
spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL);
DBUG_RETURN(error_num);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (!spider->is_bulk_access_clone)
- {
-#endif
bool insert_info = FALSE;
for (
roop_count2 = spider_conn_link_idx_next(share->link_statuses,
@@ -6444,9 +6158,6 @@ int spider_db_bulk_insert(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
spider->store_last_insert_id = 0;
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
}
if (
(bulk_end || !spider->bulk_insert) &&
@@ -6456,95 +6167,6 @@ int spider_db_bulk_insert(
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_bulk_insert(
- ha_spider *spider
-) {
- int error_num = 0, first_insert_link_idx = -1, tmp_error_num;
- int roop_count2;
- SPIDER_SHARE *share = spider->share;
- SPIDER_CONN *conn, *first_insert_conn = NULL;
- TABLE *table = spider->get_table();
- THD *thd = spider->wide_handler->trx->thd;
- DBUG_ENTER("spider_db_bulk_bulk_insert");
- for (
- roop_count2 = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, -1, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY);
- roop_count2 < (int) share->link_count;
- roop_count2 = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, roop_count2, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY)
- ) {
- conn = spider->conns[roop_count2];
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn,
- roop_count2)))
- {
- error_num = tmp_error_num;
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- if (first_insert_link_idx == -1)
- {
- first_insert_link_idx = roop_count2;
- first_insert_conn = conn;
- }
- }
-
- conn = first_insert_conn;
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[first_insert_link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (table->next_number_field &&
- (
- !table->auto_increment_field_not_null ||
- (
- !table->next_number_field->val_int() &&
- !(thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)
- )
- )
- ) {
- ulonglong last_insert_id;
- if (spider->store_last_insert_id)
- last_insert_id = spider->store_last_insert_id;
- else
- last_insert_id = conn->db_conn->last_insert_id();
- table->next_number_field->set_notnull();
- if (
- (tmp_error_num = spider_db_update_auto_increment(spider,
- first_insert_link_idx)) ||
- (tmp_error_num = table->next_number_field->store(
- last_insert_id, TRUE))
- ) {
- error_num = tmp_error_num;
- }
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- spider->store_last_insert_id = 0;
- DBUG_RETURN(error_num);
-}
-#endif
int spider_db_update_auto_increment(
ha_spider *spider,
@@ -6581,11 +6203,7 @@ int spider_db_update_auto_increment(
if (
table->s->next_number_keypart == 0 &&
mysql_bin_log.is_open() &&
-#if MYSQL_VERSION_ID < 50500
- !thd->current_stmt_binlog_row_based
-#else
!thd->is_current_stmt_binlog_format_row()
-#endif
) {
if (
spider->check_partitioned() &&
@@ -6614,11 +6232,7 @@ int spider_db_update_auto_increment(
if (
table->s->next_number_keypart == 0 &&
mysql_bin_log.is_open() &&
-#if MYSQL_VERSION_ID < 50500
- !thd->current_stmt_binlog_row_based
-#else
!thd->is_current_stmt_binlog_format_row()
-#endif
) {
for (roop_count = 0; roop_count < (int) affected_rows; roop_count++)
push_warning_printf(thd, SPIDER_WARN_LEVEL_NOTE,
@@ -6905,9 +6519,7 @@ int spider_db_update(
) {
conn = spider->conns[roop_count];
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
conn->ignore_dup_key = spider->wide_handler->ignore_dup_key;
-#endif
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_UPDATE_SQL))
@@ -7079,246 +6691,6 @@ int spider_db_update(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int spider_db_direct_update(
- ha_spider *spider,
- TABLE *table,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- ha_rows *update_rows,
- ha_rows *found_rows
-) {
- int error_num, roop_count;
- SPIDER_SHARE *share = spider->share;
- SPIDER_CONN *conn;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- bool counted = FALSE;
- st_select_lex *select_lex;
- longlong select_limit;
- longlong offset_limit;
- DBUG_ENTER("spider_db_direct_update");
-
- spider_set_result_list_param(spider);
- result_list->finish_flg = FALSE;
- DBUG_PRINT("info", ("spider do_direct_update=%s",
- spider->do_direct_update ? "TRUE" : "FALSE"));
- DBUG_PRINT("info", ("spider direct_update_kinds=%u",
- spider->direct_update_kinds));
- if ((error_num = spider->append_update_sql_part()))
- DBUG_RETURN(error_num);
-
-/*
- SQL access -> SQL remote access
- !spider->do_direct_update &&
- (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
-
- SQL access -> SQL remote access with dirct_update
- spider->do_direct_update &&
- spider->direct_update_kinds == SPIDER_SQL_KIND_SQL &&
- spider->wide_handler->direct_update_fields
-
- Handlersocket access -> SQL remote access with dirct_update
- spider->do_direct_update &&
- (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL)
-
- Handlersocket access -> Handlersocket access
- spider->do_direct_update &&
- (spider->direct_update_kinds & SPIDER_SQL_KIND_HS)
-*/
-
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
- if (!spider->do_direct_update)
- {
-#endif
- if (
- (spider->sql_kinds & SPIDER_SQL_KIND_SQL) &&
- (error_num = spider->append_update_set_sql_part())
- ) {
- DBUG_RETURN(error_num);
- }
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
- } else {
- if (
- (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) &&
- (error_num = spider->append_direct_update_set_sql_part())
- ) {
- DBUG_RETURN(error_num);
- }
- }
-#endif
-
- result_list->desc_flg = FALSE;
- result_list->sorted = TRUE;
- if (spider->active_index == MAX_KEY)
- result_list->key_info = NULL;
- else
- result_list->key_info = &table->key_info[spider->active_index];
- spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
- result_list->limit_num =
- result_list->internal_limit >= select_limit ?
- select_limit : result_list->internal_limit;
- result_list->internal_offset += offset_limit;
- if (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL)
- {
- if (
- (error_num = spider->append_key_where_sql_part(
- (ranges && ranges->start_key.key) ? &ranges->start_key : NULL,
- (ranges && ranges->end_key.key) ? &ranges->end_key : NULL,
- SPIDER_SQL_TYPE_UPDATE_SQL)) ||
- (error_num = spider->
- append_key_order_for_direct_order_limit_with_alias_sql_part(
- NULL, 0, SPIDER_SQL_TYPE_UPDATE_SQL)) ||
- (error_num = spider->append_limit_sql_part(
- result_list->internal_offset, result_list->limit_num,
- SPIDER_SQL_TYPE_UPDATE_SQL))
- ) {
- DBUG_RETURN(error_num);
- }
- }
-
- for (
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, -1, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY);
- roop_count < (int) share->link_count;
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, roop_count, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY)
- ) {
- ulong sql_type;
- DBUG_PRINT("info", ("spider exec sql"));
- conn = spider->conns[roop_count];
- sql_type = SPIDER_SQL_TYPE_UPDATE_SQL;
- spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
- if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
- {
- if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- DBUG_RETURN(error_num);
- }
- if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
-#ifdef HA_CAN_BULK_ACCESS
- if (spider->is_bulk_access_clone)
- {
- spider->connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn);
- } else {
-#endif
- conn->need_mon = &spider->need_mons[roop_count];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, roop_count)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- if (
- share->monitoring_kind[roop_count] &&
- spider->need_mons[roop_count]
- ) {
- error_num = spider_ping_table_mon_from_table(
- spider->wide_handler->trx,
- spider->wide_handler->trx->thd,
- share,
- roop_count,
- (uint32) share->monitoring_sid[roop_count],
- share->table_name,
- share->table_name_length,
- spider->conn_link_idx[roop_count],
- NULL,
- 0,
- share->monitoring_kind[roop_count],
- share->monitoring_limit[roop_count],
- share->monitoring_flag[roop_count],
- TRUE
- );
- }
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, roop_count,
- spider->wide_handler->trx->thd,
- share);
- if (
- (error_num = dbton_hdl->execute_sql(
- sql_type,
- conn,
- -1,
- &spider->need_mons[roop_count])
- ) &&
- (error_num != HA_ERR_FOUND_DUPP_KEY || !spider->ignore_dup_key)
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- if (
- error_num != ER_DUP_ENTRY &&
- error_num != ER_DUP_KEY &&
- error_num != HA_ERR_FOUND_DUPP_KEY &&
- share->monitoring_kind[roop_count] &&
- spider->need_mons[roop_count]
- ) {
- error_num = spider_ping_table_mon_from_table(
- spider->wide_handler->trx,
- spider->wide_handler->trx->thd,
- share,
- roop_count,
- (uint32) share->monitoring_sid[roop_count],
- share->table_name,
- share->table_name_length,
- spider->conn_link_idx[roop_count],
- NULL,
- 0,
- share->monitoring_kind[roop_count],
- share->monitoring_limit[roop_count],
- share->monitoring_flag[roop_count],
- TRUE
- );
- }
- DBUG_RETURN(error_num);
- }
- if (!counted)
- {
- *update_rows = spider->conns[roop_count]->db_conn->affected_rows();
- DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows));
- *found_rows = spider->conns[roop_count]->db_conn->matched_rows();
- DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows));
- counted = TRUE;
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL);
- DBUG_RETURN(0);
-}
-#else
int spider_db_direct_update(
ha_spider *spider,
TABLE *table,
@@ -7355,17 +6727,14 @@ int spider_db_direct_update(
spider->wide_handler->direct_update_fields
*/
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
if (!spider->do_direct_update)
{
-#endif
if (
(spider->sql_kinds & SPIDER_SQL_KIND_SQL) &&
(error_num = spider->append_update_set_sql_part())
) {
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
} else {
if (
(spider->direct_update_kinds & SPIDER_SQL_KIND_SQL) &&
@@ -7374,7 +6743,6 @@ int spider_db_direct_update(
DBUG_RETURN(error_num);
}
}
-#endif
result_list->desc_flg = FALSE;
result_list->sorted = TRUE;
@@ -7439,13 +6807,6 @@ int spider_db_direct_update(
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (spider->is_bulk_access_clone)
- {
- spider->connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn);
- } else {
-#endif
conn->need_mon = &spider->need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -7538,70 +6899,13 @@ int spider_db_direct_update(
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
conn->mta_conn_mutex_lock_already = FALSE;
conn->mta_conn_mutex_unlock_later = FALSE;
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
spider->reset_sql_sql(SPIDER_SQL_TYPE_UPDATE_SQL);
DBUG_RETURN(0);
}
-#endif
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_direct_update(
- ha_spider *spider,
- ha_rows *update_rows,
- ha_rows *found_rows
-) {
- int error_num = 0, roop_count, tmp_error_num;
- SPIDER_SHARE *share = spider->share;
- SPIDER_CONN *conn;
- bool counted = FALSE;
- DBUG_ENTER("spider_db_bulk_direct_update");
- for (
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, -1, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY);
- roop_count < (int) share->link_count;
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, roop_count, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY)
- ) {
- DBUG_PRINT("info", ("spider exec sql"));
- conn = spider->conns[roop_count];
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((tmp_error_num = spider_db_bulk_open_handler(spider, conn,
- roop_count)))
- {
- error_num = tmp_error_num;
- }
- if (!counted)
- {
- *update_rows = spider->conns[roop_count]->db_conn->affected_rows();
- DBUG_PRINT("info", ("spider update_rows = %llu", *update_rows));
- *found_rows = spider->conns[roop_count]->db_conn->matched_rows();
- DBUG_PRINT("info", ("spider found_rows = %llu", *found_rows));
- counted = TRUE;
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- DBUG_RETURN(error_num);
-}
-#endif
int spider_db_bulk_delete(
ha_spider *spider,
@@ -7704,207 +7008,6 @@ int spider_db_delete(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int spider_db_direct_delete(
- ha_spider *spider,
- TABLE *table,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- ha_rows *delete_rows
-) {
- int error_num, roop_count;
- SPIDER_SHARE *share = spider->share;
- SPIDER_CONN *conn;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- bool counted = FALSE;
- st_select_lex *select_lex;
- longlong select_limit;
- longlong offset_limit;
- DBUG_ENTER("spider_db_direct_delete");
-
- spider_set_result_list_param(spider);
- result_list->finish_flg = FALSE;
- result_list->desc_flg = FALSE;
- result_list->sorted = TRUE;
- if (spider->active_index == MAX_KEY)
- result_list->key_info = NULL;
- else
- result_list->key_info = &table->key_info[spider->active_index];
- spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
- result_list->limit_num =
- result_list->internal_limit >= select_limit ?
- select_limit : result_list->internal_limit;
- result_list->internal_offset += offset_limit;
-/*
- result_list->limit_num =
- result_list->internal_limit >= result_list->split_read ?
- result_list->split_read : result_list->internal_limit;
-*/
- if (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL)
- {
- if (
- (error_num = spider->append_delete_sql_part()) ||
- (error_num = spider->append_from_sql_part(SPIDER_SQL_TYPE_DELETE_SQL))
- ) {
- DBUG_RETURN(error_num);
- }
- spider->set_where_pos_sql(SPIDER_SQL_TYPE_DELETE_SQL);
- if (
- (error_num = spider->append_key_where_sql_part(
- (ranges && ranges->start_key.key) ? &ranges->start_key : NULL,
- (ranges && ranges->end_key.key) ? &ranges->end_key : NULL,
- SPIDER_SQL_TYPE_DELETE_SQL)) ||
- (error_num = spider->
- append_key_order_for_direct_order_limit_with_alias_sql_part(
- NULL, 0, SPIDER_SQL_TYPE_DELETE_SQL)) ||
- (error_num = spider->append_limit_sql_part(
- result_list->internal_offset, result_list->limit_num,
- SPIDER_SQL_TYPE_DELETE_SQL))
- ) {
- DBUG_RETURN(error_num);
- }
- }
-
- for (
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, -1, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY);
- roop_count < (int) share->link_count;
- roop_count = spider_conn_link_idx_next(share->link_statuses,
- spider->conn_link_idx, roop_count, share->link_count,
- SPIDER_LINK_STATUS_RECOVERY)
- ) {
- ulong sql_type;
- DBUG_PRINT("info", ("spider exec sql"));
- conn = spider->conns[roop_count];
- sql_type = SPIDER_SQL_TYPE_DELETE_SQL;
- spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
- if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
- {
- if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- DBUG_RETURN(error_num);
- }
- if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
- {
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- }
-#ifdef HA_CAN_BULK_ACCESS
- if (spider->is_bulk_access_clone)
- {
- spider->connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn);
- } else {
-#endif
- conn->need_mon = &spider->need_mons[roop_count];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, roop_count)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- if (
- share->monitoring_kind[roop_count] &&
- spider->need_mons[roop_count]
- ) {
- error_num = spider_ping_table_mon_from_table(
- spider->wide_handler->trx,
- spider->wide_handler->trx->thd,
- share,
- roop_count,
- (uint32) share->monitoring_sid[roop_count],
- share->table_name,
- share->table_name_length,
- spider->conn_link_idx[roop_count],
- NULL,
- 0,
- share->monitoring_kind[roop_count],
- share->monitoring_limit[roop_count],
- share->monitoring_flag[roop_count],
- TRUE
- );
- }
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, roop_count,
- spider->wide_handler->trx->thd,
- share);
- if (dbton_hdl->execute_sql(
- sql_type,
- conn,
- -1,
- &spider->need_mons[roop_count])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- if (
- share->monitoring_kind[roop_count] &&
- spider->need_mons[roop_count]
- ) {
- error_num = spider_ping_table_mon_from_table(
- spider->wide_handler->trx,
- spider->wide_handler->trx->thd,
- share,
- roop_count,
- (uint32) share->monitoring_sid[roop_count],
- share->table_name,
- share->table_name_length,
- spider->conn_link_idx[roop_count],
- NULL,
- 0,
- share->monitoring_kind[roop_count],
- share->monitoring_limit[roop_count],
- share->monitoring_flag[roop_count],
- TRUE
- );
- }
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- if (!counted)
- {
- *delete_rows = spider->conns[roop_count]->db_conn->affected_rows();
- DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows));
- counted = TRUE;
- }
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- int error_num2 = 0;
- if (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL)
- {
- if ((error_num = spider->reset_sql_sql(SPIDER_SQL_TYPE_DELETE_SQL)))
- error_num2 = error_num;
- }
- DBUG_RETURN(error_num2);
-}
-#else
int spider_db_direct_delete(
ha_spider *spider,
TABLE *table,
@@ -7992,13 +7095,6 @@ int spider_db_direct_delete(
pthread_mutex_lock(&conn->mta_conn_mutex);
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
}
-#ifdef HA_CAN_BULK_ACCESS
- if (spider->is_bulk_access_clone)
- {
- spider->connection_ids[roop_count] = conn->connection_id;
- spider_trx_add_bulk_access_conn(spider->wide_handler->trx, conn);
- } else {
-#endif
conn->need_mon = &spider->need_mons[roop_count];
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
@@ -8082,9 +7178,6 @@ int spider_db_direct_delete(
DBUG_PRINT("info", ("spider delete_rows = %llu", *delete_rows));
counted = TRUE;
}
-#ifdef HA_CAN_BULK_ACCESS
- }
-#endif
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
@@ -8096,8 +7189,6 @@ int spider_db_direct_delete(
}
DBUG_RETURN(error_num2);
}
-#endif
-#endif
int spider_db_delete_all_rows(
ha_spider *spider
@@ -8823,11 +7914,9 @@ int spider_db_print_item_type(
case Item::FUNC_ITEM:
DBUG_RETURN(spider_db_open_item_func((Item_func *) item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
case Item::SUM_FUNC_ITEM:
DBUG_RETURN(spider_db_open_item_sum_func((Item_sum *)item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
-#endif
case Item::COND_ITEM:
DBUG_RETURN(spider_db_open_item_cond((Item_cond *) item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
@@ -8840,7 +7929,6 @@ int spider_db_print_item_type(
case Item::ROW_ITEM:
DBUG_RETURN(spider_db_open_item_row((Item_row *) item, spider, str,
alias, alias_length, dbton_id, use_fields, fields));
-#ifdef SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
case Item::CONST_ITEM:
{
switch (item->cmp_type()) {
@@ -8858,16 +7946,6 @@ int spider_db_print_item_type(
DBUG_RETURN(spider_db_print_item_type_default(item, spider, str));
}
}
-#else
- case Item::STRING_ITEM:
- DBUG_RETURN(spider_db_open_item_string(item, field, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- case Item::INT_ITEM:
- case Item::REAL_ITEM:
- case Item::DECIMAL_ITEM:
- DBUG_RETURN(spider_db_open_item_int(item, field, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
-#endif
case Item::CACHE_ITEM:
DBUG_RETURN(spider_db_open_item_cache((Item_cache *) item, field, spider,
str, alias, alias_length, dbton_id, use_fields, fields));
@@ -8902,11 +7980,7 @@ int spider_db_print_item_type_default(
{
if (spider->share->access_charset->cset == system_charset_info->cset)
{
-#if MYSQL_VERSION_ID < 50500
- item->print(str->get_str(), QT_IS);
-#else
item->print(str->get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
} else {
item->print(str->get_str(), QT_ORDINARY);
}
@@ -9013,7 +8087,6 @@ int spider_db_open_item_func(
item_func, spider, str, alias, alias_length, use_fields, fields));
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@@ -9028,7 +8101,6 @@ int spider_db_open_item_sum_func(
DBUG_RETURN(spider_dbton[dbton_id].db_util->open_item_sum_func(
item_sum, spider, str, alias, alias_length, use_fields, fields));
}
-#endif
int spider_db_open_item_ident(
Item_ident *item_ident,
@@ -9763,7 +8835,6 @@ int spider_db_append_condition(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int spider_db_append_update_columns(
ha_spider *spider,
spider_string *str,
@@ -9818,9 +8889,7 @@ int spider_db_append_update_columns(
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
DBUG_RETURN(0);
}
-#endif
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_db_check_select_colum_in_group(
st_select_lex *select_lex,
Field *field
@@ -9843,7 +8912,6 @@ bool spider_db_check_select_colum_in_group(
}
DBUG_RETURN(FALSE);
}
-#endif
uint spider_db_check_ft_idx(
Item_func *item_func,
@@ -10076,13 +9144,8 @@ int spider_db_udf_direct_sql(
spider_param_ping_interval_at_trx_start(thd);
time_t tmp_time = (time_t) time((time_t*) 0);
bool need_trx_end, need_all_commit, insert_start = FALSE;
-#if MYSQL_VERSION_ID < 50500
-#else
enum_sql_command sql_command_backup;
-#endif
DBUG_ENTER("spider_db_udf_direct_sql");
-#if MYSQL_VERSION_ID < 50500
-#else
if (direct_sql->real_table_used)
{
if (spider_sys_open_and_lock_tables(c_thd, &direct_sql->table_list_first,
@@ -10101,7 +9164,6 @@ int spider_db_udf_direct_sql(
direct_sql->open_tables_thd = c_thd;
roop_count = 0;
}
-#endif
if (c_thd != thd)
{
@@ -10109,21 +9171,15 @@ int spider_db_udf_direct_sql(
need_trx_end = TRUE;
} else {
need_all_commit = FALSE;
-#if MYSQL_VERSION_ID < 50500
-#else
if (direct_sql->real_table_used)
{
need_trx_end = TRUE;
} else {
-#endif
if (c_thd->transaction->stmt.ha_list)
need_trx_end = FALSE;
else
need_trx_end = TRUE;
-#if MYSQL_VERSION_ID < 50500
-#else
}
-#endif
}
if (!conn->disable_reconnect)
@@ -10143,11 +9199,8 @@ int spider_db_udf_direct_sql(
DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM);
}
-#if MYSQL_VERSION_ID < 50500
-#else
sql_command_backup = c_thd->lex->sql_command;
c_thd->lex->sql_command = SQLCOM_INSERT;
-#endif
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
pthread_mutex_lock(&conn->mta_conn_mutex);
@@ -10230,9 +9283,6 @@ int spider_db_udf_direct_sql(
for (; roop_count2 < set_off; roop_count2++)
bitmap_clear_bit(table->write_set, (uint) roop_count2);
-#if MYSQL_VERSION_ID < 50500
- if (table->file->has_transactions())
-#endif
{
THR_LOCK_DATA *to[2];
table->file->store_lock(table->in_use, to,
@@ -10243,8 +9293,6 @@ int spider_db_udf_direct_sql(
table->file->print_error(error_num, MYF(0));
break;
}
-#if MYSQL_VERSION_ID < 50500
-#else
if (
table->s->tmp_table == NO_TMP_TABLE &&
table->pos_in_table_list
@@ -10266,7 +9314,6 @@ int spider_db_udf_direct_sql(
next_tables = next_tables->next_global;
}
}
-#endif
}
if (direct_sql->iop)
@@ -10328,13 +9375,8 @@ int spider_db_udf_direct_sql(
else if (direct_sql->iop[roop_count] == 2)
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
}
-#if MYSQL_VERSION_ID < 50500
- if (table->file->has_transactions())
-#endif
{
table->file->ha_external_unlock(table->in_use);
-#if MYSQL_VERSION_ID < 50500
-#else
if (
table->s->tmp_table == NO_TMP_TABLE &&
table->pos_in_table_list
@@ -10350,7 +9392,6 @@ int spider_db_udf_direct_sql(
next_tables = next_tables->next_global;
}
}
-#endif
}
table->file->ha_reset();
table->in_use = thd;
@@ -10413,10 +9454,7 @@ int spider_db_udf_direct_sql(
}
}
}
-#if MYSQL_VERSION_ID < 50500
-#else
c_thd->lex->sql_command = sql_command_backup;
-#endif
DBUG_RETURN(error_num);
}
@@ -11375,7 +10413,6 @@ int spider_db_udf_copy_tables(
}
}
*/
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (copy_tables->bg_mode)
{
for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn;
@@ -11389,7 +10426,6 @@ int spider_db_udf_copy_tables(
}
}
} else {
-#endif
for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn;
dst_tbl_conn = dst_tbl_conn->next)
{
@@ -11428,11 +10464,8 @@ int spider_db_udf_copy_tables(
pthread_mutex_unlock(&tmp_conn->mta_conn_mutex);
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (copy_tables->bg_mode)
{
for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn;
@@ -11455,7 +10488,6 @@ int spider_db_udf_copy_tables(
}
}
}
-#endif
}
if (copy_tables->use_transaction)
@@ -11501,7 +10533,6 @@ int spider_db_udf_copy_tables(
DBUG_RETURN(0);
error_db_query:
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (copy_tables->bg_mode)
{
for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn;
@@ -11516,7 +10547,6 @@ error_db_query:
}
}
}
-#endif
error_unlock_tables:
error_commit:
error_lock_tables:
@@ -11631,20 +10661,6 @@ error:
DBUG_RETURN(error_num);
}
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_open_handler(
- ha_spider *spider,
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num = 0;
- DBUG_ENTER("spider_db_bulk_open_handler");
- DBUG_PRINT("info",("spider spider=%p", spider));
- DBUG_PRINT("info",("spider conn=%p", conn));
- DBUG_PRINT("info",("spider link_idx=%d", link_idx));
- DBUG_RETURN(error_num);
-}
-#endif
int spider_db_close_handler(
ha_spider *spider,
diff --git a/storage/spider/spd_db_conn.h b/storage/spider/spd_db_conn.h
index b87c57bc4ab..adda66d547b 100644
--- a/storage/spider/spd_db_conn.h
+++ b/storage/spider/spd_db_conn.h
@@ -496,7 +496,6 @@ int spider_db_append_charset_name_before_string(
CHARSET_INFO *cs
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_refetch_for_item_sum_funcs(
ha_spider *spider
);
@@ -511,7 +510,6 @@ int spider_db_fetch_for_item_sum_func(
Item_sum *item_sum,
ha_spider *spider
);
-#endif
int spider_db_append_match_fetch(
ha_spider *spider,
@@ -636,14 +634,6 @@ void spider_db_discard_multiple_result(
SPIDER_CONN *conn
);
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_store_result(
- ha_spider *spider,
- SPIDER_CONN *conn,
- int link_idx,
- bool discard_result
-);
-#endif
int spider_db_fetch(
uchar *buf,
@@ -766,11 +756,6 @@ int spider_db_bulk_insert(
bool bulk_end
);
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_bulk_insert(
- ha_spider *spider
-);
-#endif
int spider_db_update_auto_increment(
ha_spider *spider,
@@ -799,32 +784,13 @@ int spider_db_update(
const uchar *old_data
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-int spider_db_direct_update(
- ha_spider *spider,
- TABLE *table,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
- ha_rows *update_rows,
- ha_rows *found_rows
-);
-#else
int spider_db_direct_update(
ha_spider *spider,
TABLE *table,
ha_rows *update_rows,
ha_rows *found_rows
);
-#endif
-#endif
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_direct_update(
- ha_spider *spider,
- ha_rows *update_rows
-);
-#endif
int spider_db_bulk_delete(
ha_spider *spider,
@@ -838,23 +804,11 @@ int spider_db_delete(
const uchar *buf
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
int spider_db_direct_delete(
ha_spider *spider,
TABLE *table,
- KEY_MULTI_RANGE *ranges,
- uint range_count,
ha_rows *delete_rows
);
-#else
-int spider_db_direct_delete(
- ha_spider *spider,
- TABLE *table,
- ha_rows *delete_rows
-);
-#endif
-#endif
int spider_db_delete_all_rows(
ha_spider *spider
@@ -944,7 +898,6 @@ int spider_db_open_item_func(
spider_fields *fields
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@@ -955,7 +908,6 @@ int spider_db_open_item_sum_func(
bool use_fields,
spider_fields *fields
);
-#endif
int spider_db_open_item_ident(
Item_ident *item_ident,
@@ -1056,7 +1008,6 @@ int spider_db_append_condition(
bool test_flg
);
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int spider_db_append_update_columns(
ha_spider *spider,
spider_string *str,
@@ -1066,14 +1017,11 @@ int spider_db_append_update_columns(
bool use_fields,
spider_fields *fields
);
-#endif
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_db_check_select_colum_in_group(
st_select_lex *select_lex,
Field *field
);
-#endif
uint spider_db_check_ft_idx(
Item_func *item_func,
@@ -1202,13 +1150,6 @@ int spider_db_open_handler(
int link_idx
);
-#ifdef HA_CAN_BULK_ACCESS
-int spider_db_bulk_open_handler(
- ha_spider *spider,
- SPIDER_CONN *conn,
- int link_idx
-);
-#endif
int spider_db_close_handler(
ha_spider *spider,
diff --git a/storage/spider/spd_db_include.cc b/storage/spider/spd_db_include.cc
index 4eab1f4be54..a4d7d4b49a0 100644
--- a/storage/spider/spd_db_include.cc
+++ b/storage/spider/spd_db_include.cc
@@ -12,20 +12,15 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
-#endif
#include "sql_common.h"
#include <mysql.h>
#include <errmsg.h>
@@ -45,7 +40,6 @@ spider_db_result::spider_db_result(
DBUG_VOID_RETURN;
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int spider_db_result::fetch_table_checksum(
ha_spider *spider
) {
@@ -53,7 +47,6 @@ int spider_db_result::fetch_table_checksum(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_RETURN(0);
}
-#endif
uint spider_db_result::limit_mode()
{
@@ -193,7 +186,6 @@ uint spider_db_util::limit_mode()
DBUG_RETURN(0);
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
bool spider_db_share::checksum_support()
{
DBUG_ENTER("spider_db_share::checksum_support");
@@ -208,9 +200,7 @@ int spider_db_handler::checksum_table(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_RETURN(0);
}
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool spider_db_handler::check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
@@ -244,4 +234,3 @@ bool spider_db_handler::check_direct_delete(
}
DBUG_RETURN(FALSE);
}
-#endif
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 09c39535f1f..338dc1030fc 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -28,56 +28,20 @@
#define SPIDER_DB_WRAPPER_MYSQL "mysql"
#define SPIDER_DB_WRAPPER_MARIADB "mariadb"
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100204
#define PLUGIN_VAR_CAN_MEMALLOC
-/*
-#define ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC
-#define HASH_UPDATE_WITH_HASH_VALUE
-*/
-#else
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-#define HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
-#endif
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
-#define SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
#define SPIDER_HAS_APPEND_FOR_SINGLE_QUOTE
#define SPIDER_HAS_SHOW_SIMPLE_FUNC
#define SPIDER_HAS_JT_HASH_INDEX_MERGE
#define SPIDER_HAS_EXPR_CACHE_ITEM
-#else
-#define SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100007
#define SPIDER_ITEM_HAS_CMP_TYPE
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define SPIDER_HAS_TIME_STATUS
#define SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100014
#define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100
#define SPIDER_ITEM_STRING_WITHOUT_SET_STR_WITH_COPY_AND_THDPTR
-#endif
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
-#define SPIDER_HAS_GROUP_BY_HANDLER
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200
#define SPIDER_ORDER_HAS_ENUM_ORDER
-#endif
-
-#if defined(MARIADB_BASE_VERSION)
#define SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
#define SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
-#endif
class spider_db_conn;
typedef spider_db_conn SPIDER_DB_CONN;
@@ -827,7 +791,6 @@ public:
bool use_fields,
spider_fields *fields
) = 0;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@@ -837,12 +800,10 @@ public:
bool use_fields,
spider_fields *fields
) = 0;
-#endif
virtual int append_escaped_util(
spider_string *to,
String *from
) = 0;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
virtual int append_from_and_tables(
ha_spider *spider,
spider_fields *fields,
@@ -861,7 +822,6 @@ public:
virtual int append_having(
spider_string *str
) = 0;
-#endif
virtual bool tables_on_different_db_are_joinable();
virtual bool socket_has_default_value();
virtual bool database_has_default_value();
@@ -944,11 +904,9 @@ public:
int mode,
ha_rows &records
) = 0;
-#ifdef HA_HAS_CHECKSUM_EXTENDED
virtual int fetch_table_checksum(
ha_spider *spider
);
-#endif
virtual int fetch_table_cardinality(
int mode,
TABLE *table,
@@ -965,7 +923,6 @@ public:
longlong pos
) = 0;
virtual int get_errno() = 0;
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
virtual int fetch_columns_for_discover_table_structure(
spider_string *str,
CHARSET_INFO *access_charset
@@ -979,7 +936,6 @@ public:
SPIDER_SHARE *spider_share,
CHARSET_INFO *access_charset
) = 0;
-#endif
virtual uint limit_mode();
};
@@ -1186,16 +1142,12 @@ public:
uint alias_length
) = 0;
virtual bool need_change_db_table_name() = 0;
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
virtual int discover_table_structure(
SPIDER_TRX *trx,
SPIDER_SHARE *spider_share,
spider_string *str
) = 0;
-#endif
-#ifdef HA_HAS_CHECKSUM_EXTENDED
virtual bool checksum_support();
-#endif
};
class spider_db_handler
@@ -1210,9 +1162,7 @@ public:
ha_spider *spider;
spider_db_share *db_share;
int first_link_idx;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
SPIDER_LINK_IDX_CHAIN *link_idx_chain;
-#endif
bool strict_group_by;
bool no_where_cond;
spider_db_handler(ha_spider *spider, spider_db_share *db_share) :
@@ -1264,7 +1214,6 @@ public:
virtual int append_update_part() = 0;
virtual int append_delete_part() = 0;
virtual int append_update_set_part() = 0;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
virtual int append_direct_update_set_part() = 0;
virtual int append_dup_update_pushdown_part(
const char *alias,
@@ -1275,7 +1224,6 @@ public:
uint alias_length
) = 0;
virtual int check_update_columns_part() = 0;
-#endif
virtual int append_select_part(
ulong sql_type
) = 0;
@@ -1357,26 +1305,22 @@ public:
const char *alias,
uint alias_length
) = 0;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int append_sum_select_part(
ulong sql_type,
const char *alias,
uint alias_length
) = 0;
-#endif
virtual void set_order_pos(
ulong sql_type
) = 0;
virtual void set_order_to_pos(
ulong sql_type
) = 0;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
virtual int append_group_by_part(
const char *alias,
uint alias_length,
ulong sql_type
) = 0;
-#endif
virtual int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,
@@ -1504,13 +1448,11 @@ public:
virtual bool need_lock_before_set_sql_for_exec(
ulong sql_type
) = 0;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
virtual int set_sql_for_exec(
ulong sql_type,
int link_idx,
SPIDER_LINK_IDX_CHAIN *link_idx_chain
) = 0;
-#endif
virtual int set_sql_for_exec(
ulong sql_type,
int link_idx
@@ -1544,11 +1486,9 @@ public:
virtual int show_records(
int link_idx
) = 0;
-#ifdef HA_HAS_CHECKSUM_EXTENDED
virtual int checksum_table(
int link_idx
);
-#endif
virtual int show_last_insert_id(
int link_idx,
ulonglong &last_insert_id
@@ -1626,7 +1566,6 @@ public:
int link_idx,
ulong sql_type
) = 0;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
virtual int append_from_and_tables_part(
spider_fields *fields,
ulong sql_type
@@ -1673,8 +1612,6 @@ public:
spider_fields *fields,
ulong sql_type
) = 0;
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
virtual bool check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
@@ -1685,7 +1622,6 @@ public:
longlong select_limit,
longlong offset_limit
);
-#endif
};
class spider_db_copy_table
@@ -1804,9 +1740,7 @@ typedef struct st_spider_position
uint pos_mode;
bool use_position;
bool mrr_with_cnt;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate;
-#endif
uint sql_kind;
uchar *position_bitmap;
st_spider_ft_info *ft_first;
@@ -1825,13 +1759,9 @@ typedef struct st_spider_result
{
uint dbton_id;
SPIDER_DB_RESULT *result;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
st_spider_result *prev;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
st_spider_result *next;
SPIDER_POSITION *first_position; /* for quick mode */
int pos_page_size; /* for quick mode */
@@ -1850,17 +1780,11 @@ typedef struct st_spider_result
typedef struct st_spider_result_list
{
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
SPIDER_RESULT *first;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
SPIDER_RESULT *last;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
SPIDER_RESULT *current;
KEY *key_info;
int key_order;
@@ -1907,12 +1831,10 @@ typedef struct st_spider_result_list
/* the limit_offeset, without where condition */
bool direct_limit_offset;
bool direct_distinct;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool direct_aggregate;
bool snap_mrr_with_cnt;
bool snap_direct_aggregate;
SPIDER_DB_ROW *snap_row;
-#endif
bool in_cmp_ref;
bool set_split_read;
bool insert_dup_update_pushdown;
@@ -1924,14 +1846,11 @@ typedef struct st_spider_result_list
longlong second_read;
int set_split_read_count;
int *casual_read;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
/* 0:nomal 1:store 2:store end */
volatile
-#endif
int quick_phase;
bool keyread;
TABLE *table;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile int bgs_error;
bool bgs_error_with_message;
char bgs_error_msg[MYSQL_ERRMSG_SIZE];
@@ -1942,7 +1861,6 @@ typedef struct st_spider_result_list
volatile longlong bgs_second_read;
volatile longlong bgs_split_read;
volatile
-#endif
SPIDER_RESULT *bgs_current;
SPIDER_DB_ROW *tmp_pos_row_first;
} SPIDER_RESULT_LIST;
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index 70f5fae7cfe..52df7c6b982 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -1,5 +1,5 @@
/* Copyright (C) 2012-2018 Kentoku Shiba
- Copyright (c) 2020, MariaDB Corporation.
+ Copyright (c) 2020, 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
@@ -18,10 +18,6 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
@@ -29,10 +25,7 @@
#include "sql_analyse.h"
#include "sql_base.h"
#include "tztime.h"
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
-#endif
-#endif
#include "sql_common.h"
#include <mysql.h>
#include <errmsg.h>
@@ -145,7 +138,6 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR;
#define SPIDER_SQL_BINLOG_GTID_POS_STR "select binlog_gtid_pos"
#define SPIDER_SQL_BINLOG_GTID_POS_LEN sizeof(SPIDER_SQL_BINLOG_GTID_POS_STR) - 1
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
#define SPIDER_SQL_SHOW_COLUMNS_STR "show columns from "
#define SPIDER_SQL_SHOW_COLUMNS_LEN sizeof(SPIDER_SQL_SHOW_COLUMNS_STR) - 1
#define SPIDER_SQL_SELECT_COLUMNS_STR "select `column_name`,`column_default`,`is_nullable`,`character_set_name`,`collation_name`,`column_type`,`extra` from `information_schema`.`columns` where `table_schema` = "
@@ -161,16 +153,13 @@ static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR;
#define SPIDER_SQL_SPATIAL_LEN sizeof(SPIDER_SQL_SPATIAL_STR) - 1
#define SPIDER_SQL_USING_HASH_STR " using hash"
#define SPIDER_SQL_USING_HASH_LEN sizeof(SPIDER_SQL_USING_HASH_STR) - 1
-#endif
#define SPIDER_SQL_SHOW_RECORDS_RECORDS_POS 0
#define SPIDER_SQL_EXPLAIN_SELECT_RECORDS_POS 8
-#ifdef HA_HAS_CHECKSUM_EXTENDED
#define SPIDER_SQL_CHECKSUM_CHECKSUM_POS 1
#define SPIDER_SQL_CHECKSUM_TABLE_STR "checksum table "
#define SPIDER_SQL_CHECKSUM_TABLE_LEN (sizeof(SPIDER_SQL_CHECKSUM_TABLE_STR) - 1)
-#endif
#define SPIDER_SQL_LIKE_STR " like "
#define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1)
@@ -821,11 +810,7 @@ int spider_db_mbase_result::fetch_table_status(
int error_num;
MYSQL_ROW mysql_row;
MYSQL_TIME mysql_time;
-#ifdef MARIADB_BASE_VERSION
uint not_used_uint;
-#else
- my_bool not_used_my_bool;
-#endif
#ifdef SPIDER_HAS_TIME_STATUS
MYSQL_TIME_STATUS time_status;
#else
@@ -903,13 +888,8 @@ int spider_db_mbase_result::fetch_table_status(
#endif
SPIDER_str_to_datetime(mysql_row[11], strlen(mysql_row[11]),
&mysql_time, 0, &time_status);
-#ifdef MARIADB_BASE_VERSION
stat.create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat.create_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
} else
stat.create_time = (time_t) 0;
#ifdef DBUG_TRACE
@@ -928,13 +908,8 @@ int spider_db_mbase_result::fetch_table_status(
#endif
SPIDER_str_to_datetime(mysql_row[12], strlen(mysql_row[12]),
&mysql_time, 0, &time_status);
-#ifdef MARIADB_BASE_VERSION
stat.update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat.update_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
} else
stat.update_time = (time_t) 0;
#ifndef DBUG_OFF
@@ -953,13 +928,8 @@ int spider_db_mbase_result::fetch_table_status(
#endif
SPIDER_str_to_datetime(mysql_row[13], strlen(mysql_row[13]),
&mysql_time, 0, &time_status);
-#ifdef MARIADB_BASE_VERSION
stat.check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat.check_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
} else
stat.check_time = (time_t) 0;
#ifdef DBUG_TRACE
@@ -1032,13 +1002,8 @@ int spider_db_mbase_result::fetch_table_status(
#endif
SPIDER_str_to_datetime(mysql_row[6], strlen(mysql_row[6]),
&mysql_time, 0, &time_status);
-#ifdef MARIADB_BASE_VERSION
stat.create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat.create_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
} else
stat.create_time = (time_t) 0;
#ifdef DBUG_TRACE
@@ -1057,13 +1022,8 @@ int spider_db_mbase_result::fetch_table_status(
#endif
SPIDER_str_to_datetime(mysql_row[7], strlen(mysql_row[7]),
&mysql_time, 0, &time_status);
-#ifdef MARIADB_BASE_VERSION
stat.update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat.update_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
} else
stat.update_time = (time_t) 0;
#ifdef DBUG_TRACE
@@ -1082,13 +1042,8 @@ int spider_db_mbase_result::fetch_table_status(
#endif
SPIDER_str_to_datetime(mysql_row[8], strlen(mysql_row[8]),
&mysql_time, 0, &time_status);
-#ifdef MARIADB_BASE_VERSION
stat.check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat.check_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
} else
stat.check_time = (time_t) 0;
#ifdef DBUG_TRACE
@@ -1155,7 +1110,6 @@ int spider_db_mbase_result::fetch_simple_action(
DBUG_PRINT("info", ("spider records=%lld", *records));
break;
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
case SPIDER_SIMPLE_CHECKSUM_TABLE:
{
ha_spider *spider = (ha_spider *) param;
@@ -1172,7 +1126,6 @@ int spider_db_mbase_result::fetch_simple_action(
}
break;
}
-#endif
default:
DBUG_ASSERT(0);
break;
@@ -1196,7 +1149,6 @@ int spider_db_mbase_result::fetch_table_records(
}
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int spider_db_mbase_result::fetch_table_checksum(
ha_spider *spider
) {
@@ -1205,7 +1157,6 @@ int spider_db_mbase_result::fetch_table_checksum(
DBUG_RETURN(fetch_simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE,
SPIDER_SQL_CHECKSUM_CHECKSUM_POS, spider));
}
-#endif
int spider_db_mbase_result::fetch_table_cardinality(
int mode,
@@ -1430,7 +1381,6 @@ int spider_db_mbase_result::get_errno()
DBUG_RETURN(store_error_num);
}
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
int spider_db_mbase_result::fetch_columns_for_discover_table_structure(
spider_string *str,
CHARSET_INFO *access_charset
@@ -1803,7 +1753,6 @@ int spider_db_mbase_result::fetch_table_for_discover_table_structure(
}
DBUG_RETURN(0);
}
-#endif
spider_db_mbase::spider_db_mbase(
SPIDER_CONN *conn,
@@ -2349,7 +2298,7 @@ int spider_db_mbase::fetch_and_print_warnings(struct tm *l_time)
row = mysql_fetch_row(res);
}
}
-
+
mysql_free_result(res);
DBUG_RETURN(error_num);
@@ -2425,11 +2374,7 @@ int spider_db_mbase::next_result()
strmov(db_conn->net.sqlstate, "00000");
db_conn->affected_rows = ~(my_ulonglong) 0;
-#if MYSQL_VERSION_ID < 50500
- if (db_conn->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS)
-#else
if (db_conn->server_status & SERVER_MORE_RESULTS_EXISTS)
-#endif
{
if ((status = db_conn->methods->read_query_result(db_conn)) > 0)
DBUG_RETURN(spider_db_errorno(conn));
@@ -2443,11 +2388,7 @@ uint spider_db_mbase::affected_rows()
MYSQL *last_used_con;
DBUG_ENTER("spider_db_mbase::affected_rows");
DBUG_PRINT("info",("spider this=%p", this));
-#if MYSQL_VERSION_ID < 50500
- last_used_con = db_conn->last_used_con;
-#else
last_used_con = db_conn;
-#endif
DBUG_RETURN((uint) last_used_con->affected_rows);
}
@@ -2456,11 +2397,7 @@ uint spider_db_mbase::matched_rows()
MYSQL *last_used_con;
DBUG_ENTER("spider_db_mysql::matched_rows");
DBUG_PRINT("info", ("spider this=%p", this));
-#if MYSQL_VERSION_ID < 50500
- last_used_con = db_conn->last_used_con;
-#else
last_used_con = db_conn;
-#endif
/* Rows matched: 65 Changed: 65 Warnings: 0 */
const char *info = last_used_con->info;
if (!info)
@@ -2485,11 +2422,7 @@ bool spider_db_mbase::inserted_info(
{
DBUG_RETURN(TRUE);
}
-#if MYSQL_VERSION_ID < 50500
- last_used_con = db_conn->last_used_con;
-#else
last_used_con = db_conn;
-#endif
/* Records: 10 Duplicates: 4 Warnings: 0 */
const char *info = last_used_con->info;
if (!info)
@@ -2531,11 +2464,7 @@ ulonglong spider_db_mbase::last_insert_id()
MYSQL *last_used_con;
DBUG_ENTER("spider_db_mbase::last_insert_id");
DBUG_PRINT("info",("spider this=%p", this));
-#if MYSQL_VERSION_ID < 50500
- last_used_con = db_conn->last_used_con;
-#else
last_used_con = db_conn;
-#endif
DBUG_RETURN((uint) last_used_con->insert_id);
}
@@ -3418,12 +3347,7 @@ int spider_db_mbase::set_loop_check(
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&conn->loop_check_queue,
- lcptr->hash_value, (uchar *) lcptr);
-#else
my_hash_delete(&conn->loop_check_queue, (uchar*) lcptr);
-#endif
}
DBUG_RETURN(0);
}
@@ -3809,12 +3733,7 @@ int spider_db_mbase::append_lock_tables(
my_hash_reset(&lock_table_hash);
DBUG_RETURN(error_num);
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&lock_table_hash,
- tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash);
-#else
my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash);
-#endif
}
if ((error_num = spider_db_mbase_utility->append_lock_table_tail(str)))
{
@@ -6082,11 +6001,7 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
}
-#if MYSQL_VERSION_ID < 50500
- item_func->print(tmp_str.get_str(), QT_IS);
-#else
item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
tmp_str.mem_calc();
if (tmp_str.reserve(1))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -6220,11 +6135,7 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
}
-#if MYSQL_VERSION_ID < 50500
- item_func->print(tmp_str.get_str(), QT_IS);
-#else
item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
tmp_str.mem_calc();
if (tmp_str.reserve(1))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -6377,11 +6288,7 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
}
-#if MYSQL_VERSION_ID < 50500
- item_func->print(tmp_str.get_str(), QT_IS);
-#else
item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
tmp_str.mem_calc();
if (tmp_str.reserve(1))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -6840,7 +6747,6 @@ int spider_db_mbase_util::open_item_func(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_db_mbase_util::open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@@ -6958,7 +6864,6 @@ int spider_db_mbase_util::open_item_sum_func(
}
DBUG_RETURN(0);
}
-#endif
int spider_db_mbase_util::append_escaped_util(
spider_string *to,
@@ -6972,7 +6877,6 @@ int spider_db_mbase_util::append_escaped_util(
DBUG_RETURN(0);
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int spider_db_mbase_util::append_table(
ha_spider *spider,
spider_fields *fields,
@@ -7546,7 +7450,6 @@ int spider_db_mbase_util::append_having(
str->q_append(SPIDER_SQL_HAVING_STR, SPIDER_SQL_HAVING_LEN);
DBUG_RETURN(0);
}
-#endif
bool spider_db_mbase_util::tables_on_different_db_are_joinable()
{
@@ -7617,9 +7520,7 @@ spider_mbase_share::spider_mbase_share(
table_names_str(NULL),
db_names_str(NULL),
db_table_str(NULL),
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
db_table_str_hash_value(NULL),
-#endif
table_nm_max_length(0),
db_nm_max_length(0),
column_name_str(NULL),
@@ -7706,10 +7607,8 @@ int spider_mbase_share::init()
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&key_select_pos,
sizeof(int) * keys,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
&db_table_str_hash_value,
sizeof(my_hash_value_type) * spider_share->all_link_count,
-#endif
NullS))
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -7984,10 +7883,8 @@ int spider_mbase_share::create_table_names_str()
if ((error_num = append_table_name(str, roop_count)))
goto error;
}
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
db_table_str_hash_value[roop_count] = my_calc_hash(
&spider_open_connections, (uchar*) str->ptr(), str->length());
-#endif
}
DBUG_RETURN(0);
@@ -8368,7 +8265,6 @@ bool spider_mbase_share::need_change_db_table_name()
DBUG_RETURN(!same_db_table_name);
}
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
int spider_mbase_share::discover_table_structure(
SPIDER_TRX *trx,
SPIDER_SHARE *spider_share,
@@ -8672,16 +8568,13 @@ int spider_mbase_share::discover_table_structure(
}
DBUG_RETURN(error_num);
}
-#endif
-#ifdef HA_HAS_CHECKSUM_EXTENDED
bool spider_mbase_share::checksum_support()
{
DBUG_ENTER("spider_mbase_share::checksum_support");
DBUG_PRINT("info",("spider this=%p", this));
DBUG_RETURN(TRUE);
}
-#endif
spider_mbase_handler::spider_mbase_handler(
ha_spider *spider,
@@ -8833,10 +8726,8 @@ int spider_mbase_handler::init()
link_for_hash[roop_count].link_idx = roop_count;
link_for_hash[roop_count].db_table_str =
&mysql_share->db_table_str[roop_count];
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
link_for_hash[roop_count].db_table_str_hash_value =
mysql_share->db_table_str_hash_value[roop_count];
-#endif
}
DBUG_RETURN(0);
}
@@ -9136,14 +9027,12 @@ int spider_mbase_handler::append_tmp_table_and_sql_for_bka(
SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (spider->result_list.direct_aggregate)
{
if ((error_num =
append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
-#endif
DBUG_RETURN(0);
}
@@ -9382,14 +9271,12 @@ int spider_mbase_handler::append_union_table_and_sql_for_bka(
)
DBUG_RETURN(error_num);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
else if (spider->result_list.direct_aggregate)
{
if ((error_num =
append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
DBUG_RETURN(error_num);
}
-#endif
DBUG_RETURN(0);
}
@@ -9652,11 +9539,7 @@ int spider_mbase_handler::append_insert(
spider->wide_handler->ignore_dup_key &&
spider->direct_dup_insert &&
!spider->wide_handler->write_can_replace &&
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
(!spider->wide_handler->insert_with_update || !dup_update_sql.length()) &&
-#else
- !spider->wide_handler->insert_with_update &&
-#endif
/* for direct_dup_insert without patch for partition */
spider->wide_handler->sql_command != SQLCOM_REPLACE &&
spider->wide_handler->sql_command != SQLCOM_REPLACE_SELECT
@@ -9813,7 +9696,6 @@ int spider_mbase_handler::append_update_set(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int spider_mbase_handler::append_direct_update_set_part()
{
int error_num;
@@ -9890,7 +9772,6 @@ int spider_mbase_handler::append_update_columns(
alias, alias_length, dbton_id, FALSE, NULL);
DBUG_RETURN(error_num);
}
-#endif
int spider_mbase_handler::append_select_part(
ulong sql_type
@@ -9940,29 +9821,16 @@ int spider_mbase_handler::append_select(
wide_handler->lock_mode < 1)
{
/* no lock */
-#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
LEX *lex = wide_handler->trx->thd->lex;
-#else
- st_select_lex *select_lex =
- &wide_handler->trx->thd->lex->select_lex;
-#endif
if (
-#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
lex->sql_cache == LEX::SQL_CACHE &&
-#else
- select_lex->sql_cache == SELECT_LEX::SQL_CACHE &&
-#endif
(spider->share->query_cache_sync & 1)
) {
if (str->reserve(SPIDER_SQL_SQL_CACHE_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_SQL_CACHE_STR, SPIDER_SQL_SQL_CACHE_LEN);
} else if (
-#ifdef SPIDER_SQL_CACHE_IS_IN_LEX
lex->sql_cache == LEX::SQL_NO_CACHE &&
-#else
- select_lex->sql_cache == SELECT_LEX::SQL_NO_CACHE &&
-#endif
(spider->share->query_cache_sync & 2)
) {
if (str->reserve(SPIDER_SQL_SQL_NO_CACHE_LEN))
@@ -10015,13 +9883,10 @@ int spider_mbase_handler::append_table_select_part(
int spider_mbase_handler::append_table_select(
spider_string *str
) {
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
-#endif
DBUG_ENTER("spider_mbase_handler::append_table_select");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@@ -10060,13 +9925,10 @@ int spider_mbase_handler::append_table_select(
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
} else {
-#endif
table_name_pos = str->length() + mysql_share->table_select_pos;
if (str->append(*(mysql_share->table_select)))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
-#endif
DBUG_RETURN(0);
}
@@ -10094,13 +9956,10 @@ int spider_mbase_handler::append_key_select(
spider_string *str,
uint idx
) {
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
-#endif
DBUG_ENTER("spider_mbase_handler::append_key_select");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@@ -10144,13 +10003,10 @@ int spider_mbase_handler::append_key_select(
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
} else {
-#endif
table_name_pos = str->length() + mysql_share->key_select_pos[idx];
if (str->append(mysql_share->key_select[idx]))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
-#endif
DBUG_RETURN(0);
}
@@ -10181,13 +10037,10 @@ int spider_mbase_handler::append_minimum_select(
Field **field;
int field_length;
bool appended = FALSE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
-#endif
DBUG_ENTER("spider_mbase_handler::append_minimum_select");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@@ -10197,7 +10050,6 @@ int spider_mbase_handler::append_minimum_select(
select_lex = NULL;
}
}
-#endif
minimum_select_bitmap_create();
for (field = table->field; *field; field++)
{
@@ -10208,7 +10060,6 @@ int spider_mbase_handler::append_minimum_select(
*/
field_length =
mysql_share->column_name_str[(*field)->field_index].length();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, *field))
{
@@ -10221,14 +10072,11 @@ int spider_mbase_handler::append_minimum_select(
mysql_share->append_column_name(str, (*field)->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
-#endif
if (str->reserve(field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
mysql_share->append_column_name(str, (*field)->field_index);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
-#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
appended = TRUE;
}
@@ -10251,13 +10099,10 @@ int spider_mbase_handler::append_table_select_with_alias(
TABLE *table = spider->get_table();
Field **field;
int field_length;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
-#endif
DBUG_ENTER("spider_mbase_handler::append_table_select_with_alias");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@@ -10267,12 +10112,10 @@ int spider_mbase_handler::append_table_select_with_alias(
select_lex = NULL;
}
}
-#endif
for (field = table->field; *field; field++)
{
field_length =
mysql_share->column_name_str[(*field)->field_index].length();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, *field))
{
@@ -10286,15 +10129,12 @@ int spider_mbase_handler::append_table_select_with_alias(
mysql_share->append_column_name(str, (*field)->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
-#endif
if (str->reserve(alias_length + field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
mysql_share->append_column_name(str, (*field)->field_index);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
-#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
@@ -10311,13 +10151,10 @@ int spider_mbase_handler::append_key_select_with_alias(
Field *field;
uint part_num;
int field_length;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
-#endif
DBUG_ENTER("spider_mbase_handler::append_key_select_with_alias");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@@ -10327,13 +10164,11 @@ int spider_mbase_handler::append_key_select_with_alias(
select_lex = NULL;
}
}
-#endif
for (key_part = key_info->key_part, part_num = 0;
part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
{
field = key_part->field;
field_length = mysql_share->column_name_str[field->field_index].length();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, field))
{
@@ -10347,15 +10182,12 @@ int spider_mbase_handler::append_key_select_with_alias(
mysql_share->append_column_name(str, field->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
-#endif
if (str->reserve(alias_length + field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
mysql_share->append_column_name(str, field->field_index);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
-#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
}
str->length(str->length() - SPIDER_SQL_COMMA_LEN);
@@ -10371,13 +10203,10 @@ int spider_mbase_handler::append_minimum_select_with_alias(
Field **field;
int field_length;
bool appended = FALSE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
st_select_lex *select_lex = NULL;
bool sgb = (spider->result_list.direct_aggregate &&
spider_param_strict_group_by(current_thd, (strict_group_by ? 1 : 0)) == 1);
-#endif
DBUG_ENTER("spider_mbase_handler::append_minimum_select_with_alias");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (sgb)
{
select_lex = spider_get_select_lex(spider);
@@ -10387,7 +10216,6 @@ int spider_mbase_handler::append_minimum_select_with_alias(
select_lex = NULL;
}
}
-#endif
minimum_select_bitmap_create();
for (field = table->field; *field; field++)
{
@@ -10398,7 +10226,6 @@ int spider_mbase_handler::append_minimum_select_with_alias(
*/
field_length =
mysql_share->column_name_str[(*field)->field_index].length();
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (select_lex &&
!spider_db_check_select_colum_in_group(select_lex, *field))
{
@@ -10412,15 +10239,12 @@ int spider_mbase_handler::append_minimum_select_with_alias(
mysql_share->append_column_name(str, (*field)->field_index);
str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
} else {
-#endif
if (str->reserve(alias_length + field_length +
/* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(alias, alias_length);
mysql_share->append_column_name(str, (*field)->field_index);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
}
-#endif
str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
appended = TRUE;
}
@@ -10443,13 +10267,11 @@ int spider_mbase_handler::append_select_columns_with_alias(
int error_num;
SPIDER_RESULT_LIST *result_list = &spider->result_list;
DBUG_ENTER("spider_mbase_handler::append_select_columns_with_alias");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (
result_list->direct_aggregate &&
(error_num = append_sum_select(str, alias, alias_length))
)
DBUG_RETURN(error_num);
-#endif
if ((error_num = append_match_select(str, alias, alias_length)))
DBUG_RETURN(error_num);
if (!spider->select_column_mode)
@@ -10993,18 +10815,6 @@ int spider_mbase_handler::append_is_null(
key->flag == HA_READ_KEY_EXACT ||
key->flag == HA_READ_KEY_OR_NEXT
) {
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (tgt_final)
- {
- if (str->reserve(SPIDER_SQL_EQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- }
- str = str_part;
- if (str->reserve(SPIDER_SQL_NULL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
if (str->reserve(SPIDER_SQL_EQUAL_LEN))
@@ -11015,29 +10825,7 @@ int spider_mbase_handler::append_is_null(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
}
-#endif
} else {
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
- {
- str = str_part;
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- ha_next_pos = str->length();
- if (str->reserve(SPIDER_SQL_FIRST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN);
- spider->result_list.ha_read_kind = 1;
- } else if (tgt_final)
- {
- if (str->reserve(SPIDER_SQL_GT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN);
- str = str_part;
- if (str->reserve(SPIDER_SQL_NULL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
- }
-#else
if (str_part->length() == SPIDER_SQL_OPEN_PAREN_LEN)
{
str = str_part;
@@ -11049,7 +10837,6 @@ int spider_mbase_handler::append_is_null(
str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN);
spider->result_list.ha_read_kind = 1;
}
-#endif
}
str = str_part2;
}
@@ -11131,9 +10918,6 @@ int spider_mbase_handler::append_where_terminator(
} else {
str_part2->length(str_part2->length() - SPIDER_SQL_AND_LEN);
-#ifdef SPIDER_HANDLER_SUPPORT_MULTIPLE_KEY_PARTS
- str_part->length(str_part->length() - SPIDER_SQL_COMMA_LEN);
-#endif
if (!result_list->ha_read_kind)
str_part->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
SPIDER_SQL_CLOSE_PAREN_LEN);
@@ -11609,7 +11393,6 @@ int spider_mbase_handler::append_match_select(
DBUG_RETURN(0);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_mbase_handler::append_sum_select_part(
ulong sql_type,
const char *alias,
@@ -11656,7 +11439,6 @@ int spider_mbase_handler::append_sum_select(
}
DBUG_RETURN(0);
}
-#endif
void spider_mbase_handler::set_order_pos(
ulong sql_type
@@ -11710,7 +11492,6 @@ void spider_mbase_handler::set_order_to_pos(
DBUG_VOID_RETURN;
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int spider_mbase_handler::append_group_by_part(
const char *alias,
uint alias_length,
@@ -11773,7 +11554,6 @@ int spider_mbase_handler::append_group_by(
}
DBUG_RETURN(0);
}
-#endif
int spider_mbase_handler::append_key_order_for_merge_with_alias_part(
const char *alias,
@@ -11819,14 +11599,12 @@ int spider_mbase_handler::append_key_order_for_merge_with_alias(
uint key_name_length;
DBUG_ENTER("spider_mbase_handler::append_key_order_for_merge_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
int error_num;
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
-#endif
if (table->s->primary_key < MAX_KEY)
{
/* sort by primary key */
@@ -11935,13 +11713,11 @@ int spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias(
longlong offset_limit;
DBUG_ENTER("spider_mbase_handler::append_key_order_for_direct_order_limit_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
-#endif
spider_get_select_limit(spider, &select_lex, &select_limit,
&offset_limit);
if (select_lex->order_list.first)
@@ -12037,14 +11813,12 @@ int spider_mbase_handler::append_key_order_with_alias(
uint key_name_length;
DBUG_ENTER("spider_mbase_handler::append_key_order_with_alias");
DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (spider->result_list.direct_aggregate)
{
int error_num;
if ((error_num = append_group_by(str, alias, alias_length)))
DBUG_RETURN(error_num);
}
-#endif
if (result_list->sorted == TRUE)
{
if (result_list->desc_flg == TRUE)
@@ -13534,11 +13308,7 @@ int spider_mbase_handler::bulk_tmp_table_rnd_next()
int error_num;
DBUG_ENTER("spider_mbase_handler::bulk_tmp_table_rnd_next");
DBUG_PRINT("info",("spider this=%p", this));
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
error_num = upd_tmp_tbl->file->ha_rnd_next(upd_tmp_tbl->record[0]);
-#else
- error_num = upd_tmp_tbl->file->rnd_next(upd_tmp_tbl->record[0]);
-#endif
if (!error_num)
{
error_num = restore_sql_from_bulk_tmp_table(&insert_sql, upd_tmp_tbl);
@@ -13649,15 +13419,8 @@ int spider_mbase_handler::insert_lock_tables_list(
DBUG_PRINT("info",("spider this=%p", this));
uint old_elements =
db_conn->lock_table_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash2->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash2))
-#else
if (my_hash_insert(&db_conn->lock_table_hash,
(uchar*) tmp_link_for_hash2))
-#endif
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -13688,7 +13451,6 @@ int spider_mbase_handler::append_lock_tables_list(
&mysql_share->db_table_str[conn_link_idx];
DBUG_PRINT("info",("spider db_table_str=%s",
tmp_link_for_hash2->db_table_str->c_ptr_safe()));
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
tmp_link_for_hash2->db_table_str_hash_value =
mysql_share->db_table_str_hash_value[conn_link_idx];
if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *)
@@ -13697,12 +13459,6 @@ int spider_mbase_handler::append_lock_tables_list(
tmp_link_for_hash2->db_table_str_hash_value,
(uchar*) tmp_link_for_hash2->db_table_str->ptr(),
tmp_link_for_hash2->db_table_str->length())))
-#else
- if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search(
- &db_conn->lock_table_hash,
- (uchar*) tmp_link_for_hash2->db_table_str->ptr(),
- tmp_link_for_hash2->db_table_str->length())))
-#endif
{
if ((error_num = insert_lock_tables_list(conn, link_idx)))
DBUG_RETURN(error_num);
@@ -13711,26 +13467,12 @@ int spider_mbase_handler::append_lock_tables_list(
if (tmp_link_for_hash->spider->wide_handler->lock_type <
spider->wide_handler->lock_type)
{
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash);
-#else
my_hash_delete(&db_conn->lock_table_hash,
(uchar*) tmp_link_for_hash);
-#endif
uint old_elements =
db_conn->lock_table_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash2->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash2))
-#else
if (my_hash_insert(&db_conn->lock_table_hash,
(uchar*) tmp_link_for_hash2))
-#endif
{
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
@@ -13837,7 +13579,6 @@ bool spider_mbase_handler::need_lock_before_set_sql_for_exec(
DBUG_RETURN(FALSE);
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int spider_mbase_handler::set_sql_for_exec(
ulong sql_type,
int link_idx,
@@ -13855,7 +13596,6 @@ int spider_mbase_handler::set_sql_for_exec(
}
DBUG_RETURN(0);
}
-#endif
int spider_mbase_handler::set_sql_for_exec(
ulong sql_type,
@@ -14821,7 +14561,6 @@ int spider_mbase_handler::simple_action(
DBUG_PRINT("info",("spider simple records"));
str = &mysql_share->show_records[pos];
break;
-#ifdef HA_HAS_CHECKSUM_EXTENDED
case SPIDER_SIMPLE_CHECKSUM_TABLE:
DBUG_PRINT("info",("spider simple checksum_table"));
str = &spider->result_list.sqls[link_idx];
@@ -14851,7 +14590,6 @@ int spider_mbase_handler::simple_action(
SPIDER_SQL_SQL_EXTENDED_LEN);
}
break;
-#endif
default:
DBUG_ASSERT(0);
DBUG_RETURN(0);
@@ -14975,12 +14713,10 @@ int spider_mbase_handler::simple_action(
DBUG_PRINT("info",("spider simple records"));
error_num = res->fetch_table_records(1, spider->table_rows);
break;
-#ifdef HA_HAS_CHECKSUM_EXTENDED
case SPIDER_SIMPLE_CHECKSUM_TABLE:
DBUG_PRINT("info",("spider simple checksum_table"));
error_num = res->fetch_table_checksum(spider);
break;
-#endif
default:
DBUG_ASSERT(0);
break;
@@ -15010,7 +14746,6 @@ int spider_mbase_handler::show_records(
DBUG_RETURN(0);
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int spider_mbase_handler::checksum_table(
int link_idx
) {
@@ -15018,7 +14753,6 @@ int spider_mbase_handler::checksum_table(
DBUG_RETURN(simple_action(SPIDER_SIMPLE_CHECKSUM_TABLE, link_idx));
DBUG_RETURN(0);
}
-#endif
int spider_mbase_handler::show_last_insert_id(
int link_idx,
@@ -15824,11 +15558,7 @@ void spider_mbase_handler::minimum_select_bitmap_create()
memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set));
if (
spider->use_index_merge ||
-#ifdef HA_CAN_BULK_ACCESS
- (spider->is_clone && !spider->is_bulk_access_clone)
-#else
spider->is_clone
-#endif
) {
/* need preparing for cmp_ref */
TABLE_SHARE *table_share = table->s;
@@ -15989,7 +15719,6 @@ int spider_mbase_handler::reset_union_table_name(
DBUG_RETURN(0);
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int spider_mbase_handler::append_from_and_tables_part(
spider_fields *fields,
ulong sql_type
@@ -16312,9 +16041,7 @@ int spider_mbase_handler::append_order_by(
}
DBUG_RETURN(0);
}
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool spider_mbase_handler::check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
@@ -16334,7 +16061,6 @@ bool spider_mbase_handler::check_direct_delete(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_RETURN(FALSE);
}
-#endif
spider_mbase_copy_table::spider_mbase_copy_table(
spider_mbase_share *db_share
diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h
index 8723d51cae7..0d121416653 100644
--- a/storage/spider/spd_db_mysql.h
+++ b/storage/spider/spd_db_mysql.h
@@ -126,7 +126,6 @@ public:
bool use_fields,
spider_fields *fields
) override;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int open_item_sum_func(
Item_sum *item_sum,
ha_spider *spider,
@@ -136,12 +135,10 @@ public:
bool use_fields,
spider_fields *fields
) override;
-#endif
int append_escaped_util(
spider_string *to,
String *from
) override;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int append_table(
ha_spider *spider,
spider_fields *fields,
@@ -194,7 +191,6 @@ public:
int append_having(
spider_string *str
) override;
-#endif
bool tables_on_different_db_are_joinable() override;
bool socket_has_default_value() override;
bool database_has_default_value() override;
@@ -328,11 +324,9 @@ public:
int mode,
ha_rows &records
);
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int fetch_table_checksum(
ha_spider *spider
);
-#endif
int fetch_table_cardinality(
int mode,
TABLE *table,
@@ -356,7 +350,6 @@ public:
longlong pos
);
int get_errno();
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
int fetch_columns_for_discover_table_structure(
spider_string *str,
CHARSET_INFO *access_charset
@@ -370,7 +363,6 @@ public:
SPIDER_SHARE *spider_share,
CHARSET_INFO *access_charset
);
-#endif
};
class spider_db_mysql_result: public spider_db_mbase_result
@@ -634,9 +626,7 @@ public:
spider_string *table_names_str;
spider_string *db_names_str;
spider_string *db_table_str;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type *db_table_str_hash_value;
-#endif
uint table_nm_max_length;
uint db_nm_max_length;
spider_string *column_name_str;
@@ -676,16 +666,12 @@ public:
int *table_name_pos
);
bool need_change_db_table_name();
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
int discover_table_structure(
SPIDER_TRX *trx,
SPIDER_SHARE *spider_share,
spider_string *str
);
-#endif
-#ifdef HA_HAS_CHECKSUM_EXTENDED
bool checksum_support();
-#endif
protected:
int create_table_names_str();
void free_table_names_str();
@@ -872,7 +858,6 @@ public:
int append_update_set(
spider_string *str
);
- #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
int append_direct_update_set_part();
int append_direct_update_set(
spider_string *str
@@ -891,7 +876,6 @@ public:
const char *alias,
uint alias_length
);
- #endif
int append_select_part(
ulong sql_type
);
@@ -1088,7 +1072,6 @@ public:
const char *alias,
uint alias_length
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_sum_select_part(
ulong sql_type,
const char *alias,
@@ -1099,14 +1082,12 @@ public:
const char *alias,
uint alias_length
);
-#endif
void set_order_pos(
ulong sql_type
);
void set_order_to_pos(
ulong sql_type
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
int append_group_by_part(
const char *alias,
uint alias_length,
@@ -1117,7 +1098,6 @@ public:
const char *alias,
uint alias_length
);
-#endif
int append_key_order_for_merge_with_alias_part(
const char *alias,
uint alias_length,
@@ -1401,13 +1381,11 @@ public:
bool need_lock_before_set_sql_for_exec(
ulong sql_type
);
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int set_sql_for_exec(
ulong sql_type,
int link_idx,
SPIDER_LINK_IDX_CHAIN *link_idx_chain
);
-#endif
int set_sql_for_exec(
ulong sql_type,
int link_idx
@@ -1445,11 +1423,9 @@ public:
int show_records(
int link_idx
);
-#ifdef HA_HAS_CHECKSUM_EXTENDED
int checksum_table(
int link_idx
);
-#endif
int show_last_insert_id(
int link_idx,
ulonglong &last_insert_id
@@ -1528,7 +1504,6 @@ public:
int link_idx,
ulong sql_type
);
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
int append_from_and_tables_part(
spider_fields *fields,
ulong sql_type
@@ -1599,8 +1574,6 @@ public:
bool use_fields,
spider_fields *fields
);
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
bool check_direct_update(
st_select_lex *select_lex,
longlong select_limit,
@@ -1611,7 +1584,6 @@ public:
longlong select_limit,
longlong offset_limit
);
-#endif
};
class spider_mysql_handler: public spider_mbase_handler
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
deleted file mode 100644
index 3b0854e609d..00000000000
--- a/storage/spider/spd_db_oracle.cc
+++ /dev/null
@@ -1,13609 +0,0 @@
-/* Copyright (C) 2012-2018 Kentoku Shiba
- Copyright (c) 2020, 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 */
-
-#define MYSQL_SERVER 1
-#include <my_global.h>
-#include "mysql_version.h"
-#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
-#include "sql_priv.h"
-#include "probes_mysql.h"
-#include "sql_partition.h"
-#include "sql_analyse.h"
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
-#include "sql_select.h"
-#endif
-#endif
-
-#ifdef HAVE_ORACLE_OCI
-#if (defined(WIN32) || defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS))
-#include <Shlwapi.h>
-#define strcasestr StrStr
-#endif
-#include <oci.h>
-#include "spd_err.h"
-#include "spd_param.h"
-#include "spd_db_include.h"
-#include "spd_include.h"
-#include "spd_db_oracle.h"
-#include "ha_spider.h"
-#include "spd_conn.h"
-#include "spd_db_conn.h"
-#include "spd_malloc.h"
-#include "spd_sys_table.h"
-#include "spd_table.h"
-
-extern struct charset_info_st *spd_charset_utf8mb3_bin;
-
-extern handlerton *spider_hton_ptr;
-extern pthread_mutex_t spider_open_conn_mutex;
-extern HASH spider_open_connections;
-extern HASH spider_ipport_conns;
-extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
-extern const char spider_dig_upper[];
-
-#define SPIDER_DB_WRAPPER_ORACLE "oracle"
-
-#define SPIDER_SQL_NAME_QUOTE_STR "\""
-#define SPIDER_SQL_NAME_QUOTE_LEN (sizeof(SPIDER_SQL_NAME_QUOTE_STR) - 1)
-static const char *name_quote_str = SPIDER_SQL_NAME_QUOTE_STR;
-
-#define SPIDER_SQL_ISO_READ_COMMITTED_STR "set transaction isolation level read committed"
-#define SPIDER_SQL_ISO_READ_COMMITTED_LEN sizeof(SPIDER_SQL_ISO_READ_COMMITTED_STR) - 1
-#define SPIDER_SQL_ISO_SERIALIZABLE_STR "set transaction isolation level serializable"
-#define SPIDER_SQL_ISO_SERIALIZABLE_LEN sizeof(SPIDER_SQL_ISO_SERIALIZABLE_STR) - 1
-
-#define SPIDER_SQL_START_TRANSACTION_STR "set transaction read write"
-#define SPIDER_SQL_START_TRANSACTION_LEN sizeof(SPIDER_SQL_START_TRANSACTION_STR) - 1
-
-#define SPIDER_SQL_AUTOCOMMIT_OFF_STR "set autocommit off"
-#define SPIDER_SQL_AUTOCOMMIT_OFF_LEN sizeof(SPIDER_SQL_AUTOCOMMIT_OFF_STR) - 1
-#define SPIDER_SQL_AUTOCOMMIT_ON_STR "set autocommit on"
-#define SPIDER_SQL_AUTOCOMMIT_ON_LEN sizeof(SPIDER_SQL_AUTOCOMMIT_ON_STR) - 1
-
-#define SPIDER_SQL_LOCK_TABLE_STR "lock table "
-#define SPIDER_SQL_LOCK_TABLE_LEN (sizeof(SPIDER_SQL_LOCK_TABLE_STR) - 1)
-#define SPIDER_SQL_UNLOCK_TABLE_STR "unlock tables"
-#define SPIDER_SQL_UNLOCK_TABLE_LEN (sizeof(SPIDER_SQL_UNLOCK_TABLE_STR) - 1)
-#define SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR " in share mode"
-#define SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN (sizeof(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR) - 1)
-#define SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR " in exclusive mode"
-#define SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN (sizeof(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR) - 1)
-
-#define SPIDER_SQL_COMMIT_STR "commit"
-#define SPIDER_SQL_COMMIT_LEN sizeof(SPIDER_SQL_COMMIT_STR) - 1
-
-#define SPIDER_SQL_SET_NLS_DATE_FORMAT_STR "alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'"
-#define SPIDER_SQL_SET_NLS_DATE_FORMAT_LEN sizeof(SPIDER_SQL_SET_NLS_DATE_FORMAT_STR) - 1
-#define SPIDER_SQL_SET_NLS_TIME_FORMAT_STR "alter session set nls_time_format='HH24:MI:SSXFF'"
-#define SPIDER_SQL_SET_NLS_TIME_FORMAT_LEN sizeof(SPIDER_SQL_SET_NLS_TIME_FORMAT_STR) - 1
-#define SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_STR "alter session set nls_timestamp_format='YYYY-MM-DD HH24:MI:SSXFF'"
-#define SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_LEN sizeof(SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_STR) - 1
-
-#define SPIDER_SQL_SELECT_WRAPPER_HEAD_STR "select * from ("
-#define SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN sizeof(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR) - 1
-#define SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR " where rowid in (select rowid from (select rowid, row_number() over (order by "
-#define SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN sizeof(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR) - 1
-#define SPIDER_SQL_ROW_NUMBER_HEAD_STR ", row_number() over (order by "
-#define SPIDER_SQL_ROW_NUMBER_HEAD_LEN sizeof(SPIDER_SQL_ROW_NUMBER_HEAD_STR) - 1
-#define SPIDER_SQL_ROW_NUMBER_TAIL_STR "rowid) row_num"
-#define SPIDER_SQL_ROW_NUMBER_TAIL_LEN sizeof(SPIDER_SQL_ROW_NUMBER_TAIL_STR) - 1
-#define SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR "rowid desc) row_num"
-#define SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN sizeof(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR) - 1
-#define SPIDER_SQL_SELECT_WRAPPER_TAIL_STR ") where row_num "
-#define SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN sizeof(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR) - 1
-#define SPIDER_SQL_ROW_NUM_STR "row_num"
-#define SPIDER_SQL_ROW_NUM_LEN sizeof(SPIDER_SQL_ROW_NUM_STR) - 1
-#define SPIDER_SQL_ROWNUM_STR "rownum"
-#define SPIDER_SQL_ROWNUM_LEN sizeof(SPIDER_SQL_ROWNUM_STR) - 1
-#define SPIDER_SQL_NEXTVAL_STR ".nextval"
-#define SPIDER_SQL_NEXTVAL_LEN sizeof(SPIDER_SQL_NEXTVAL_STR) - 1
-#define SPIDER_SQL_CURRVAL_STR ".currval"
-#define SPIDER_SQL_CURRVAL_LEN sizeof(SPIDER_SQL_CURRVAL_STR) - 1
-#define SPIDER_SQL_FROM_DUAL_STR " from dual"
-#define SPIDER_SQL_FROM_DUAL_LEN sizeof(SPIDER_SQL_FROM_DUAL_STR) - 1
-
-#define SPIDER_SQL_SHOW_TABLE_STATUS_STR "show table status from "
-#define SPIDER_SQL_SHOW_TABLE_STATUS_LEN sizeof(SPIDER_SQL_SHOW_TABLE_STATUS_STR) - 1
-#define SPIDER_SQL_SELECT_TABLES_STATUS_STR "select `table_rows`,`avg_row_length`,`data_length`,`max_data_length`,`index_length`,`auto_increment`,`create_time`,`update_time`,`check_time` from `information_schema`.`tables` where `table_schema` = "
-#define SPIDER_SQL_SELECT_TABLES_STATUS_LEN sizeof(SPIDER_SQL_SELECT_TABLES_STATUS_STR) - 1
-
-#define SPIDER_SQL_LIKE_STR " like "
-#define SPIDER_SQL_LIKE_LEN (sizeof(SPIDER_SQL_LIKE_STR) - 1)
-#define SPIDER_SQL_LIMIT1_STR "rownum = 1"
-#define SPIDER_SQL_LIMIT1_LEN (sizeof(SPIDER_SQL_LIMIT1_STR) - 1)
-
-#define SPIDER_SQL_ADD_MONTHS_STR "add_months"
-#define SPIDER_SQL_ADD_MONTHS_LEN (sizeof(SPIDER_SQL_ADD_MONTHS_STR) - 1)
-
-#define SPIDER_ORACLE_ERR_BUF_LEN 512
-
-static uchar SPIDER_SQL_LINESTRING_HEAD_STR[] =
- {0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x02,0x00,0x00,0x00};
-#define SPIDER_SQL_LINESTRING_HEAD_LEN sizeof(SPIDER_SQL_LINESTRING_HEAD_STR)
-
-static const char *spider_db_table_lock_str[] =
-{
- " in share mode",
- " in share mode",
- " in exclusive mode",
- " in exclusive mode"
-};
-static const int spider_db_table_lock_len[] =
-{
- sizeof(" in share mode") - 1,
- sizeof(" in share mode") - 1,
- sizeof(" in exclusive mode") - 1,
- sizeof(" in exclusive mode") - 1
-};
-
-/* UTC time zone for timestamp columns */
-extern Time_zone *UTC;
-
-int spider_db_oracle_get_error(
- sword res,
- dvoid *hndlp,
- int error_num,
- const char *error1,
- const char *error2,
- CHARSET_INFO *access_charset,
- char *stored_error_msg
-) {
- sb4 error_code;
- char buf[SPIDER_ORACLE_ERR_BUF_LEN];
- char buf2[SPIDER_ORACLE_ERR_BUF_LEN];
- spider_string tmp_str(buf2, SPIDER_ORACLE_ERR_BUF_LEN, system_charset_info);
- DBUG_ENTER("spider_db_oracle_get_error");
- tmp_str.init_calc_mem(176);
- tmp_str.length(0);
-
- switch (res)
- {
- case OCI_SUCCESS:
- DBUG_PRINT("info",("spider res=OCI_SUCCESS"));
- break;
- case OCI_SUCCESS_WITH_INFO:
- DBUG_PRINT("info",("spider res=OCI_SUCCESS_WITH_INFO"));
- OCIErrorGet(hndlp, 1, NULL, &error_code, (OraText *) buf, sizeof(buf),
- OCI_HTYPE_ERROR);
- DBUG_PRINT("info",("spider error_code=%d error='%s'",error_code ,buf));
- if (access_charset && access_charset->cset != system_charset_info->cset)
- {
- tmp_str.append(buf, strlen(buf), access_charset);
- } else {
- tmp_str.set(buf, strlen(buf), system_charset_info);
- }
- push_warning_printf(current_thd, SPIDER_WARN_LEVEL_WARN,
- ER_SPIDER_ORACLE_NUM, ER_SPIDER_ORACLE_STR, res, error_code,
- tmp_str.c_ptr_safe());
- break;
- case OCI_NO_DATA:
- DBUG_PRINT("info",("spider res=OCI_NO_DATA"));
- DBUG_RETURN(HA_ERR_END_OF_FILE);
- case OCI_ERROR:
- DBUG_PRINT("info",("spider res=OCI_ERROR"));
- OCIErrorGet(hndlp, 1, NULL, &error_code, (OraText *) buf, sizeof(buf),
- OCI_HTYPE_ERROR);
- DBUG_PRINT("info",("spider error_code=%d error='%s'",error_code ,buf));
- if (error_code == 1)
- {
- DBUG_PRINT("info",("spider found dupp key"));
- if (stored_error_msg)
- strmov(stored_error_msg, buf);
- DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
- }
- if (error_num)
- {
- if (error1)
- {
- if (error2)
- {
- my_printf_error(error_num, error1, MYF(0), error2);
- } else {
- my_printf_error(error_num, error1, MYF(0));
- }
- } else if (error2) {
- my_error(error_num, MYF(0), error2);
- } else {
- my_error(error_num, MYF(0));
- }
- }
- if (access_charset && access_charset->cset != system_charset_info->cset)
- {
- tmp_str.append(buf, strlen(buf), access_charset);
- } else {
- tmp_str.set(buf, strlen(buf), system_charset_info);
- }
- my_printf_error(ER_SPIDER_ORACLE_NUM, ER_SPIDER_ORACLE_STR, MYF(0),
- res, error_code, tmp_str.c_ptr_safe());
- if (error_num)
- {
- DBUG_RETURN(error_num);
- } else {
- DBUG_RETURN(ER_SPIDER_ORACLE_NUM);
- }
- case OCI_INVALID_HANDLE:
- case OCI_NEED_DATA:
- if (res == OCI_INVALID_HANDLE)
- DBUG_PRINT("info",("spider res=OCI_INVALID_HANDLE"));
- else
- DBUG_PRINT("info",("spider res=OCI_NEED_DATA"));
- default:
- DBUG_PRINT("info",("spider res=%d", res));
- if (error_num)
- {
- if (error1)
- {
- if (error2)
- {
- my_printf_error(error_num, error1, MYF(0), error2);
- } else {
- my_printf_error(error_num, error1, MYF(0));
- }
- } else if (error2) {
- my_error(error_num, MYF(0), error2);
- } else {
- my_error(error_num, MYF(0));
- }
- }
- my_printf_error(ER_SPIDER_ORACLE_NUM, ER_SPIDER_ORACLE_STR, MYF(0),
- res, 0, "");
- if (error_num)
- {
- DBUG_RETURN(error_num);
- } else {
- DBUG_RETURN(ER_SPIDER_ORACLE_NUM);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_init()
-{
- DBUG_ENTER("spider_oracle_init");
- DBUG_RETURN(0);
-}
-
-int spider_oracle_deinit()
-{
- DBUG_ENTER("spider_oracle_deinit");
- DBUG_RETURN(0);
-}
-
-spider_db_share *spider_oracle_create_share(
- SPIDER_SHARE *share
-) {
- DBUG_ENTER("spider_oracle_create_share");
- DBUG_RETURN(new spider_oracle_share(share));
-}
-
-spider_db_handler *spider_oracle_create_handler(
- ha_spider *spider,
- spider_db_share *db_share
-) {
- DBUG_ENTER("spider_oracle_create_handler");
- DBUG_RETURN(new spider_oracle_handler(spider,
- (spider_oracle_share *) db_share));
-}
-
-spider_db_copy_table *spider_oracle_create_copy_table(
- spider_db_share *db_share
-) {
- DBUG_ENTER("spider_oracle_create_copy_table");
- DBUG_RETURN(new spider_oracle_copy_table(
- (spider_oracle_share *) db_share));
-}
-
-SPIDER_DB_CONN *spider_oracle_create_conn(
- SPIDER_CONN *conn
-) {
- DBUG_ENTER("spider_oracle_create_conn");
- DBUG_RETURN(new spider_db_oracle(conn));
-}
-
-bool spider_oracle_support_direct_join(
-) {
- DBUG_ENTER("spider_oracle_support_direct_join");
- DBUG_RETURN(FALSE);
-}
-
-spider_db_oracle_util spider_db_oracle_utility;
-
-SPIDER_DBTON spider_dbton_oracle = {
- 0,
- SPIDER_DB_WRAPPER_ORACLE,
- SPIDER_DB_ACCESS_TYPE_SQL,
- spider_oracle_init,
- spider_oracle_deinit,
- spider_oracle_create_share,
- spider_oracle_create_handler,
- spider_oracle_create_copy_table,
- spider_oracle_create_conn,
- spider_oracle_support_direct_join,
- &spider_db_oracle_utility,
- "For communicating Oracle using native protocol",
- "1.0.0",
- SPIDER_MATURITY_BETA
-};
-
-spider_db_oracle_row::spider_db_oracle_row() :
- spider_db_row(spider_dbton_oracle.dbton_id),
- db_conn(NULL), result(NULL),
- ind(NULL), val(NULL), rlen(NULL), ind_first(NULL), val_first(NULL),
- rlen_first(NULL), val_str(NULL), val_str_first(NULL), defnp(NULL),
- lobhp(NULL), colhp(NULL), coltp(NULL), colsz(NULL), field_count(0),
- row_size(NULL), row_size_first(NULL), access_charset(NULL), cloned(FALSE)
-{
- DBUG_ENTER("spider_db_oracle_row::spider_db_oracle_row");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_VOID_RETURN;
-}
-
-spider_db_oracle_row::~spider_db_oracle_row()
-{
- DBUG_ENTER("spider_db_oracle_row::~spider_db_oracle_row");
- DBUG_PRINT("info",("spider this=%p", this));
- deinit();
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle_row::store_to_field(
- Field *field,
- CHARSET_INFO *access_charset
-) {
- DBUG_ENTER("spider_db_oracle_row::store_to_field");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider ind=%d", *ind));
- if (*ind == -1)
- {
- DBUG_PRINT("info", ("spider field is null"));
- field->set_null();
- field->reset();
- } else {
- DBUG_PRINT("info", ("spider field->type()=%u", field->type()));
- field->set_notnull();
- if (field->type() == MYSQL_TYPE_YEAR)
- {
- field->store(val_str->ptr(), 4,
- field->table->s->table_charset);
- } else if (field->type() == MYSQL_TYPE_DATE)
- {
- field->store(val_str->ptr(), 10,
- field->table->s->table_charset);
- } else if (field->type() == MYSQL_TYPE_TIME)
- {
- field->store(val_str->ptr() + 11, 8,
- field->table->s->table_charset);
- } else {
- DBUG_PRINT("info", ("spider val_str->length()=%u", val_str->length()));
- if (field->flags & BLOB_FLAG)
- {
- DBUG_PRINT("info", ("spider blob field"));
- ((Field_blob *)field)->set_ptr(
- val_str->length(), (uchar *) val_str->ptr());
- } else {
- field->store(val_str->ptr(), val_str->length(),
- field->table->s->table_charset);
- }
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_row::append_to_str(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_row::append_to_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(val_str->length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(val_str->ptr(), val_str->length());
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_row::append_escaped_to_str(
- spider_string *str,
- uint dbton_id
-) {
- DBUG_ENTER("spider_db_oracle_row::append_escaped_to_str");
- DBUG_PRINT("info",("spider this=%p", this));
-/*
- spider_string tmp_str(*val, *rlen, str->charset());
- tmp_str.init_calc_mem(174);
- tmp_str.length(*rlen);
-#ifndef DBUG_OFF
- tmp_str.c_ptr_safe();
-#endif
- if (str->reserve(*rlen * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- util.append_escaped(str, tmp_str.get_str());
-*/
- if (str->reserve(val_str->length() * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- spider_dbton[dbton_id].db_util->append_escaped_util(str, val_str->get_str());
- DBUG_RETURN(0);
-}
-
-void spider_db_oracle_row::first()
-{
- DBUG_ENTER("spider_db_oracle_row::first");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider ind_first=%p", ind_first));
- ind = ind_first;
- DBUG_PRINT("info",("spider val_first=%p", val_first));
- val = val_first;
- DBUG_PRINT("info",("spider rlen_first=%p", rlen_first));
- rlen = rlen_first;
- DBUG_PRINT("info",("spider row_size_first=%p", row_size_first));
- row_size = row_size_first;
- DBUG_PRINT("info",("spider val_str_first=%p", val_str_first));
- val_str = val_str_first;
- DBUG_VOID_RETURN;
-}
-
-void spider_db_oracle_row::next()
-{
- DBUG_ENTER("spider_db_oracle_row::next");
- DBUG_PRINT("info",("spider this=%p", this));
- ind++;
- val++;
- rlen++;
- row_size++;
- val_str++;
- DBUG_VOID_RETURN;
-}
-
-bool spider_db_oracle_row::is_null()
-{
- DBUG_ENTER("spider_db_oracle_row::is_null");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN((*ind == -1));
-}
-
-int spider_db_oracle_row::val_int()
-{
- DBUG_ENTER("spider_db_oracle_row::val_int");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN((*ind != -1) ? atoi(*val) : 0);
-}
-
-double spider_db_oracle_row::val_real()
-{
- DBUG_ENTER("spider_db_oracle_row::val_real");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN((*ind != -1) ? my_atof(*val) : 0.0);
-}
-
-my_decimal *spider_db_oracle_row::val_decimal(
- my_decimal *decimal_value,
- CHARSET_INFO *access_charset
-) {
- DBUG_ENTER("spider_db_oracle_row::val_decimal");
- DBUG_PRINT("info",("spider this=%p", this));
- if (*ind == -1)
- DBUG_RETURN(NULL);
-
-#ifdef SPIDER_HAS_DECIMAL_OPERATION_RESULTS_VALUE_TYPE
- decimal_operation_results(str2my_decimal(0, *val, *rlen, access_charset,
- decimal_value), "", "");
-#else
- decimal_operation_results(str2my_decimal(0, *val, *rlen, access_charset,
- decimal_value));
-#endif
-
- DBUG_RETURN(decimal_value);
-}
-
-SPIDER_DB_ROW *spider_db_oracle_row::clone()
-{
- uint i;
- spider_db_oracle_row *clone_row;
- DBUG_ENTER("spider_db_oracle_row::clone");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!(clone_row = new spider_db_oracle_row(dbton_id)))
- {
- DBUG_RETURN(NULL);
- }
- clone_row->db_conn = db_conn;
- clone_row->result = result;
- clone_row->field_count = field_count;
- clone_row->record_size = record_size;
- clone_row->access_charset = access_charset;
- clone_row->cloned = TRUE;
- if (clone_row->init())
- {
- delete clone_row;
- DBUG_RETURN(NULL);
- }
- memcpy(clone_row->ind, ind_first, sizeof(ub2) * field_count * 4 +
- sizeof(ulong) * field_count);
- for (i = 0; i < field_count; i++)
- {
- if (clone_row->val_str[i].copy(val_str_first[i]))
- {
- delete clone_row;
- DBUG_RETURN(NULL);
- }
- }
- DBUG_RETURN((SPIDER_DB_ROW *) clone_row);
-}
-
-int spider_db_oracle_row::store_to_tmp_table(
- TABLE *tmp_table,
- spider_string *str
-) {
- uint i;
- DBUG_ENTER("spider_db_oracle_row::store_to_tmp_table");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- for (i = 0; i < field_count; i++)
- {
- if (row_size_first[i])
- {
- if (str->reserve(val_str_first[i].length()))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(val_str_first[i].ptr(), val_str_first[i].length());
- }
- }
- tmp_table->field[0]->set_notnull();
- tmp_table->field[0]->store(
- (const char *) row_size_first,
- sizeof(ulong) * field_count, &my_charset_bin);
- tmp_table->field[1]->set_notnull();
- tmp_table->field[1]->store(
- str->ptr(), str->length(), &my_charset_bin);
- tmp_table->field[2]->set_notnull();
- tmp_table->field[2]->store(
- (char *) ind_first, (uint) (sizeof(sb2) * field_count), &my_charset_bin);
- DBUG_RETURN(tmp_table->file->ha_write_row(tmp_table->record[0]));
-}
-
-uint spider_db_oracle_row::get_byte_size()
-{
- DBUG_ENTER("spider_db_oracle_row::get_byte_size");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(record_size);
-}
-
-int spider_db_oracle_row::init()
-{
- char *tmp_val;
- uint i;
- DBUG_ENTER("spider_db_oracle_row::init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (
- !(ind = (sb2 *)
- spider_bulk_malloc(spider_current_trx, 161, MYF(MY_WME | MY_ZEROFILL),
- &ind, (uint) (sizeof(sb2) * field_count),
- &rlen, (uint) (sizeof(ub2) * field_count),
- &coltp, (uint) (sizeof(ub2) * field_count),
- &colsz, (uint) (sizeof(ub2) * field_count),
- &row_size, (uint) (sizeof(ulong) * field_count),
- &val, (uint) (sizeof(char *) * field_count),
- &tmp_val, (uint) (MAX_FIELD_WIDTH * field_count),
- &defnp, (uint) (sizeof(OCIDefine *) * field_count),
- &lobhp, (uint) (sizeof(OCILobLocator *) * field_count),
- &colhp, (uint) (sizeof(OCIParam *) * field_count),
- NullS)
- ) ||
- !(val_str = new spider_string[field_count])
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- ind_first = ind;
- val_first = val;
- rlen_first = rlen;
- row_size_first = row_size;
- val_str_first = val_str;
- for (i = 0; i < field_count; i++)
- {
- val[i] = tmp_val;
- val_str[i].init_calc_mem(177);
- val_str[i].set(tmp_val, MAX_FIELD_WIDTH, access_charset);
- tmp_val += MAX_FIELD_WIDTH;
- }
- DBUG_RETURN(0);
-}
-
-void spider_db_oracle_row::deinit()
-{
- uint i;
- DBUG_ENTER("spider_db_oracle_row::deinit");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!cloned)
- {
- for (i = 0; i < field_count; i++)
- {
- if (defnp && defnp[i])
- {
- OCIHandleFree(defnp[i], OCI_HTYPE_DEFINE);
- defnp[i] = NULL;
- }
- if (lobhp && lobhp[i])
- {
- OCIDescriptorFree(lobhp[i], OCI_DTYPE_LOB);
- lobhp[i] = NULL;
- }
- }
- }
- if (val_str_first)
- {
- delete [] val_str_first;
- val_str_first = NULL;
- }
- if (ind_first)
- {
- spider_free(spider_current_trx, ind_first, MYF(0));
- ind_first = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle_row::define()
-{
- sword res;
- uint i;
- DBUG_ENTER("spider_db_oracle_row::define");
- DBUG_PRINT("info",("spider this=%p", this));
- for (i = 0; i < field_count; i++)
- {
- if (coltp[i] == SQLT_BLOB)
- {
- res = OCIDescriptorAlloc(db_conn->envhp, (dvoid **) &lobhp[i],
- OCI_DTYPE_LOB, 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL));
- }
- res = OCIDefineByPos(result->stmtp, &defnp[i], db_conn->errhp, i + 1,
- &lobhp[i], 0, SQLT_BLOB, &ind[i], &rlen[i], NULL,
- OCI_DEFAULT);
- } else if (coltp[i] == SQLT_DAT)
- {
- res = OCIDefineByPos(result->stmtp, &defnp[i], db_conn->errhp, i + 1,
- (char *) val_str[i].ptr() + 20, sizeof(ub1) * 7, SQLT_DAT, &ind[i],
- &rlen[i], NULL, OCI_DEFAULT);
- } else {
- if (val_str[i].alloc(colsz[i]))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- res = OCIDefineByPos(result->stmtp, &defnp[i], db_conn->errhp, i + 1,
- (char *) val_str[i].ptr(), colsz[i], SQLT_CHR, &ind[i], &rlen[i], NULL,
- OCI_DEFAULT);
- }
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL));
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_row::fetch()
-{
- sword res;
- uint i;
- DBUG_ENTER("spider_db_oracle_row::fetch");
- DBUG_PRINT("info",("spider this=%p", this));
- record_size = 0;
- for (i = 0; i < field_count; i++)
- {
- if (ind[i] == -1)
- {
- DBUG_PRINT("info",("spider NULL"));
- val_str[i].length(0);
- } else {
- if (coltp[i] == SQLT_BLOB)
- {
- DBUG_PRINT("info",("spider SQLT_BLOB"));
- oraub8 len;
- res = OCILobGetLength2(db_conn->svchp, db_conn->errhp, lobhp[i], &len);
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL));
- }
-#ifndef DBUG_OFF
- {
- ulonglong print_len = len;
- DBUG_PRINT("info",("spider len=%llu", print_len));
- }
-#endif
- if (val_str[i].alloc(len))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- res = OCILobRead2(db_conn->svchp, db_conn->errhp, lobhp[i], &len,
- NULL, 1, (char *) val_str[i].ptr(), len, OCI_ONE_PIECE, NULL, NULL,
- 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL));
- }
-#ifndef DBUG_OFF
- {
- ulonglong print_len = len;
- DBUG_PRINT("info",("spider lenb=%llu", print_len));
- }
-#endif
- val_str[i].length(len);
- } else if (coltp[i] == SQLT_DAT)
- {
- DBUG_PRINT("info",("spider SQLT_DAT"));
- char *val = (char *) val_str[i].ptr();
- ub1 *src = (ub1 *) val + 20;
- val_str[i].length(19);
- if (src[0] < 100)
- my_sprintf(val, (val, "0000-00-00 00:00:00"));
- else
- my_sprintf(val, (val, "%02u%02u-%02u-%02u %02u:%02u:%02u",
- src[0] - 100, src[1] - 100, src[2], src[3],
- src[4] - 1, src[5] - 1, src[6] - 1));
- } else {
- val_str[i].length(rlen[i]);
- }
- }
- row_size[i] = val_str[i].length();
- record_size += row_size[i];
- }
- DBUG_RETURN(0);
-}
-
-spider_db_oracle_result::spider_db_oracle_result(SPIDER_DB_CONN *in_db_conn) :
- spider_db_result(in_db_conn),
- db_conn(NULL), stmtp(NULL), field_count(0), access_charset(NULL),
- fetched(FALSE), row(in_db_conn->dbton_id)
-{
- DBUG_ENTER("spider_db_oracle_result::spider_db_oracle_result");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_VOID_RETURN;
-}
-
-spider_db_oracle_result::~spider_db_oracle_result()
-{
- DBUG_ENTER("spider_db_oracle_result::~spider_db_oracle_result");
- DBUG_PRINT("info",("spider this=%p", this));
- free_result();
- DBUG_VOID_RETURN;
-}
-
-bool spider_db_oracle_result::has_result()
-{
- DBUG_ENTER("spider_db_oracle_result::has_result");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(stmtp);
-}
-
-void spider_db_oracle_result::free_result()
-{
- DBUG_ENTER("spider_db_oracle_result::free_result");
- DBUG_PRINT("info",("spider this=%p", this));
- if (stmtp)
- {
- OCIHandleFree(stmtp, OCI_HTYPE_STMT);
- stmtp = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-SPIDER_DB_ROW *spider_db_oracle_result::current_row()
-{
- DBUG_ENTER("spider_db_oracle_result::current_row");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN((SPIDER_DB_ROW *) row.clone());
-}
-
-SPIDER_DB_ROW *spider_db_oracle_result::fetch_row()
-{
- sword res;
- DBUG_ENTER("spider_db_oracle_result::fetch_row");
- DBUG_PRINT("info",("spider this=%p", this));
- row.ind = row.ind_first;
- row.val = row.val_first;
- row.rlen = row.rlen_first;
- row.row_size = row.row_size_first;
- row.val_str = row.val_str_first;
- if (fetched)
- {
- /* already fetched */
- fetched = FALSE;
- } else {
- res = OCIStmtFetch2(stmtp, db_conn->errhp, 1, OCI_FETCH_NEXT, 0,
- OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- store_error_num = spider_db_oracle_get_error(res, db_conn->errhp, 0,
- NULL, NULL, access_charset, NULL);
- DBUG_RETURN(NULL);
- }
- }
- if ((store_error_num = row.fetch()))
- {
- DBUG_RETURN(NULL);
- }
- DBUG_RETURN((SPIDER_DB_ROW *) &row);
-}
-
-SPIDER_DB_ROW *spider_db_oracle_result::fetch_row_from_result_buffer(
- spider_db_result_buffer *spider_res_buf
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle_result::fetch_row_from_result_buffer");
- DBUG_PRINT("info",("spider this=%p", this));
- row.ind = row.ind_first;
- row.val = row.val_first;
- row.rlen = row.rlen_first;
- row.row_size = row.row_size_first;
- row.val_str = row.val_str_first;
- if (fetched)
- {
- /* already fetched */
- fetched = FALSE;
- } else {
- res = OCIStmtFetch2(stmtp, db_conn->errhp, 1, OCI_FETCH_NEXT, 0,
- OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- store_error_num = spider_db_oracle_get_error(res, db_conn->errhp, 0,
- NULL, NULL, access_charset, NULL);
- DBUG_RETURN(NULL);
- }
- }
- if ((store_error_num = row.fetch()))
- {
- DBUG_RETURN(NULL);
- }
- DBUG_RETURN((SPIDER_DB_ROW *) &row);
-}
-
-SPIDER_DB_ROW *spider_db_oracle_result::fetch_row_from_tmp_table(
- TABLE *tmp_table
-) {
- uint i;
- const char *str;
- spider_string tmp_str1, tmp_str2, tmp_str3;
- DBUG_ENTER("spider_db_oracle_result::fetch_row_from_tmp_table");
- DBUG_PRINT("info",("spider this=%p", this));
- tmp_str1.init_calc_mem(175);
- tmp_str2.init_calc_mem(178);
- tmp_str3.init_calc_mem(179);
- tmp_table->field[0]->val_str(tmp_str1.get_str());
- tmp_table->field[1]->val_str(tmp_str2.get_str());
- tmp_table->field[2]->val_str(tmp_str3.get_str());
- tmp_str1.mem_calc();
- tmp_str2.mem_calc();
- tmp_str3.mem_calc();
- row.ind = row.ind_first;
- row.val = row.val_first;
- row.rlen = row.rlen_first;
- row.row_size = row.row_size_first;
- row.val_str = row.val_str_first;
- DBUG_PRINT("info",("spider tmp_str1.length()=%u", tmp_str1.length()));
- DBUG_PRINT("info",("spider tmp_str2.length()=%u", tmp_str2.length()));
- DBUG_PRINT("info",("spider tmp_str3.length()=%u", tmp_str3.length()));
- memcpy(row.ind, tmp_str3.ptr(), tmp_str3.length());
- memcpy(row.row_size, tmp_str1.ptr(), tmp_str1.length());
- row.field_count = tmp_str1.length() / sizeof(ulong);
- str = tmp_str2.ptr();
- for (i = 0; i < row.field_count; i++)
- {
- row.val_str[i].length(0);
- if (row.row_size[i])
- {
- if (row.val_str[i].reserve(row.row_size[i]))
- {
- store_error_num = HA_ERR_OUT_OF_MEM;
- DBUG_RETURN(NULL);
- }
- row.val_str[i].q_append(str, row.row_size[i]);
- str += row.row_size[i];
- }
- }
- row.record_size = tmp_str2.length();
- DBUG_RETURN((SPIDER_DB_ROW *) &row);
-}
-
-int spider_db_oracle_result::fetch_table_status(
- int mode,
- ha_statistics &stat
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_table_status");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- stat.records = 2;
- stat.mean_rec_length = 65535;
- stat.data_file_length = 65535;
- stat.max_data_file_length = 65535;
- stat.index_file_length = 65535;
-/*
- auto_increment_value = 0;
-*/
- stat.create_time = (time_t) 0;
- stat.update_time = (time_t) 0;
- stat.check_time = (time_t) 0;
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_result::fetch_table_records(
- int mode,
- ha_rows &records
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_table_records");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!fetch_row())
- {
- records = 0;
- } else {
- records = row.val_int();
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_result::fetch_table_cardinality(
- int mode,
- TABLE *table,
- longlong *cardinality,
- uchar *cardinality_upd,
- int bitmap_size
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_table_cardinality");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_result::fetch_table_mon_status(
- int &status
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_table_mon_status");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- status = SPIDER_LINK_MON_OK;
- DBUG_RETURN(0);
-}
-
-longlong spider_db_oracle_result::num_rows()
-{
- sword res;
- ub4 rowcnt;
- DBUG_ENTER("spider_db_oracle_result::num_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- res = OCIAttrGet(stmtp, OCI_HTYPE_STMT, &rowcnt, 0,
- OCI_ATTR_ROW_COUNT, db_conn->errhp);
- if (res != OCI_SUCCESS)
- {
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL);
- DBUG_RETURN(0);
- }
- DBUG_PRINT("info",("spider rowcnt=%u", rowcnt));
- DBUG_RETURN((longlong) rowcnt);
-}
-
-uint spider_db_oracle_result::num_fields()
-{
- sword res;
- ub4 parmcnt;
- DBUG_ENTER("spider_db_oracle_result::num_fields");
- DBUG_PRINT("info",("spider this=%p", this));
- res = OCIAttrGet(stmtp, OCI_HTYPE_STMT, &parmcnt, 0,
- OCI_ATTR_PARAM_COUNT, db_conn->errhp);
- if (res != OCI_SUCCESS)
- {
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL);
- DBUG_RETURN(0);
- }
- DBUG_RETURN((uint) parmcnt);
-}
-
-void spider_db_oracle_result::move_to_pos(
- longlong pos
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle_result::move_to_pos");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider pos=%lld", pos));
- res = OCIStmtFetch2(stmtp, db_conn->errhp, 1, OCI_FETCH_ABSOLUTE, pos,
- OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL, NULL,
- access_charset, NULL);
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle_result::set_column_info()
-{
- sword res;
- uint i;
- DBUG_ENTER("spider_db_oracle_result::set_column_info");
- DBUG_PRINT("info",("spider this=%p", this));
- for (i = 0; i < field_count; i++)
- {
- res = OCIParamGet(stmtp, OCI_HTYPE_STMT, db_conn->errhp,
- (dvoid **) &row.colhp[i], i + 1);
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL,
- NULL, access_charset, NULL));
- }
- res = OCIAttrGet(row.colhp[i], OCI_DTYPE_PARAM, &row.coltp[i], NULL,
- OCI_ATTR_DATA_TYPE, db_conn->errhp);
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL,
- NULL, access_charset, NULL));
- }
- res = OCIAttrGet(row.colhp[i], OCI_DTYPE_PARAM, &row.colsz[i], NULL,
- OCI_ATTR_DATA_SIZE, db_conn->errhp);
- if (res != OCI_SUCCESS)
- {
- DBUG_RETURN(spider_db_oracle_get_error(res, db_conn->errhp, 0, NULL,
- NULL, access_charset, NULL));
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_result::get_errno()
-{
- DBUG_ENTER("spider_db_oracle_result::get_errno");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider store_error_num=%d", store_error_num));
- DBUG_RETURN(store_error_num);
-}
-
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
-int spider_db_oracle_result::fetch_columns_for_discover_table_structure(
- spider_string *str,
- CHARSET_INFO *access_charset
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_columns_for_discover_table_structure");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-}
-
-int spider_db_oracle_result::fetch_index_for_discover_table_structure(
- spider_string *str,
- CHARSET_INFO *access_charset
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_index_for_discover_table_structure");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-}
-
-int spider_db_oracle_result::fetch_table_for_discover_table_structure(
- spider_string *str,
- SPIDER_SHARE *spider_share,
- CHARSET_INFO *access_charset
-) {
- DBUG_ENTER("spider_db_oracle_result::fetch_table_for_discover_table_structure");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-}
-#endif
-
-spider_db_oracle::spider_db_oracle(
- SPIDER_CONN *conn
-) : spider_db_conn(conn), envhp(NULL), errhp(NULL), srvhp(NULL), svchp(NULL),
- usrhp(NULL), stmtp(NULL), txnhp(NULL), result(NULL), table_lock_mode(0),
- lock_table_hash_inited(FALSE), handler_open_array_inited(FALSE)
-{
- DBUG_ENTER("spider_db_oracle::spider_db_oracle");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_VOID_RETURN;
-}
-
-spider_db_oracle::~spider_db_oracle()
-{
- DBUG_ENTER("spider_db_oracle::~spider_db_oracle");
- DBUG_PRINT("info",("spider this=%p", this));
- if (handler_open_array_inited)
- {
- reset_opened_handler();
- spider_free_mem_calc(spider_current_trx,
- handler_open_array_id,
- handler_open_array.max_element *
- handler_open_array.size_of_element);
- delete_dynamic(&handler_open_array);
- }
- if (lock_table_hash_inited)
- {
- spider_free_mem_calc(spider_current_trx,
- lock_table_hash_id,
- lock_table_hash.array.max_element *
- lock_table_hash.array.size_of_element);
- my_hash_free(&lock_table_hash);
- }
- disconnect();
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle::init()
-{
- DBUG_ENTER("spider_db_oracle::init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (
- my_hash_init(&lock_table_hash, spd_charset_utf8mb3_bin, 32, 0, 0,
- (my_hash_get_key) spider_link_get_key, 0, 0)
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- spider_alloc_calc_mem_init(lock_table_hash, 199);
- spider_alloc_calc_mem(spider_current_trx,
- lock_table_hash,
- lock_table_hash.array.max_element *
- lock_table_hash.array.size_of_element);
- lock_table_hash_inited = TRUE;
-
- if (
- SPD_INIT_DYNAMIC_ARRAY2(&handler_open_array,
- sizeof(SPIDER_LINK_FOR_HASH *), NULL, 16, 16, MYF(MY_WME))
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- spider_alloc_calc_mem_init(handler_open_array, 164);
- spider_alloc_calc_mem(spider_current_trx,
- handler_open_array,
- handler_open_array.max_element *
- handler_open_array.size_of_element);
- handler_open_array_inited = TRUE;
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::is_connected()
-{
- DBUG_ENTER("spider_db_oracle::is_connected");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(svchp);
-}
-
-void spider_db_oracle::bg_connect()
-{
- sword res;
- DBUG_ENTER("spider_db_oracle::bg_connect");
- DBUG_PRINT("info",("spider this=%p", this));
- res = OCIEnvNlsCreate(&envhp, OCI_DEFAULT, 0, 0, 0, 0, 0, 0, 0, 0);
-/*
- res = OCIEnvCreate(&envhp, OCI_THREADED, 0, 0, 0, 0, 0, 0);
-*/
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider create environment error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- goto error;
- }
- DBUG_PRINT("info",("spider OCI init envhp=%p", envhp));
-
- res = OCIHandleAlloc(envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR, 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider create error handler error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
- DBUG_PRINT("info",("spider OCI init errhp=%p", errhp));
-
- res = OCIHandleAlloc(envhp, (dvoid **) &srvhp, OCI_HTYPE_SERVER, 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider create server handler error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
- DBUG_PRINT("info",("spider OCI init srvhp=%p", srvhp));
-
- res = OCIServerAttach(srvhp, errhp, (OraText *) tgt_host, strlen(tgt_host),
- OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider attach server error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
-
- res = OCIHandleAlloc(envhp, (dvoid **) &svchp, OCI_HTYPE_SVCCTX, 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider create service context error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
- DBUG_PRINT("info",("spider OCI init svchp=%p", svchp));
-
- res = OCIAttrSet(svchp, OCI_HTYPE_SVCCTX, srvhp, 0, OCI_ATTR_SERVER, errhp);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider set server attr error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
-
- res = OCIHandleAlloc(envhp, (dvoid **) &usrhp, OCI_HTYPE_SESSION, 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider create session handler error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
- DBUG_PRINT("info",("spider OCI init usrhp=%p", usrhp));
-
- res = OCIAttrSet(usrhp, OCI_HTYPE_SESSION,
- tgt_username, strlen(tgt_username), OCI_ATTR_USERNAME, errhp);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider set username attr error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
-
- res = OCIAttrSet(usrhp, OCI_HTYPE_SESSION,
- tgt_password, strlen(tgt_password), OCI_ATTR_PASSWORD, errhp);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider set password attr error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
-
- res = OCISessionBegin(svchp, errhp, usrhp, OCI_CRED_RDBMS, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider session begin error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
- DBUG_PRINT("info",("spider OCISessionBegin"));
-
- // set the session in the context handle
- res = OCIAttrSet(svchp, OCI_HTYPE_SVCCTX, usrhp, 0, OCI_ATTR_SESSION, errhp);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider set session attr error"));
- stored_error_num = set_error(res, errhp, 0, NULL, NULL);
- bg_disconnect();
- goto error;
- }
-
- if (
- (stored_error_num = exec_query(SPIDER_SQL_SET_NLS_DATE_FORMAT_STR,
- SPIDER_SQL_SET_NLS_DATE_FORMAT_LEN, -1)) ||
- (stored_error_num = exec_query(SPIDER_SQL_SET_NLS_TIME_FORMAT_STR,
- SPIDER_SQL_SET_NLS_TIME_FORMAT_LEN, -1)) ||
- (stored_error_num = exec_query(SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_STR,
- SPIDER_SQL_SET_NLS_TIMESTAMP_FORMAT_LEN, -1))
- ) {
- DBUG_PRINT("info",("spider init connection error"));
- bg_disconnect();
- goto error;
- }
- DBUG_VOID_RETURN;
-
-error:
- strmov(stored_error_msg, spider_stmt_da_message(current_thd));
- current_thd->clear_error();
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle::connect(
- char *tgt_host,
- char *tgt_username,
- char *tgt_password,
- long tgt_port,
- char *tgt_socket,
- char *server_name,
- int connect_retry_count,
- longlong connect_retry_interval
-) {
- int error_num;
- DBUG_ENTER("spider_db_oracle::connect");
- DBUG_PRINT("info",("spider this=%p", this));
- this->tgt_host = tgt_host;
- this->tgt_username = tgt_username;
- this->tgt_password = tgt_password;
- this->tgt_port = tgt_port;
- this->tgt_socket = tgt_socket;
- this->server_name = server_name;
- this->connect_retry_count = connect_retry_count;
- this->connect_retry_interval = connect_retry_interval;
- if ((error_num = spider_create_conn_thread(conn)))
- DBUG_RETURN(error_num);
- spider_bg_conn_simple_action(conn, SPIDER_SIMPLE_CONNECT, TRUE, NULL,
- 0, NULL);
-
- if (stored_error_num)
- {
- my_message(stored_error_num, stored_error_msg, MYF(0));
- DBUG_RETURN(stored_error_num);
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::ping(
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::ping");
- DBUG_PRINT("info",("spider this=%p", this));
- res = OCIPing(svchp, errhp, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider ping error %d", res));
- DBUG_RETURN(ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM);
- }
- DBUG_RETURN(0);
-}
-
-void spider_db_oracle::bg_disconnect()
-{
- DBUG_ENTER("spider_db_oracle::bg_disconnect");
- DBUG_PRINT("info",("spider this=%p", this));
- if (result)
- {
- delete result;
- result = NULL;
- }
- if (txnhp)
- {
- DBUG_PRINT("info",("spider OCI free txnhp=%p", txnhp));
- OCIHandleFree(txnhp, OCI_HTYPE_TRANS);
- txnhp = NULL;
- }
- if (stmtp)
- {
- DBUG_PRINT("info",("spider OCI free stmtp=%p", stmtp));
- OCIHandleFree(stmtp, OCI_HTYPE_STMT);
- stmtp = NULL;
- }
- if (svchp && errhp && usrhp)
- {
- DBUG_PRINT("info",("spider OCISessionEnd"));
- OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT);
- }
- if (usrhp)
- {
- DBUG_PRINT("info",("spider OCI free usrhp=%p", usrhp));
- OCIHandleFree(usrhp, OCI_HTYPE_SESSION);
- usrhp = NULL;
- }
- if (svchp)
- {
- DBUG_PRINT("info",("spider OCI free svchp=%p", svchp));
- OCIHandleFree(svchp, OCI_HTYPE_SVCCTX);
- svchp = NULL;
- }
- if (srvhp)
- {
- DBUG_PRINT("info",("spider OCI free srvhp=%p", srvhp));
- OCIServerDetach(srvhp, errhp, OCI_DEFAULT);
- OCIHandleFree(srvhp, OCI_HTYPE_SERVER);
- srvhp = NULL;
- }
- if (errhp)
- {
- DBUG_PRINT("info",("spider OCI free errhp=%p", errhp));
- OCIHandleFree(errhp, OCI_HTYPE_ERROR);
- errhp = NULL;
- }
- if (envhp)
- {
- DBUG_PRINT("info",("spider OCI free envhp=%p", envhp));
- OCIHandleFree(envhp, OCI_HTYPE_ENV);
- envhp = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-void spider_db_oracle::disconnect()
-{
- DBUG_ENTER("spider_db_oracle::disconnect");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!conn->bg_init)
- DBUG_VOID_RETURN;
- spider_bg_conn_simple_action(conn, SPIDER_SIMPLE_DISCONNECT, TRUE, NULL,
- 0, NULL);
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle::set_net_timeout()
-{
- DBUG_ENTER("spider_db_oracle::set_net_timeout");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::exec_query(
- const char *query,
- uint length,
- int quick_mode
-) {
- sword res;
- int error_num;
- DBUG_ENTER("spider_db_oracle::exec_query");
- DBUG_PRINT("info",("spider this=%p", this));
- if (spider_param_general_log())
- {
- const char *tgt_str = conn->tgt_host;
- uint32 tgt_len = conn->tgt_host_length;
- spider_string tmp_query_str(length + conn->tgt_wrapper_length +
- tgt_len + (SPIDER_SQL_SPACE_LEN * 2));
- tmp_query_str.init_calc_mem(232);
- tmp_query_str.length(0);
- tmp_query_str.q_append(conn->tgt_wrapper, conn->tgt_wrapper_length);
- tmp_query_str.q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- tmp_query_str.q_append(tgt_str, tgt_len);
- tmp_query_str.q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- tmp_query_str.q_append(query, length);
- general_log_write(current_thd, COM_QUERY, tmp_query_str.ptr(),
- tmp_query_str.length());
- }
- stored_error_num = 0;
- if (table_lock_mode && !conn->in_before_query)
- {
- DBUG_PRINT("info",("spider table_lock_mode=%d", table_lock_mode));
- table_lock_mode = 0;
- if ((error_num = exec_query(exec_lock_sql->ptr(), exec_lock_sql->length(),
- -1))) {
- DBUG_RETURN(error_num);
- }
- }
-
- if (length)
- {
- if (result)
- {
- delete result;
- result = NULL;
- }
-
- if (!stmtp)
- {
- DBUG_PRINT("info",("spider create stmt"));
- res = OCIHandleAlloc(envhp, (dvoid **) &stmtp, OCI_HTYPE_STMT, 0, 0);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider create stmt handler error"));
- DBUG_RETURN(set_error(res, errhp, 0, NULL, NULL));
- }
- }
-
- res = OCIStmtPrepare(stmtp, errhp, (OraText *) query, length,
- OCI_NTV_SYNTAX, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider stmt prepare error"));
- DBUG_RETURN(set_error(res, errhp, 0, NULL, NULL));
- }
-
-/*
- if ((result = new spider_db_oracle_result()))
- {
- result->db_conn = this;
- result->stmtp = stmtp;
- stmtp = NULL;
- result->field_count = result->num_fields();
- result->row.field_count = result->field_count;
- result->row.db_conn = this;
- result->row.result = result;
- if ((error_num = result->row.init()))
- {
- delete result;
- result = NULL;
- DBUG_RETURN(error_num);
- }
- } else {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-*/
-
- /* select statement check */
- ub4 iters;
- if (
- !strncasecmp(query, "select ", sizeof("select ") - 1) ||
- !strncasecmp(query, "(select ", sizeof("(select ") - 1)
- ) {
- iters = 0;
- } else {
- iters = 1;
- }
-
- if (quick_mode)
- {
- DBUG_PRINT("info",("spider use OCI_DEFAULT"));
- res = OCIStmtExecute(svchp, stmtp, errhp, iters, 0, NULL, NULL,
- OCI_DEFAULT);
- } else {
- DBUG_PRINT("info",("spider use OCI_STMT_SCROLLABLE_READONLY"));
- res = OCIStmtExecute(svchp, stmtp, errhp, iters, 0, NULL, NULL,
- OCI_STMT_SCROLLABLE_READONLY);
-/*
- if (res == OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider fetch last for row count"));
- res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_LAST, 0,
- OCI_DEFAULT);
- }
- if (res == OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider fetch first for row count"));
- res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_FIRST, 0,
- OCI_DEFAULT);
- }
-*/
- }
- if (res == OCI_SUCCESS && iters)
- {
- DBUG_PRINT("info",("spider get row count"));
- ub4 row_count;
- res = OCIAttrGet(stmtp, OCI_HTYPE_STMT, &row_count, 0,
- OCI_ATTR_ROW_COUNT, errhp);
- update_rows = (uint) row_count;
- DBUG_PRINT("info",("spider row_count=%u", update_rows));
- }
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider stmt execute error"));
- error_num = set_error(res, errhp, 0, NULL, NULL);
- if (error_num == HA_ERR_END_OF_FILE)
- DBUG_RETURN(0);
- DBUG_RETURN(error_num);
- }
-
- if ((result = new spider_db_oracle_result(this)))
- {
- result->db_conn = this;
- result->stmtp = stmtp;
- stmtp = NULL;
- result->field_count = result->num_fields();
- result->row.field_count = result->field_count;
- result->row.db_conn = this;
- result->row.result = result;
- result->row.access_charset = conn->access_charset;
- result->access_charset = conn->access_charset;
- if (
- (error_num = result->row.init()) ||
- (error_num = result->set_column_info())
- ) {
- delete result;
- result = NULL;
- DBUG_RETURN(error_num);
- }
- result->row.define();
- } else {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-
- if (!quick_mode && !iters)
- {
- if (res == OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider fetch last for row count"));
- res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_LAST, 0,
- OCI_DEFAULT);
- }
- if (res == OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider fetch first for row count"));
- res = OCIStmtFetch2(result->stmtp, errhp, 1, OCI_FETCH_FIRST, 0,
- OCI_DEFAULT);
- }
- if (res != OCI_SUCCESS)
- {
- DBUG_PRINT("info",("spider stmt execute error"));
- error_num = set_error(res, errhp, 0, NULL, NULL);
- if (error_num == HA_ERR_END_OF_FILE)
- DBUG_RETURN(0);
- DBUG_RETURN(error_num);
- }
- result->fetched = TRUE;
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::get_errno()
-{
- DBUG_ENTER("spider_db_oracle::get_errno");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider stored_error=%d", stored_error_num));
- DBUG_RETURN(stored_error_num);
-}
-
-const char *spider_db_oracle::get_error()
-{
- DBUG_ENTER("spider_db_oracle::get_error");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider error=%s", stored_error));
- DBUG_RETURN(stored_error);
-}
-
-bool spider_db_oracle::is_server_gone_error(
- int error_num
-) {
- DBUG_ENTER("spider_db_oracle::is_server_gone_error");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- DBUG_RETURN(FALSE);
-}
-
-bool spider_db_oracle::is_dup_entry_error(
- int error_num
-) {
- DBUG_ENTER("spider_db_oracle::is_dup_entry_error");
- DBUG_PRINT("info",("spider this=%p", this));
- if (error_num == HA_ERR_FOUND_DUPP_KEY)
- DBUG_RETURN(TRUE);
- DBUG_RETURN(FALSE);
-}
-
-bool spider_db_oracle::is_xa_nota_error(
- int error_num
-) {
- DBUG_ENTER("spider_db_oracle::is_xa_nota_error");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- DBUG_RETURN(FALSE);
-}
-
-spider_db_result *spider_db_oracle::store_result(
- spider_db_result_buffer **spider_res_buf,
- st_spider_db_request_key *request_key,
- int *error_num
-) {
- spider_db_oracle_result *tmp_result = result;
- DBUG_ENTER("spider_db_oracle::store_result");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_ASSERT(!spider_res_buf);
- if (stored_error_num == HA_ERR_END_OF_FILE)
- {
- *error_num = HA_ERR_END_OF_FILE;
- DBUG_RETURN(NULL);
- }
-
- *error_num = 0;
- result = NULL;
- DBUG_RETURN(tmp_result);
-}
-
-spider_db_result *spider_db_oracle::use_result(
- ha_spider *spider,
- st_spider_db_request_key *request_key,
- int *error_num
-) {
- spider_db_oracle_result *tmp_result = result;
- DBUG_ENTER("spider_db_oracle::use_result");
- DBUG_PRINT("info",("spider this=%p", this));
- if (stored_error_num == HA_ERR_END_OF_FILE)
- {
- *error_num = HA_ERR_END_OF_FILE;
- DBUG_RETURN(NULL);
- }
-
- *error_num = 0;
- result = NULL;
- DBUG_RETURN(tmp_result);
-}
-
-int spider_db_oracle::next_result()
-{
- DBUG_ENTER("spider_db_oracle::next_result");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- DBUG_RETURN(-1);
-}
-
-uint spider_db_oracle::affected_rows()
-{
- DBUG_ENTER("spider_db_oracle::affected_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(update_rows);
-}
-
-uint spider_db_oracle::matched_rows()
-{
- DBUG_ENTER("spider_db_oracle::matched_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::inserted_info(
- spider_db_handler *handler,
- ha_copy_info *copy_info
-) {
- DBUG_ENTER("spider_db_oracle::inserted_info");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-ulonglong spider_db_oracle::last_insert_id()
-{
- DBUG_ENTER("spider_db_oracle::last_insert_id");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(stored_last_insert_id);
-}
-
-int spider_db_oracle::set_character_set(
- const char *csname
-) {
- DBUG_ENTER("spider_db_oracle::set_character_set");
- DBUG_PRINT("info",("spider this=%p", this));
- /* TODO: develop later */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::select_db(
- const char *dbname
-) {
- DBUG_ENTER("spider_db_oracle::select_db");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do for oracle */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::consistent_snapshot(
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::consistent_snapshot");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do for oracle */
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::trx_start_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::trx_start_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::start_transaction(
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::start_transaction");
- DBUG_PRINT("info",("spider this=%p", this));
- if (conn->in_before_query)
- {
- if (conn->queued_semi_trx_isolation)
- {
- if (conn->queued_semi_trx_isolation_val != conn->trx_isolation)
- {
- /* nothing to do */
- DBUG_RETURN(0);
- }
- } else if (conn->queued_trx_isolation)
- {
- if (conn->queued_trx_isolation_val != conn->trx_isolation)
- {
- /* nothing to do */
- DBUG_RETURN(0);
- }
- }
- DBUG_RETURN(set_trx_isolation(conn->trx_isolation, need_mon));
- }
- pthread_mutex_assert_owner(&conn->mta_conn_mutex);
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- if (spider_db_query(
- conn,
- SPIDER_SQL_START_TRANSACTION_STR,
- SPIDER_SQL_START_TRANSACTION_LEN,
- -1,
- need_mon)
- ) {
- DBUG_RETURN(spider_db_errorno(conn));
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::commit(
- int *need_mon
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::commit");
- DBUG_PRINT("info",("spider this=%p", this));
- if (conn->table_locked)
- {
- conn->table_locked = FALSE;
- spider_current_trx->locked_connections--;
- }
- res = OCITransCommit(svchp, errhp, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- *need_mon = set_error(res, errhp, 0, NULL, NULL);
- DBUG_RETURN(*need_mon);
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::rollback(
- int *need_mon
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::rollback");
- DBUG_PRINT("info",("spider this=%p", this));
- if (conn->table_locked)
- {
- conn->table_locked = FALSE;
- spider_current_trx->locked_connections--;
- }
- if (svchp && errhp)
- {
- res = OCITransRollback(svchp, errhp, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- *need_mon = set_error(res, errhp, 0, NULL, NULL);
- DBUG_RETURN(*need_mon);
- }
- }
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::xa_start_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::xa_start_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::xa_start(
- XID *xid,
- int *need_mon
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::xa_start");
- DBUG_PRINT("info",("spider this=%p", this));
- if (txnhp)
- {
- OCIHandleFree(txnhp, OCI_HTYPE_TRANS);
- txnhp = NULL;
- }
- OCIHandleAlloc((dvoid *)envhp, (dvoid **)&txnhp, OCI_HTYPE_TRANS, 0, 0);
- OCIAttrSet((dvoid *)svchp, OCI_HTYPE_SVCCTX, (dvoid *)txnhp, 0,
- OCI_ATTR_TRANS, errhp);
- OCIAttrSet((dvoid *)txnhp, OCI_HTYPE_TRANS, (dvoid *)xid, sizeof(XID),
- OCI_ATTR_XID, errhp);
-
- res = OCITransStart(svchp, errhp, 31622400, OCI_TRANS_NEW);
- if (res != OCI_SUCCESS)
- {
- *need_mon = set_error(res, errhp, 0, NULL, NULL);
- DBUG_RETURN(*need_mon);
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::xa_end(
- XID *xid,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::xa_end");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do for oracle */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::xa_prepare(
- XID *xid,
- int *need_mon
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::xa_prepare");
- DBUG_PRINT("info",("spider this=%p", this));
- res = OCITransPrepare(svchp, errhp, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- *need_mon = set_error(res, errhp, 0, NULL, NULL);
- DBUG_RETURN(*need_mon);
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::xa_commit(
- XID *xid,
- int *need_mon
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::xa_commit");
- DBUG_PRINT("info",("spider this=%p", this));
- if (conn->table_locked)
- {
- conn->table_locked = FALSE;
- spider_current_trx->locked_connections--;
- }
- res = OCITransCommit(svchp, errhp, OCI_TRANS_TWOPHASE);
- if (res != OCI_SUCCESS)
- {
- *need_mon = set_error(res, errhp, 0, NULL, NULL);
- if (txnhp)
- {
- OCIHandleFree(txnhp, OCI_HTYPE_TRANS);
- txnhp = NULL;
- }
- DBUG_RETURN(*need_mon);
- }
- if (txnhp)
- {
- OCIHandleFree(txnhp, OCI_HTYPE_TRANS);
- txnhp = NULL;
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::xa_rollback(
- XID *xid,
- int *need_mon
-) {
- sword res;
- DBUG_ENTER("spider_db_oracle::xa_rollback");
- DBUG_PRINT("info",("spider this=%p", this));
- if (svchp && errhp)
- {
- res = OCITransRollback(svchp, errhp, OCI_DEFAULT);
- if (res != OCI_SUCCESS)
- {
- *need_mon = set_error(res, errhp, 0, NULL, NULL);
- if (txnhp)
- {
- OCIHandleFree(txnhp, OCI_HTYPE_TRANS);
- txnhp = NULL;
- }
- DBUG_RETURN(*need_mon);
- }
- }
- if (txnhp)
- {
- OCIHandleFree(txnhp, OCI_HTYPE_TRANS);
- txnhp = NULL;
- }
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::set_trx_isolation_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::set_trx_isolation_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::set_trx_isolation(
- int trx_isolation,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::set_trx_isolation");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (trx_isolation)
- {
- case ISO_READ_UNCOMMITTED:
- case ISO_READ_COMMITTED:
- if (conn->in_before_query)
- {
- DBUG_RETURN(exec_query(SPIDER_SQL_ISO_READ_COMMITTED_STR,
- SPIDER_SQL_ISO_READ_COMMITTED_LEN, -1));
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = need_mon;
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (spider_db_query(
- conn,
- SPIDER_SQL_ISO_READ_COMMITTED_STR,
- SPIDER_SQL_ISO_READ_COMMITTED_LEN,
- -1,
- need_mon)
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- break;
- case ISO_REPEATABLE_READ:
- case ISO_SERIALIZABLE:
- if (conn->in_before_query)
- {
- DBUG_RETURN(exec_query(SPIDER_SQL_ISO_SERIALIZABLE_STR,
- SPIDER_SQL_ISO_SERIALIZABLE_LEN, -1));
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = need_mon;
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (spider_db_query(
- conn,
- SPIDER_SQL_ISO_SERIALIZABLE_STR,
- SPIDER_SQL_ISO_SERIALIZABLE_LEN,
- -1,
- need_mon)
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- break;
- default:
- DBUG_RETURN(HA_ERR_UNSUPPORTED);
- }
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::set_autocommit_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::set_autocommit_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::set_autocommit(
- bool autocommit,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::set_autocommit");
- DBUG_PRINT("info",("spider this=%p", this));
- if (autocommit)
- {
- if (conn->in_before_query)
- {
- DBUG_RETURN(exec_query(SPIDER_SQL_AUTOCOMMIT_ON_STR,
- SPIDER_SQL_AUTOCOMMIT_ON_LEN, -1));
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = need_mon;
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (spider_db_query(
- conn,
- SPIDER_SQL_AUTOCOMMIT_ON_STR,
- SPIDER_SQL_AUTOCOMMIT_ON_LEN,
- -1,
- need_mon)
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- } else {
- if (conn->in_before_query)
- {
- DBUG_RETURN(exec_query(SPIDER_SQL_AUTOCOMMIT_OFF_STR,
- SPIDER_SQL_AUTOCOMMIT_OFF_LEN, -1));
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = need_mon;
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (spider_db_query(
- conn,
- SPIDER_SQL_AUTOCOMMIT_OFF_STR,
- SPIDER_SQL_AUTOCOMMIT_OFF_LEN,
- -1,
- need_mon)
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::set_sql_log_off_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::set_sql_log_off_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::set_sql_log_off(
- bool sql_log_off,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::set_sql_log_off");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::set_wait_timeout_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::set_wait_timeout_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::set_wait_timeout(
- int wait_timeout,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::set_wait_timeout");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::set_sql_mode_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::set_sql_mode_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::set_sql_mode(
- sql_mode_t sql_mode,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::set_sql_mode");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle::set_time_zone_in_bulk_sql()
-{
- DBUG_ENTER("spider_db_oracle::set_time_zone_in_bulk_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_db_oracle::set_time_zone(
- Time_zone *time_zone,
- int *need_mon
-) {
- DBUG_ENTER("spider_db_oracle::set_time_zone");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::show_master_status(
- SPIDER_TRX *trx,
- SPIDER_SHARE *share,
- int all_link_idx,
- int *need_mon,
- TABLE *table,
- spider_string *str,
- int mode,
- SPIDER_DB_RESULT **res1,
- SPIDER_DB_RESULT **res2
-) {
- DBUG_ENTER("spider_db_oracle::show_master_status");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(0);
-}
-
-size_t spider_db_oracle::escape_string(
- char *to,
- const char *from,
- size_t from_length
-) {
- DBUG_ENTER("spider_db_oracle::escape_string");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(util.escape_string(to, from, from_length, conn->access_charset));
-}
-
-bool spider_db_oracle::have_lock_table_list()
-{
- DBUG_ENTER("spider_db_oracle::have_lock_table_list");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(lock_table_hash.records);
-}
-
-int spider_db_oracle::append_lock_tables(
- spider_string *str
-) {
- int error_num;
- ha_spider *tmp_spider;
- int lock_type;
- uint conn_link_idx;
- int tmp_link_idx;
- SPIDER_LINK_FOR_HASH *tmp_link_for_hash;
- const char *db_name;
- uint db_name_length;
- CHARSET_INFO *db_name_charset;
- const char *table_name;
- uint table_name_length;
- CHARSET_INFO *table_name_charset;
- DBUG_ENTER("spider_db_oracle::lock_tables");
- DBUG_PRINT("info",("spider this=%p", this));
- if ((tmp_link_for_hash =
- (SPIDER_LINK_FOR_HASH *) my_hash_element(&lock_table_hash, 0)))
- {
- if ((error_num = spider_db_oracle_utility.append_lock_table_head(str)))
- {
- DBUG_RETURN(error_num);
- }
-
- tmp_spider = tmp_link_for_hash->spider;
- tmp_link_idx = tmp_link_for_hash->link_idx;
- switch (tmp_spider->wide_handler->lock_type)
- {
- case TL_READ:
- lock_type = SPIDER_DB_TABLE_LOCK_READ_LOCAL;
- break;
- case TL_READ_NO_INSERT:
- lock_type = SPIDER_DB_TABLE_LOCK_READ;
- break;
- case TL_WRITE_LOW_PRIORITY:
- lock_type = SPIDER_DB_TABLE_LOCK_LOW_PRIORITY_WRITE;
- break;
- case TL_WRITE:
- lock_type = SPIDER_DB_TABLE_LOCK_WRITE;
- break;
- default:
- // no lock
- DBUG_PRINT("info",("spider lock_type=%d",
- tmp_spider->wide_handler->lock_type));
- DBUG_RETURN(0);
- }
- conn_link_idx = tmp_spider->conn_link_idx[tmp_link_idx];
- spider_oracle_share *db_share = (spider_oracle_share *)
- tmp_spider->share->dbton_share[conn->dbton_id];
- if (&db_share->db_names_str[conn_link_idx])
- {
- db_name = db_share->db_names_str[conn_link_idx].ptr();
- db_name_length = db_share->db_names_str[conn_link_idx].length();
- db_name_charset = tmp_spider->share->access_charset;
- } else {
- db_name = tmp_spider->share->tgt_dbs[conn_link_idx];
- db_name_length = tmp_spider->share->tgt_dbs_lengths[conn_link_idx];
- db_name_charset = system_charset_info;
- }
- if (&db_share->table_names_str[conn_link_idx])
- {
- table_name = db_share->table_names_str[conn_link_idx].ptr();
- table_name_length = db_share->table_names_str[conn_link_idx].length();
- table_name_charset = tmp_spider->share->access_charset;
- } else {
- table_name = tmp_spider->share->tgt_table_names[conn_link_idx];
- table_name_length =
- tmp_spider->share->tgt_table_names_lengths[conn_link_idx];
- table_name_charset = system_charset_info;
- }
- if ((error_num = spider_db_oracle_utility.
- append_lock_table_body(
- str,
- db_name,
- db_name_length,
- db_name_charset,
- table_name,
- table_name_length,
- table_name_charset,
- lock_type
- )
- )) {
- my_hash_reset(&lock_table_hash);
- DBUG_RETURN(error_num);
- }
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&lock_table_hash,
- tmp_link_for_hash->db_table_str_hash_value, (uchar*) tmp_link_for_hash);
-#else
- my_hash_delete(&lock_table_hash, (uchar*) tmp_link_for_hash);
-#endif
-
- if ((error_num = spider_db_oracle_utility.append_lock_table_tail(str)))
- {
- DBUG_RETURN(error_num);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle::append_unlock_tables(
- spider_string *str
-) {
- int error_num;
- DBUG_ENTER("spider_db_oracle::append_unlock_tables");
- DBUG_PRINT("info",("spider this=%p", this));
- if ((error_num = spider_db_oracle_utility.append_unlock_table(str)))
- {
- DBUG_RETURN(error_num);
- }
- DBUG_RETURN(0);
-}
-
-uint spider_db_oracle::get_lock_table_hash_count()
-{
- DBUG_ENTER("spider_db_oracle::get_lock_table_hash_count");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(lock_table_hash.records);
-}
-
-void spider_db_oracle::reset_lock_table_hash()
-{
- DBUG_ENTER("spider_db_oracle::reset_lock_table_hash");
- DBUG_PRINT("info",("spider this=%p", this));
- my_hash_reset(&lock_table_hash);
- DBUG_VOID_RETURN;
-}
-
-uint spider_db_oracle::get_opened_handler_count()
-{
- DBUG_ENTER("spider_db_oracle::get_opened_handler_count");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(handler_open_array.elements);
-}
-
-void spider_db_oracle::reset_opened_handler()
-{
- ha_spider *tmp_spider;
- int tmp_link_idx;
- SPIDER_LINK_FOR_HASH **tmp_link_for_hash;
- DBUG_ENTER("spider_db_oracle::reset_opened_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- while ((tmp_link_for_hash =
- (SPIDER_LINK_FOR_HASH **) pop_dynamic(&handler_open_array)))
- {
- tmp_spider = (*tmp_link_for_hash)->spider;
- tmp_link_idx = (*tmp_link_for_hash)->link_idx;
- tmp_spider->clear_handler_opened(tmp_link_idx, conn->conn_kind);
- }
- DBUG_VOID_RETURN;
-}
-
-void spider_db_oracle::set_dup_key_idx(
- ha_spider *spider,
- int link_idx
-) {
- TABLE *table = spider->get_table();
- uint roop_count, pk_idx = table->s->primary_key;
- int key_name_length;
- int max_length = 0;
- char *key_name, *tmp_pos;
- char buf[SPIDER_ORACLE_ERR_BUF_LEN];
- DBUG_ENTER("spider_db_oracle::set_dup_key_idx");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider error_str=%s", stored_error_msg));
- memcpy(buf, spider->share->tgt_dbs[link_idx],
- spider->share->tgt_dbs_lengths[link_idx]);
- tmp_pos = buf + spider->share->tgt_dbs_lengths[link_idx];
- *tmp_pos = '.';
- ++tmp_pos;
- for (roop_count = 0; roop_count < table->s->keys; roop_count++)
- {
- if (roop_count == pk_idx)
- {
- DBUG_PRINT("info",("spider pk_idx=%u", roop_count));
- int all_link_idx = spider->conn_link_idx[link_idx];
- key_name = spider->share->tgt_pk_names[all_link_idx];
- key_name_length = spider->share->tgt_pk_names_lengths[all_link_idx];
- } else {
-#ifdef SPIDER_use_LEX_CSTRING_for_KEY_Field_name
- key_name = (char *) table->s->key_info[roop_count].name.str;
- key_name_length = table->s->key_info[roop_count].name.length;
-#else
- key_name = table->s->key_info[roop_count].name;
- key_name_length = strlen(key_name);
-#endif
- }
- memcpy(tmp_pos, key_name, key_name_length + 1);
- DBUG_PRINT("info",("spider key_name=%s", key_name));
- DBUG_PRINT("info",("spider full key name=%s", buf));
- if (
- max_length < key_name_length &&
- strcasestr(stored_error_msg, buf)
- ) {
- max_length = key_name_length;
- spider->dup_key_idx = roop_count;
- }
- }
- if (max_length == 0)
- spider->dup_key_idx = (uint) -1;
- DBUG_PRINT("info",("spider dup_key_idx=%d", spider->dup_key_idx));
- DBUG_VOID_RETURN;
-}
-
-bool spider_db_oracle::cmp_request_key_to_snd(
- st_spider_db_request_key *request_key
-) {
- DBUG_ENTER("spider_db_oracle::cmp_request_key_to_snd");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(TRUE);
-}
-
-int spider_db_oracle::set_error(
- sword res,
- dvoid *hndlp,
- int error_num,
- const char *error1,
- const char *error2
-) {
- DBUG_ENTER("spider_db_oracle::set_error");
- DBUG_PRINT("info",("spider this=%p", this));
- stored_error_num =
- spider_db_oracle_get_error(res, hndlp, error_num, error1, error2,
- conn->access_charset, stored_error_msg);
- if (stored_error_num)
- stored_error = ER_SPIDER_ORACLE_ERR;
- else
- stored_error = "";
- DBUG_RETURN(stored_error_num);
-}
-
-spider_db_oracle_util::spider_db_oracle_util() : spider_db_util()
-{
- DBUG_ENTER("spider_db_oracle_util::spider_db_oracle_util");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_VOID_RETURN;
-}
-
-spider_db_oracle_util::~spider_db_oracle_util()
-{
- DBUG_ENTER("spider_db_oracle_util::~spider_db_oracle_util");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_VOID_RETURN;
-}
-
-int spider_db_oracle_util::append_name(
- spider_string *str,
- const char *name,
- uint name_length
-) {
- DBUG_ENTER("spider_db_oracle_util::append_name");
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->q_append(name, name_length);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_name_with_charset(
- spider_string *str,
- const char *name,
- uint name_length,
- CHARSET_INFO *name_charset
-) {
- DBUG_ENTER("spider_db_oracle_util::append_name_with_charset");
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->append(name, name_length, name_charset);
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_escaped_name(
- spider_string *str,
- const char *name,
- uint name_length
-) {
- int error_num;
- DBUG_ENTER("spider_db_oracle_util::append_name");
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str_internal(
- str, name, name_length, dbton_id)))
- {
- DBUG_RETURN(error_num);
- }
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_escaped_name_with_charset(
- spider_string *str,
- const char *name,
- uint name_length,
- CHARSET_INFO *name_charset
-) {
- int error_num;
- DBUG_ENTER("spider_db_oracle_util::append_name_with_charset");
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2 + name_length * 2))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str_internal(
- str, name, name_length, name_charset, dbton_id)))
- {
- DBUG_RETURN(error_num);
- }
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- DBUG_RETURN(0);
-}
-
-bool spider_db_oracle_util::is_name_quote(
- const char head_code
-) {
- DBUG_ENTER("spider_db_oracle_util::is_name_quote");
- DBUG_RETURN(head_code == *name_quote_str);
-}
-
-int spider_db_oracle_util::append_escaped_name_quote(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_escaped_name_quote");
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_column_value(
- ha_spider *spider,
- spider_string *str,
- Field *field,
- const uchar *new_ptr,
- CHARSET_INFO *access_charset
-) {
- char buf[MAX_FIELD_WIDTH];
- spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
- String *ptr;
- uint length;
- Time_zone *saved_time_zone = thd->variables.time_zone;
- DBUG_ENTER("spider_db_oracle_util::append_column_value");
- tmp_str.init_calc_mem(181);
-
- thd->variables.time_zone = UTC;
-
- if (new_ptr)
- {
- if (
- field->type() == MYSQL_TYPE_BLOB ||
- field->real_type() == MYSQL_TYPE_VARCHAR
- ) {
- length = uint2korr(new_ptr);
- tmp_str.set((char *) new_ptr + HA_KEY_BLOB_LENGTH, length,
- &my_charset_bin);
- ptr = tmp_str.get_str();
- } else if (field->type() == MYSQL_TYPE_GEOMETRY)
- {
-/*
- uint mlength = SIZEOF_STORED_DOUBLE, lcnt;
- uchar *dest = (uchar *) buf;
- const uchar *source;
- for (lcnt = 0; lcnt < 4; lcnt++)
- {
- mlength = SIZEOF_STORED_DOUBLE;
- source = new_ptr + mlength + SIZEOF_STORED_DOUBLE * lcnt;
- while (mlength--)
- *dest++ = *--source;
- }
- tmp_str.length(SIZEOF_STORED_DOUBLE * lcnt);
-*/
- double xmin, xmax, ymin, ymax;
-/*
- float8store(buf,xmin);
- float8store(buf+8,xmax);
- float8store(buf+16,ymin);
- float8store(buf+24,ymax);
- memcpy(&xmin,new_ptr,sizeof(xmin));
- memcpy(&xmax,new_ptr + 8,sizeof(xmax));
- memcpy(&ymin,new_ptr + 16,sizeof(ymin));
- memcpy(&ymax,new_ptr + 24,sizeof(ymax));
- float8get(xmin, buf);
- float8get(xmax, buf + 8);
- float8get(ymin, buf + 16);
- float8get(ymax, buf + 24);
- DBUG_PRINT("info", ("spider geo is %f %f %f %f",
- xmin, xmax, ymin, ymax));
- DBUG_PRINT("info", ("spider geo is %.14g %.14g %.14g %.14g",
- xmin, xmax, ymin, ymax));
-*/
- float8get(xmin, new_ptr);
- float8get(xmax, new_ptr + 8);
- float8get(ymin, new_ptr + 16);
- float8get(ymax, new_ptr + 24);
- DBUG_PRINT("info", ("spider geo is %f %f %f %f",
- xmin, xmax, ymin, ymax));
-/*
- float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 4);
- float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 5);
- float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 6);
- float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 7);
- DBUG_PRINT("info", ("spider geo is %f %f %f %f",
- xmin, xmax, ymin, ymax));
- float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 8);
- float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 9);
- float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 10);
- float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 11);
- DBUG_PRINT("info", ("spider geo is %f %f %f %f",
- xmin, xmax, ymin, ymax));
- float8get(xmin, new_ptr + SIZEOF_STORED_DOUBLE * 12);
- float8get(xmax, new_ptr + SIZEOF_STORED_DOUBLE * 13);
- float8get(ymin, new_ptr + SIZEOF_STORED_DOUBLE * 14);
- float8get(ymax, new_ptr + SIZEOF_STORED_DOUBLE * 15);
- DBUG_PRINT("info", ("spider geo is %f %f %f %f",
- xmin, xmax, ymin, ymax));
-*/
-/*
- tmp_str.set((char *) new_ptr, SIZEOF_STORED_DOUBLE * 4,
- &my_charset_bin);
-*/
- tmp_str.length(0);
- tmp_str.q_append((char *) SPIDER_SQL_LINESTRING_HEAD_STR,
- SPIDER_SQL_LINESTRING_HEAD_LEN);
- tmp_str.q_append((char *) new_ptr, SIZEOF_STORED_DOUBLE);
- tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 2,
- SIZEOF_STORED_DOUBLE);
- tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE,
- SIZEOF_STORED_DOUBLE);
- tmp_str.q_append((char *) new_ptr + SIZEOF_STORED_DOUBLE * 3,
- SIZEOF_STORED_DOUBLE);
- ptr = tmp_str.get_str();
- } else {
- ptr = field->val_str(tmp_str.get_str(), new_ptr);
- tmp_str.mem_calc();
- }
- } else {
- ptr = field->val_str(tmp_str.get_str());
- tmp_str.mem_calc();
- }
-
- thd->variables.time_zone = saved_time_zone;
-
- DBUG_PRINT("info", ("spider field->type() is %d", field->type()));
- DBUG_PRINT("info", ("spider ptr->length() is %d", ptr->length()));
-/*
- if (
- field->type() == MYSQL_TYPE_BIT ||
- (field->type() >= MYSQL_TYPE_TINY_BLOB &&
- field->type() <= MYSQL_TYPE_BLOB)
- ) {
- uchar *hex_ptr = (uchar *) ptr->ptr(), *end_ptr;
- char *str_ptr;
- DBUG_PRINT("info", ("spider HEX"));
- if (str->reserve(SPIDER_SQL_HEX_LEN + ptr->length() * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_HEX_STR, SPIDER_SQL_HEX_LEN);
- str_ptr = (char *) str->ptr() + str->length();
- for (end_ptr = hex_ptr + ptr->length(); hex_ptr < end_ptr; hex_ptr++)
- {
- *str_ptr++ = spider_dig_upper[(*hex_ptr) >> 4];
- *str_ptr++ = spider_dig_upper[(*hex_ptr) & 0x0F];
- }
- str->length(str->length() + ptr->length() * 2);
- } else
-*/
- if (field->result_type() == STRING_RESULT)
- {
- DBUG_PRINT("info", ("spider STRING_RESULT"));
- if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- if (
- field->type() == MYSQL_TYPE_VARCHAR ||
- (field->type() >= MYSQL_TYPE_ENUM &&
- field->type() <= MYSQL_TYPE_GEOMETRY)
- ) {
- DBUG_PRINT("info", ("spider append_escaped"));
- char buf2[MAX_FIELD_WIDTH];
- spider_string tmp_str2(buf2, MAX_FIELD_WIDTH, access_charset);
- tmp_str2.init_calc_mem(182);
- tmp_str2.length(0);
- if (
- tmp_str2.append(ptr->ptr(), ptr->length(), field->charset()) ||
- str->reserve(tmp_str2.length() * 2) ||
- append_escaped_util(str, tmp_str2.get_str())
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- } else if (str->append(*ptr))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- } else if (field->str_needs_quotes())
- {
- if (str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN * 2 + ptr->length() * 2 + 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- append_escaped_util(str, ptr);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- } else if (str->append(*ptr))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_from_with_alias(
- spider_string *str,
- const char **table_names,
- uint *table_name_lengths,
- const char **table_aliases,
- uint *table_alias_lengths,
- uint table_count,
- int *table_name_pos,
- bool over_write
-) {
- uint roop_count, length = 0;
- DBUG_ENTER("spider_db_oracle_util::append_from_with_alias");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!over_write)
- {
- for (roop_count = 0; roop_count < table_count; roop_count++)
- length += table_name_lengths[roop_count] + SPIDER_SQL_SPACE_LEN +
- table_alias_lengths[roop_count] + SPIDER_SQL_COMMA_LEN;
- if (str->reserve(SPIDER_SQL_FROM_LEN + length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- *table_name_pos = str->length();
- }
- for (roop_count = 0; roop_count < table_count; roop_count++)
- {
- str->q_append(table_names[roop_count], table_name_lengths[roop_count]);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(table_aliases[roop_count], table_alias_lengths[roop_count]);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_trx_isolation(
- spider_string *str,
- int trx_isolation
-) {
- DBUG_ENTER("spider_db_oracle_util::append_trx_isolation");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN +
- SPIDER_SQL_ISO_READ_COMMITTED_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (str->length())
- {
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
- switch (trx_isolation)
- {
- case ISO_READ_UNCOMMITTED:
- case ISO_READ_COMMITTED:
- str->q_append(SPIDER_SQL_ISO_READ_COMMITTED_STR,
- SPIDER_SQL_ISO_READ_COMMITTED_LEN);
- break;
- case ISO_REPEATABLE_READ:
- case ISO_SERIALIZABLE:
- str->q_append(SPIDER_SQL_ISO_SERIALIZABLE_STR,
- SPIDER_SQL_ISO_SERIALIZABLE_LEN);
- break;
- default:
- DBUG_RETURN(HA_ERR_UNSUPPORTED);
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_autocommit(
- spider_string *str,
- bool autocommit
-) {
- DBUG_ENTER("spider_db_oracle_util::append_autocommit");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_AUTOCOMMIT_OFF_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (str->length())
- {
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
- if (autocommit)
- {
- str->q_append(SPIDER_SQL_AUTOCOMMIT_ON_STR,
- SPIDER_SQL_AUTOCOMMIT_ON_LEN);
- } else {
- str->q_append(SPIDER_SQL_AUTOCOMMIT_OFF_STR,
- SPIDER_SQL_AUTOCOMMIT_OFF_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_sql_log_off(
- spider_string *str,
- bool sql_log_off
-) {
- DBUG_ENTER("spider_db_oracle_util::append_sql_log_off");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_wait_timeout(
- spider_string *str,
- int wait_timeout
-) {
- DBUG_ENTER("spider_db_oracle_util::append_wait_timeout");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_sql_mode(
- spider_string *str,
- sql_mode_t sql_mode
-) {
- DBUG_ENTER("spider_db_oracle_util::append_sql_mode");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_time_zone(
- spider_string *str,
- Time_zone *time_zone
-) {
- DBUG_ENTER("spider_db_oracle_util::append_time_zone");
- DBUG_PRINT("info",("spider this=%p", this));
- /* nothing to do */
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_start_transaction(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_start_transaction");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN +
- SPIDER_SQL_START_TRANSACTION_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (str->length())
- {
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
- str->q_append(SPIDER_SQL_START_TRANSACTION_STR,
- SPIDER_SQL_START_TRANSACTION_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_xa_start(
- spider_string *str,
- XID *xid
-) {
- DBUG_ENTER("spider_db_oracle_util::append_xa_start");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_ASSERT(0);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_lock_table_head(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_lock_table_head");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_lock_table_body(
- spider_string *str,
- const char *db_name,
- uint db_name_length,
- CHARSET_INFO *db_name_charset,
- const char *table_name,
- uint table_name_length,
- CHARSET_INFO *table_name_charset,
- int lock_type
-) {
- DBUG_ENTER("spider_db_oracle_util::append_lock_table_body");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN + SPIDER_SQL_LOCK_TABLE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (str->length())
- {
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
- str->q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN);
- if (str->reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- if (
- str->append(db_name, db_name_length, db_name_charset) ||
- str->reserve((SPIDER_SQL_NAME_QUOTE_LEN) * 2 + SPIDER_SQL_DOT_LEN)
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- if (
- str->append(table_name, table_name_length, table_name_charset) ||
- str->reserve(SPIDER_SQL_NAME_QUOTE_LEN +
- spider_db_table_lock_len[lock_type])
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->q_append(spider_db_table_lock_str[lock_type],
- spider_db_table_lock_len[lock_type]);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_lock_table_tail(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_lock_table_tail");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_unlock_table(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_unlock_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_COMMIT_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_COMMIT_STR, SPIDER_SQL_COMMIT_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::open_item_func(
- Item_func *item_func,
- ha_spider *spider,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
-) {
- uint dbton_id = spider_dbton_oracle.dbton_id;
- int error_num;
- Item *item, **item_list = item_func->arguments();
- Field *field;
- LEX_CSTRING func_name_c;
- uint roop_count, item_count = item_func->argument_count(), start_item = 0;
- const char *func_name = SPIDER_SQL_NULL_CHAR_STR,
- *separator_str = SPIDER_SQL_NULL_CHAR_STR,
- *last_str = SPIDER_SQL_NULL_CHAR_STR;
- int func_name_length = SPIDER_SQL_NULL_CHAR_LEN,
- separator_str_length = SPIDER_SQL_NULL_CHAR_LEN,
- last_str_length = SPIDER_SQL_NULL_CHAR_LEN;
- int use_pushdown_udf;
- bool merge_func = FALSE;
- DBUG_ENTER("spider_db_oracle_util::open_item_func");
- if (str)
- {
- if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- }
- DBUG_PRINT("info",("spider functype = %d", item_func->functype()));
- switch (item_func->functype())
- {
- case Item_func::ISNULL_FUNC:
- last_str = SPIDER_SQL_IS_NULL_STR;
- last_str_length = SPIDER_SQL_IS_NULL_LEN;
- break;
- case Item_func::ISNOTNULL_FUNC:
- last_str = SPIDER_SQL_IS_NOT_NULL_STR;
- last_str_length = SPIDER_SQL_IS_NOT_NULL_LEN;
- break;
- case Item_func::UNKNOWN_FUNC:
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- DBUG_PRINT("info",("spider func_name = %s", func_name));
- DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- if (func_name_length == 1 &&
- (
- !strncasecmp("+", func_name, func_name_length) ||
- !strncasecmp("-", func_name, func_name_length) ||
- !strncasecmp("*", func_name, func_name_length) ||
- !strncasecmp("/", func_name, func_name_length) ||
- !strncasecmp("%", func_name, func_name_length) ||
- !strncasecmp("&", func_name, func_name_length) ||
- !strncasecmp("|", func_name, func_name_length) ||
- !strncasecmp("^", func_name, func_name_length)
- )
- ) {
- /* no action */
- break;
- } else if (func_name_length == 2 &&
- (
- !strncasecmp("<<", func_name, func_name_length) ||
- !strncasecmp(">>", func_name, func_name_length)
- )
- ) {
- /* no action */
- break;
- } else if (func_name_length == 3 &&
- !strncasecmp("div", func_name, func_name_length)
- ) {
- /* no action */
- break;
- } else if (func_name_length == 4)
- {
- if (
- !strncasecmp("rand", func_name, func_name_length) &&
-#ifdef SPIDER_Item_args_arg_count_IS_PROTECTED
- !item_func->argument_count()
-#else
- !item_func->arg_count
-#endif
- ) {
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- } else if (
- !strncasecmp("case", func_name, func_name_length)
- ) {
-#ifdef ITEM_FUNC_CASE_PARAMS_ARE_PUBLIC
- Item_func_case *item_func_case = (Item_func_case *) item_func;
- if (str)
- {
- if (str->reserve(SPIDER_SQL_CASE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CASE_STR, SPIDER_SQL_CASE_LEN);
- }
- if (item_func_case->first_expr_num != -1)
- {
- if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->first_expr_num], NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- }
- for (roop_count = 0; roop_count < item_func_case->ncases;
- roop_count += 2)
- {
- if (str)
- {
- if (str->reserve(SPIDER_SQL_WHEN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHEN_STR, SPIDER_SQL_WHEN_LEN);
- }
- if ((error_num = spider_db_print_item_type(
- item_list[roop_count], NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (str->reserve(SPIDER_SQL_THEN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_THEN_STR, SPIDER_SQL_THEN_LEN);
- }
- if ((error_num = spider_db_print_item_type(
- item_list[roop_count + 1], NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- }
- if (item_func_case->else_expr_num != -1)
- {
- if (str)
- {
- if (str->reserve(SPIDER_SQL_ELSE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ELSE_STR, SPIDER_SQL_ELSE_LEN);
- }
- if ((error_num = spider_db_print_item_type(
- item_list[item_func_case->else_expr_num], NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- }
- if (str)
- {
- if (str->reserve(SPIDER_SQL_END_LEN + SPIDER_SQL_CLOSE_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_END_STR, SPIDER_SQL_END_LEN);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- DBUG_RETURN(0);
-#else
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
-#endif
- }
- } else if (func_name_length == 6 &&
- !strncasecmp("istrue", func_name, func_name_length)
- ) {
- last_str = SPIDER_SQL_IS_TRUE_STR;
- last_str_length = SPIDER_SQL_IS_TRUE_LEN;
- break;
- } else if (func_name_length == 7)
- {
- if (!strncasecmp("isfalse", func_name, func_name_length))
- {
- last_str = SPIDER_SQL_IS_FALSE_STR;
- last_str_length = SPIDER_SQL_IS_FALSE_LEN;
- break;
- } else if (
- !strncasecmp("sysdate", func_name, func_name_length) ||
- !strncasecmp("curdate", func_name, func_name_length) ||
- !strncasecmp("curtime", func_name, func_name_length)
- ) {
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- } else if (
- !strncasecmp("convert", func_name, func_name_length)
- ) {
- if (str)
- {
- if (str->reserve(func_name_length * 2 + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR,
- SPIDER_SQL_OPEN_PAREN_LEN);
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- }
- break;
- }
- } else if (func_name_length == 8 &&
- (
- !strncasecmp("utc_date", func_name, func_name_length) ||
- !strncasecmp("utc_time", func_name, func_name_length)
- )
- ) {
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- } else if (func_name_length == 9 &&
- !strncasecmp("isnottrue", func_name, func_name_length)
- ) {
- last_str = SPIDER_SQL_IS_NOT_TRUE_STR;
- last_str_length = SPIDER_SQL_IS_NOT_TRUE_LEN;
- break;
- } else if (func_name_length == 10)
- {
- if (!strncasecmp("isnotfalse", func_name, func_name_length))
- {
- last_str = SPIDER_SQL_IS_NOT_FALSE_STR;
- last_str_length = SPIDER_SQL_IS_NOT_FALSE_LEN;
- break;
- } else if (!strncasecmp("column_get", func_name, func_name_length))
- {
- if (str)
- {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- }
- func_name = SPIDER_SQL_COMMA_STR;
- func_name_length = SPIDER_SQL_COMMA_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- break;
- }
- } else if (func_name_length == 12)
- {
- if (!strncasecmp("cast_as_date", func_name, func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
- }
- last_str = SPIDER_SQL_AS_DATE_STR;
- last_str_length = SPIDER_SQL_AS_DATE_LEN;
- break;
- } else if (!strncasecmp("cast_as_time", func_name, func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
- }
- last_str = SPIDER_SQL_AS_TIME_STR;
- last_str_length = SPIDER_SQL_AS_TIME_LEN;
- break;
- }
- } else if (func_name_length == 13)
- {
- if (!strncasecmp("utc_timestamp", func_name, func_name_length))
- {
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- } else if (!strncasecmp("timestampdiff", func_name, func_name_length))
- {
-#ifdef ITEM_FUNC_TIMESTAMPDIFF_ARE_PUBLIC
- Item_func_timestamp_diff *item_func_timestamp_diff =
- (Item_func_timestamp_diff *) item_func;
- if (str)
- {
- const char *interval_str;
- uint interval_len;
- switch (item_func_timestamp_diff->int_type)
- {
- case INTERVAL_YEAR:
- interval_str = SPIDER_SQL_YEAR_STR;
- interval_len = SPIDER_SQL_YEAR_LEN;
- break;
- case INTERVAL_QUARTER:
- interval_str = SPIDER_SQL_QUARTER_STR;
- interval_len = SPIDER_SQL_QUARTER_LEN;
- break;
- case INTERVAL_MONTH:
- interval_str = SPIDER_SQL_MONTH_STR;
- interval_len = SPIDER_SQL_MONTH_LEN;
- break;
- case INTERVAL_WEEK:
- interval_str = SPIDER_SQL_WEEK_STR;
- interval_len = SPIDER_SQL_WEEK_LEN;
- break;
- case INTERVAL_DAY:
- interval_str = SPIDER_SQL_DAY_STR;
- interval_len = SPIDER_SQL_DAY_LEN;
- break;
- case INTERVAL_HOUR:
- interval_str = SPIDER_SQL_HOUR_STR;
- interval_len = SPIDER_SQL_HOUR_LEN;
- break;
- case INTERVAL_MINUTE:
- interval_str = SPIDER_SQL_MINUTE_STR;
- interval_len = SPIDER_SQL_MINUTE_LEN;
- break;
- case INTERVAL_SECOND:
- interval_str = SPIDER_SQL_SECOND_STR;
- interval_len = SPIDER_SQL_SECOND_LEN;
- break;
- case INTERVAL_MICROSECOND:
- interval_str = SPIDER_SQL_MICROSECOND_STR;
- interval_len = SPIDER_SQL_MICROSECOND_LEN;
- break;
- default:
- interval_str = "";
- interval_len = 0;
- break;
- }
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN +
- interval_len + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- str->q_append(interval_str, interval_len);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if ((error_num = spider_db_print_item_type(item_list[0], NULL, spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if ((error_num = spider_db_print_item_type(item_list[1], NULL, spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- DBUG_RETURN(0);
-#else
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
-#endif
- }
- } else if (func_name_length == 14)
- {
- if (!strncasecmp("cast_as_binary", func_name, func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- char tmp_buf[MAX_FIELD_WIDTH], *tmp_ptr, *tmp_ptr2;
- spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
- tmp_str.init_calc_mem(123);
- tmp_str.length(0);
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
-#if MYSQL_VERSION_ID < 50500
- item_func->print(tmp_str.get_str(), QT_IS);
-#else
- item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
- tmp_str.mem_calc();
- if (tmp_str.reserve(1))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- tmp_ptr = tmp_str.c_ptr_quick();
- DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr));
- while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_BINARY_STR)))
- tmp_ptr = tmp_ptr2 + 1;
- last_str = tmp_ptr - 1;
- last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN;
- }
- break;
- } else if (!strncasecmp("cast_as_signed", func_name, func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
- }
- last_str = SPIDER_SQL_AS_SIGNED_STR;
- last_str_length = SPIDER_SQL_AS_SIGNED_LEN;
- break;
- }
- } else if (func_name_length == 16)
- {
- if (!strncasecmp("cast_as_unsigned", func_name, func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
- }
- last_str = SPIDER_SQL_AS_UNSIGNED_STR;
- last_str_length = SPIDER_SQL_AS_UNSIGNED_LEN;
- break;
- } else if (!strncasecmp("decimal_typecast", func_name,
- func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- char tmp_buf[MAX_FIELD_WIDTH], *tmp_ptr, *tmp_ptr2;
- spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
- tmp_str.init_calc_mem(124);
- tmp_str.length(0);
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
-#if MYSQL_VERSION_ID < 50500
- item_func->print(tmp_str.get_str(), QT_IS);
-#else
- item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
- tmp_str.mem_calc();
- if (tmp_str.reserve(1))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- tmp_ptr = tmp_str.c_ptr_quick();
- DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr));
- while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_DECIMAL_STR)))
- tmp_ptr = tmp_ptr2 + 1;
- last_str = tmp_ptr - 1;
- last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN;
- }
- break;
- } else if (!strncasecmp("cast_as_datetime", func_name,
- func_name_length))
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
- }
- last_str = SPIDER_SQL_AS_DATETIME_STR;
- last_str_length = SPIDER_SQL_AS_DATETIME_LEN;
- break;
- }
- } else if (func_name_length == 17)
- {
- if (!strncasecmp("date_add_interval", func_name, func_name_length))
- {
- Item_date_add_interval *item_date_add_interval =
- (Item_date_add_interval *) item_func;
- switch (item_date_add_interval->int_type)
- {
- case INTERVAL_YEAR:
- case INTERVAL_QUARTER:
- case INTERVAL_MONTH:
- if (str)
- {
- if (str->reserve(SPIDER_SQL_ADD_MONTHS_LEN +
- SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ADD_MONTHS_STR,
- SPIDER_SQL_ADD_MONTHS_LEN);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR,
- SPIDER_SQL_OPEN_PAREN_LEN);
- }
- if ((error_num = spider_db_print_item_type(item_list[0], NULL,
- spider, str, alias, alias_length, dbton_id, use_fields,
- fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (item_date_add_interval->date_sub_interval)
- {
- if (str->reserve(SPIDER_SQL_COMMA_LEN +
- SPIDER_SQL_MINUS_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- str->q_append(SPIDER_SQL_MINUS_STR, SPIDER_SQL_MINUS_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- if ((error_num = spider_db_print_item_type(item_list[1], NULL,
- spider, str, alias, alias_length, dbton_id, use_fields,
- fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (item_date_add_interval->int_type == INTERVAL_YEAR)
- {
- func_name = " * 12";
- func_name_length = sizeof(" * 12") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN * 2)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else if (item_date_add_interval->int_type ==
- INTERVAL_QUARTER)
- {
- func_name = " * 3";
- func_name_length = sizeof(" * 3") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN * 2)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- }
- break;
- case INTERVAL_WEEK:
- case INTERVAL_DAY:
- case INTERVAL_HOUR:
- case INTERVAL_MINUTE:
- case INTERVAL_SECOND:
- case INTERVAL_MICROSECOND:
- if ((error_num = spider_db_print_item_type(item_list[0], NULL,
- spider, str, alias, alias_length, dbton_id, use_fields,
- fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (item_date_add_interval->date_sub_interval)
- {
- if (str->reserve(SPIDER_SQL_MINUS_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_MINUS_STR, SPIDER_SQL_MINUS_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_PLUS_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_PLUS_STR, SPIDER_SQL_PLUS_LEN);
- }
- }
- if ((error_num = spider_db_print_item_type(item_list[1], NULL,
- spider, str, alias, alias_length, dbton_id, use_fields,
- fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (item_date_add_interval->int_type == INTERVAL_WEEK)
- {
- func_name = " * 7";
- func_name_length = sizeof(" * 7") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else if (item_date_add_interval->int_type == INTERVAL_HOUR)
- {
- func_name = " / 24";
- func_name_length = sizeof(" / 24") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else if (item_date_add_interval->int_type == INTERVAL_MINUTE)
- {
- func_name = " / 1440";
- func_name_length = sizeof(" / 1440") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else if (item_date_add_interval->int_type == INTERVAL_SECOND)
- {
- func_name = " / 86400";
- func_name_length = sizeof(" / 86400") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else if (item_date_add_interval->int_type ==
- INTERVAL_MICROSECOND)
- {
- func_name = " / 86400000000";
- func_name_length = sizeof(" / 86400000000") - 1;
- if (str->reserve(func_name_length +
- (SPIDER_SQL_CLOSE_PAREN_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- }
- break;
- default:
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- }
- DBUG_RETURN(0);
- break;
- }
- }
- if (str)
- {
- if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- }
- func_name = SPIDER_SQL_COMMA_STR;
- func_name_length = SPIDER_SQL_COMMA_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- break;
- case Item_func::NOW_FUNC:
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- case Item_func::CHAR_TYPECAST_FUNC:
- DBUG_PRINT("info",("spider CHAR_TYPECAST_FUNC"));
- {
- item = item_list[0];
- if (item->type() == Item::FUNC_ITEM)
- {
- DBUG_PRINT("info",("spider child is FUNC_ITEM"));
- Item_func *ifunc = (Item_func *) item;
- if (ifunc->functype() == Item_func::UNKNOWN_FUNC)
- {
- LEX_CSTRING child_func_name_c;
- const char *child_func_name;
- int child_func_name_length;
- DBUG_PRINT("info",("spider child is UNKNOWN_FUNC"));
- child_func_name_c = ifunc->func_name_cstring();
- child_func_name = child_func_name_c.str;
- child_func_name_length = child_func_name_c.length;
- DBUG_PRINT("info",("spider child func_name is %s", child_func_name));
- if (
- child_func_name_length == 10 &&
- !strncasecmp("column_get", child_func_name, child_func_name_length)
- ) {
- DBUG_PRINT("info",("spider this is merge func"));
- merge_func = TRUE;
- }
- }
- }
-
- if (str)
- {
- char tmp_buf[MAX_FIELD_WIDTH], *tmp_ptr, *tmp_ptr2;
- spider_string tmp_str(tmp_buf, MAX_FIELD_WIDTH, str->charset());
- tmp_str.init_calc_mem(125);
- tmp_str.length(0);
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (!merge_func)
- {
- if (str->reserve(SPIDER_SQL_CAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CAST_STR, SPIDER_SQL_CAST_LEN);
- }
-#if MYSQL_VERSION_ID < 50500
- item_func->print(tmp_str.get_str(), QT_IS);
-#else
- item_func->print(tmp_str.get_str(), QT_TO_SYSTEM_CHARSET);
-#endif
- tmp_str.mem_calc();
- if (tmp_str.reserve(1))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- tmp_ptr = tmp_str.c_ptr_quick();
- DBUG_PRINT("info",("spider tmp_ptr = %s", tmp_ptr));
- while ((tmp_ptr2 = strstr(tmp_ptr, SPIDER_SQL_AS_CHAR_STR)))
- tmp_ptr = tmp_ptr2 + 1;
- last_str = tmp_ptr - 1;
- last_str_length = strlen(last_str) - SPIDER_SQL_CLOSE_PAREN_LEN;
- }
- }
- break;
- case Item_func::NOT_FUNC:
- DBUG_PRINT("info",("spider NOT_FUNC"));
- if (item_list[0]->type() == Item::COND_ITEM)
- {
- DBUG_PRINT("info",("spider item_list[0] is COND_ITEM"));
- Item_cond *item_cond = (Item_cond *) item_list[0];
- if (item_cond->functype() == Item_func::COND_AND_FUNC)
- {
- DBUG_PRINT("info",("spider item_cond is COND_AND_FUNC"));
- List_iterator_fast<Item> lif(*(item_cond->argument_list()));
- bool has_expr_cache_item = FALSE;
- bool has_isnotnull_func = FALSE;
- bool has_other_item = FALSE;
- while((item = lif++))
- {
-#ifdef SPIDER_HAS_EXPR_CACHE_ITEM
- if (
- item->type() == Item::EXPR_CACHE_ITEM
- ) {
- DBUG_PRINT("info",("spider EXPR_CACHE_ITEM"));
- has_expr_cache_item = TRUE;
- } else
-#endif
- if (
- item->type() == Item::FUNC_ITEM &&
- ((Item_func *) item)->functype() == Item_func::ISNOTNULL_FUNC
- ) {
- DBUG_PRINT("info",("spider ISNOTNULL_FUNC"));
- has_isnotnull_func = TRUE;
- } else {
- DBUG_PRINT("info",("spider has other item"));
- DBUG_PRINT("info",("spider COND type=%d", item->type()));
- has_other_item = TRUE;
- }
- }
- if (has_expr_cache_item && has_isnotnull_func && !has_other_item)
- {
- DBUG_PRINT("info",("spider NOT EXISTS skip"));
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- }
- }
- }
- if (str)
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- if (str->reserve(func_name_length + SPIDER_SQL_SPACE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- }
- break;
- case Item_func::NEG_FUNC:
- if (str)
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- if (str->reserve(func_name_length + SPIDER_SQL_SPACE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- }
- break;
- case Item_func::IN_FUNC:
- if (((Item_func_opt_neg *) item_func)->negated)
- {
- func_name = SPIDER_SQL_NOT_IN_STR;
- func_name_length = SPIDER_SQL_NOT_IN_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- } else {
- func_name = SPIDER_SQL_IN_STR;
- func_name_length = SPIDER_SQL_IN_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- }
- break;
- case Item_func::BETWEEN:
- if (((Item_func_opt_neg *) item_func)->negated)
- {
- func_name = SPIDER_SQL_NOT_BETWEEN_STR;
- func_name_length = SPIDER_SQL_NOT_BETWEEN_LEN;
- separator_str = SPIDER_SQL_AND_STR;
- separator_str_length = SPIDER_SQL_AND_LEN;
- } else {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- separator_str = SPIDER_SQL_AND_STR;
- separator_str_length = SPIDER_SQL_AND_LEN;
- }
- break;
- case Item_func::UDF_FUNC:
- use_pushdown_udf = spider_param_use_pushdown_udf(
- spider->wide_handler->trx->thd,
- spider->share->use_pushdown_udf);
- if (!use_pushdown_udf)
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- if (str)
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- DBUG_PRINT("info",("spider func_name = %s", func_name));
- DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- if (str->reserve(func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- }
- func_name = SPIDER_SQL_COMMA_STR;
- func_name_length = SPIDER_SQL_COMMA_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- break;
-#ifdef MARIADB_BASE_VERSION
- case Item_func::XOR_FUNC:
-#else
- case Item_func::COND_XOR_FUNC:
-#endif
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(
- spider_db_open_item_cond((Item_cond *) item_func, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- case Item_func::TRIG_COND_FUNC:
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- case Item_func::GUSERVAR_FUNC:
- if (str)
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- if (item_func->result_type() == STRING_RESULT)
- DBUG_RETURN(spider_db_open_item_string(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- else
- DBUG_RETURN(spider_db_open_item_int(item_func, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields));
- case Item_func::FT_FUNC:
- if (spider_db_check_ft_idx(item_func, spider) == MAX_KEY)
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- start_item = 1;
- if (str)
- {
- if (str->reserve(SPIDER_SQL_MATCH_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN);
- }
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- break;
- case Item_func::SP_EQUALS_FUNC:
- if (str)
- {
- func_name = SPIDER_SQL_MBR_EQUAL_STR;
- func_name_length = SPIDER_SQL_MBR_EQUAL_LEN;
- DBUG_PRINT("info",("spider func_name = %s", func_name));
- DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- if (str->reserve(func_name_length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- }
- func_name = SPIDER_SQL_COMMA_STR;
- func_name_length = SPIDER_SQL_COMMA_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- break;
- case Item_func::SP_DISJOINT_FUNC:
- case Item_func::SP_INTERSECTS_FUNC:
- case Item_func::SP_TOUCHES_FUNC:
- case Item_func::SP_CROSSES_FUNC:
- case Item_func::SP_WITHIN_FUNC:
- case Item_func::SP_CONTAINS_FUNC:
- case Item_func::SP_OVERLAPS_FUNC:
- if (str)
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- DBUG_PRINT("info",("spider func_name = %s", func_name));
- DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- if (str->reserve(
-#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
- SPIDER_SQL_MBR_LEN +
-#endif
- func_name_length + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-#ifndef SPIDER_ITEM_GEOFUNC_NAME_HAS_MBR
- str->q_append(SPIDER_SQL_MBR_STR, SPIDER_SQL_MBR_LEN);
-#endif
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- }
- func_name = SPIDER_SQL_COMMA_STR;
- func_name_length = SPIDER_SQL_COMMA_LEN;
- separator_str = SPIDER_SQL_COMMA_STR;
- separator_str_length = SPIDER_SQL_COMMA_LEN;
- last_str = SPIDER_SQL_CLOSE_PAREN_STR;
- last_str_length = SPIDER_SQL_CLOSE_PAREN_LEN;
- break;
- case Item_func::EQ_FUNC:
- case Item_func::EQUAL_FUNC:
- case Item_func::NE_FUNC:
- case Item_func::LT_FUNC:
- case Item_func::LE_FUNC:
- case Item_func::GE_FUNC:
- case Item_func::GT_FUNC:
- if (str)
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- }
- break;
- case Item_func::LIKE_FUNC:
-#ifdef SPIDER_LIKE_FUNC_HAS_GET_NEGATED
- if (str)
- {
- if (((Item_func_like *)item_func)->get_negated())
- {
- func_name = SPIDER_SQL_NOT_LIKE_STR;
- func_name_length = SPIDER_SQL_NOT_LIKE_LEN;
- }
- else
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- }
- }
- break;
-#else
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
-#endif
- default:
- THD *thd = spider->wide_handler->trx->thd;
- SPIDER_SHARE *share = spider->share;
- if (spider_param_skip_default_condition(thd,
- share->skip_default_condition))
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- if (str)
- {
- func_name_c = item_func->func_name_cstring();
- func_name = func_name_c.str;
- func_name_length = func_name_c.lengthstr;
- }
- break;
- }
- DBUG_PRINT("info",("spider func_name = %s", func_name));
- DBUG_PRINT("info",("spider func_name_length = %d", func_name_length));
- DBUG_PRINT("info",("spider separator_str = %s", separator_str));
- DBUG_PRINT("info",("spider separator_str_length = %d", separator_str_length));
- DBUG_PRINT("info",("spider last_str = %s", last_str));
- DBUG_PRINT("info",("spider last_str_length = %d", last_str_length));
- if (item_count)
- {
- /* Find the field in the list of items of the expression tree */
- field = spider_db_find_field_in_item_list(item_list,
- item_count, start_item,
- str,
- func_name, func_name_length);
- item_count--;
- for (roop_count = start_item; roop_count < item_count; roop_count++)
- {
- item = item_list[roop_count];
- if ((error_num = spider_db_print_item_type(item, field, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- if (roop_count == 1)
- {
- func_name = separator_str;
- func_name_length = separator_str_length;
- }
- if (str)
- {
- if (str->reserve(func_name_length + SPIDER_SQL_SPACE_LEN * 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(func_name, func_name_length);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- }
- }
- item = item_list[roop_count];
- if ((error_num = spider_db_print_item_type(item, field, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- }
- if (item_func->functype() == Item_func::FT_FUNC)
- {
- Item_func_match *item_func_match = (Item_func_match *)item_func;
- if (str)
- {
- if (str->reserve(SPIDER_SQL_AGAINST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN);
- }
- item = item_list[0];
- if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (str->reserve(
- ((item_func_match->match_flags & FT_BOOL) ?
- SPIDER_SQL_IN_BOOLEAN_MODE_LEN : 0) +
- ((item_func_match->match_flags & FT_EXPAND) ?
- SPIDER_SQL_WITH_QUERY_EXPANSION_LEN : 0)
- ))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- if (item_func_match->match_flags & FT_BOOL)
- str->q_append(SPIDER_SQL_IN_BOOLEAN_MODE_STR,
- SPIDER_SQL_IN_BOOLEAN_MODE_LEN);
- if (item_func_match->match_flags & FT_EXPAND)
- str->q_append(SPIDER_SQL_WITH_QUERY_EXPANSION_STR,
- SPIDER_SQL_WITH_QUERY_EXPANSION_LEN);
- }
- } else if (item_func->functype() == Item_func::UNKNOWN_FUNC)
- {
- if (
- func_name_length == 7 &&
- !strncasecmp("convert", func_name, func_name_length)
- ) {
- if (str)
- {
- Item_func_conv_charset *item_func_conv_charset =
- (Item_func_conv_charset *)item_func;
- CHARSET_INFO *conv_charset =
- item_func_conv_charset->SPIDER_Item_func_conv_charset_conv_charset;
- uint cset_length = strlen(conv_charset->csname);
- if (str->reserve(SPIDER_SQL_USING_LEN + cset_length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_USING_STR, SPIDER_SQL_USING_LEN);
- str->q_append(conv_charset->csname, cset_length);
- }
- }
- }
- if (str)
- {
- if (merge_func)
- str->length(str->length() - SPIDER_SQL_CLOSE_PAREN_LEN);
- if (str->reserve(last_str_length + SPIDER_SQL_CLOSE_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(last_str, last_str_length);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- DBUG_RETURN(0);
-}
-
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
-int spider_db_oracle_util::open_item_sum_func(
- Item_sum *item_sum,
- ha_spider *spider,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
-) {
- uint dbton_id = spider_dbton_oracle.dbton_id;
- uint roop_count, item_count = item_sum->get_arg_count();
- int error_num;
- DBUG_ENTER("spider_db_oracle_util::open_item_sum_func");
- DBUG_PRINT("info",("spider Sumfunctype = %d", item_sum->sum_func()));
- switch (item_sum->sum_func())
- {
- case Item_sum::COUNT_FUNC:
- case Item_sum::SUM_FUNC:
- case Item_sum::MIN_FUNC:
- case Item_sum::MAX_FUNC:
- {
- LEX_CSTRING func_name_c= item_sum->func_name_cstring();
- const char *func_name = func_name_c.str;
- uint func_name_length = func_name_c.length;
- Item *item, **args = item_sum->get_args();
- if (str)
- {
- if (str->reserve(func_name_length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(func_name, func_name_length);
- }
- if (item_count)
- {
- item_count--;
- for (roop_count = 0; roop_count < item_count; roop_count++)
- {
- item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- item = args[roop_count];
- if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- DBUG_RETURN(error_num);
- }
- if (str)
- {
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- }
- break;
- case Item_sum::COUNT_DISTINCT_FUNC:
- case Item_sum::SUM_DISTINCT_FUNC:
- case Item_sum::AVG_FUNC:
- case Item_sum::AVG_DISTINCT_FUNC:
- case Item_sum::STD_FUNC:
- case Item_sum::VARIANCE_FUNC:
- case Item_sum::SUM_BIT_FUNC:
- case Item_sum::UDF_SUM_FUNC:
- case Item_sum::GROUP_CONCAT_FUNC:
- default:
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- }
- DBUG_RETURN(0);
-}
-#endif
-
-size_t spider_db_oracle_util::escape_string(
- char *to,
- const char *from,
- size_t from_length,
- CHARSET_INFO *access_charset
-) {
- my_bool overflow;
- DBUG_ENTER("spider_db_oracle::escape_string");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(escape_quotes_for_mysql(access_charset, to, 0,
- from, from_length, &overflow));
-}
-
-int spider_db_oracle_util::append_escaped_util(
- spider_string *to,
- String *from
-) {
- size_t copy_length;
- DBUG_ENTER("spider_db_oracle_util::append_escaped_util");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider to=%s", to->c_ptr_safe()));
- DBUG_PRINT("info",("spider from=%s", from->c_ptr_safe()));
- copy_length = escape_string((char *) to->ptr() + to->length(), from->ptr(),
- from->length(), to->charset());
- DBUG_PRINT("info",("spider copy_length=%zu", copy_length));
- to->length(to->length() + copy_length);
- to->mem_calc();
- DBUG_RETURN(0);
-}
-
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
-int spider_db_oracle_util::append_from_and_tables(
- ha_spider *spider,
- spider_fields *fields,
- spider_string *str,
- TABLE_LIST *table_list,
- uint table_count
-) {
- SPIDER_TABLE_HOLDER *table_holder;
- int error_num;
- uint dbton_id = spider_dbton_oracle.dbton_id, from_length;
- spider_oracle_share *db_share;
- spider_oracle_handler *dbton_hdl;
- ha_spider *spider;
- DBUG_ENTER("spider_db_oracle_util::append_from_and_tables");
- DBUG_PRINT("info",("spider this=%p", this));
-
- /* calculate from size */
- from_length = SPIDER_SQL_FROM_LEN;
- fields->set_pos_to_first_table_holder();
- while ((table_holder = fields->get_next_table_holder()))
- {
- spider = table_holder->spider;
- db_share = (spider_oracle_share *)
- spider->share->dbton_share[dbton_id];
- from_length +=
- db_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 +
- db_share->table_nm_max_length +
- SPIDER_SQL_SPACE_LEN + SPIDER_SQL_COMMA_LEN +
- table_holder->alias->length() - SPIDER_SQL_DOT_LEN;
- }
-
- if (str->reserve(from_length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
-
- fields->set_pos_to_first_table_holder();
- while ((table_holder = fields->get_next_table_holder()))
- {
- spider = table_holder->spider;
- db_share = (spider_oracle_share *)
- spider->share->dbton_share[dbton_id];
- dbton_hdl = (spider_oracle_handler *) spider->dbton_handler[dbton_id];
- dbton_hdl->table_name_pos = str->length();
- if ((error_num = db_share->append_table_name_with_adjusting(str,
- spider->conn_link_idx[dbton_hdl->first_link_idx])))
- {
- DBUG_RETURN(error_num);
- }
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(table_holder->alias->ptr(),
- table_holder->alias->length() - SPIDER_SQL_DOT_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::reappend_tables(
- spider_fields *fields,
- SPIDER_LINK_IDX_CHAIN *link_idx_chain,
- spider_string *str
-) {
- int error_num;
- uint dbton_id = spider_dbton_oracle.dbton_id, length;
- ha_spider *spider;
- spider_oracle_share *db_share;
- spider_oracle_handler *dbton_hdl;
- SPIDER_TABLE_HOLDER *table_holder;
- SPIDER_LINK_IDX_HOLDER *link_idx_holder;
- DBUG_ENTER("spider_db_oracle_util::reappend_tables");
- DBUG_PRINT("info",("spider this=%p", this));
- length = str->length();
- fields->set_pos_to_first_table_on_link_idx_chain(link_idx_chain);
- fields->set_pos_to_first_table_holder();
- while ((table_holder = fields->get_next_table_holder()))
- {
- link_idx_holder = fields->get_next_table_on_link_idx_chain(link_idx_chain);
- spider = table_holder->spider;
- db_share = (spider_oracle_share *)
- spider->share->dbton_share[dbton_id];
- if (!db_share->same_db_table_name)
- {
- dbton_hdl = (spider_oracle_handler *) spider->dbton_handler[dbton_id];
- str->length(dbton_hdl->table_name_pos);
- if ((error_num = db_share->append_table_name_with_adjusting(str,
- spider->conn_link_idx[link_idx_holder->link_idx])))
- {
- DBUG_RETURN(error_num);
- }
- }
- }
- str->length(length);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_where(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_where");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_WHERE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_db_oracle_util::append_having(
- spider_string *str
-) {
- DBUG_ENTER("spider_db_oracle_util::append_having");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_HAVING_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_HAVING_STR, SPIDER_SQL_HAVING_LEN);
- DBUG_RETURN(0);
-}
-#endif
-
-spider_oracle_share::spider_oracle_share(
- st_spider_share *share
-) : spider_db_share(
- share,
- spider_dbton_oracle.dbton_id
-),
- table_select(NULL),
- table_select_pos(0),
- key_select(NULL),
- key_select_pos(NULL),
- key_hint(NULL),
- show_table_status(NULL),
- show_records(NULL),
- show_autoinc(NULL),
- show_last_insert_id(NULL),
- show_index(NULL),
- table_names_str(NULL),
- db_names_str(NULL),
- db_table_str(NULL),
- nextval_str(NULL),
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- db_table_str_hash_value(NULL),
-#endif
- table_nm_max_length(0),
- db_nm_max_length(0),
- nextval_max_length(0),
- column_name_str(NULL),
- same_db_table_name(TRUE),
- first_all_link_idx(-1)
-{
- DBUG_ENTER("spider_oracle_share::spider_oracle_share");
- DBUG_PRINT("info",("spider this=%p", this));
- spider_alloc_calc_mem_init(mem_calc, 220);
- spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this));
- DBUG_VOID_RETURN;
-}
-
-spider_oracle_share::~spider_oracle_share()
-{
- DBUG_ENTER("spider_oracle_share::~spider_oracle_share");
- DBUG_PRINT("info",("spider this=%p", this));
- if (table_select)
- delete [] table_select;
- if (key_select)
- delete [] key_select;
- if (key_hint)
- delete [] key_hint;
- free_show_table_status();
- free_show_records();
- free_show_autoinc();
- free_show_last_insert_id();
- free_show_index();
- free_column_name_str();
- free_table_names_str();
- if (key_select_pos)
- {
- spider_free(spider_current_trx, key_select_pos, MYF(0));
- }
- spider_free_mem_calc(spider_current_trx, mem_calc_id, sizeof(*this));
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::init()
-{
- int error_num;
- uint roop_count;
- TABLE_SHARE *table_share = spider_share->table_share;
- uint keys = table_share ? table_share->keys : 0;
- DBUG_ENTER("spider_oracle_share::init");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!(key_select_pos = (int *)
- spider_bulk_alloc_mem(spider_current_trx, 221,
- __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
- &key_select_pos,
- sizeof(int) * keys,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- &db_table_str_hash_value,
- sizeof(my_hash_value_type) * spider_share->all_link_count,
-#endif
- NullS))
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-
- if (keys > 0 &&
- !(key_hint = new spider_string[keys])
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- for (roop_count = 0; roop_count < keys; roop_count++)
- {
- key_hint[roop_count].init_calc_mem(190);
- key_hint[roop_count].set_charset(spider_share->access_charset);
- }
- DBUG_PRINT("info",("spider key_hint=%p", key_hint));
-
- if (
- !(table_select = new spider_string[1]) ||
- (keys > 0 &&
- !(key_select = new spider_string[keys])
- ) ||
- (error_num = create_table_names_str()) ||
- (table_share &&
- (
- (error_num = create_column_name_str()) ||
- (error_num = convert_key_hint_str()) ||
- (error_num = append_show_table_status()) ||
- (error_num = append_show_records()) ||
- (error_num = append_show_autoinc()) ||
- (error_num = append_show_last_insert_id()) ||
- (error_num = append_show_index())
- )
- )
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-
- table_select->init_calc_mem(191);
- if (table_share && (error_num = append_table_select()))
- DBUG_RETURN(error_num);
-
- for (roop_count = 0; roop_count < keys; roop_count++)
- {
- key_select[roop_count].init_calc_mem(192);
- if ((error_num = append_key_select(roop_count)))
- DBUG_RETURN(error_num);
- }
-
- DBUG_RETURN(error_num);
-}
-
-uint spider_oracle_share::get_column_name_length(
- uint field_index
-) {
- DBUG_ENTER("spider_oracle_share::get_column_name_length");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(column_name_str[field_index].length());
-}
-
-int spider_oracle_share::append_column_name(
- spider_string *str,
- uint field_index
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_share::append_column_name");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = spider_db_oracle_utility.append_name(str,
- column_name_str[field_index].ptr(), column_name_str[field_index].length());
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_share::append_column_name_with_alias(
- spider_string *str,
- uint field_index,
- const char *alias,
- uint alias_length
-) {
- DBUG_ENTER("spider_oracle_share::append_column_name_with_alias");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(
- alias_length +
- column_name_str[field_index].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- append_column_name(str, field_index);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_share::append_table_name(
- spider_string *str,
- int all_link_idx
-) {
- const char *db_nm = db_names_str[all_link_idx].ptr();
- uint db_nm_len = db_names_str[all_link_idx].length();
- const char *table_nm = table_names_str[all_link_idx].ptr();
- uint table_nm_len = table_names_str[all_link_idx].length();
- DBUG_ENTER("spider_oracle_share::append_table_name");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(db_nm_len + SPIDER_SQL_DOT_LEN + table_nm_len +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- spider_db_oracle_utility.append_name(str, db_nm, db_nm_len);
- str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN);
- spider_db_oracle_utility.append_name(str, table_nm, table_nm_len);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_share::append_table_name_with_adjusting(
- spider_string *str,
- int all_link_idx
-) {
- const char *db_nm = db_names_str[all_link_idx].ptr();
- uint db_nm_len = db_names_str[all_link_idx].length();
- uint db_nm_max_len = db_nm_max_length;
- const char *table_nm = table_names_str[all_link_idx].ptr();
- uint table_nm_len = table_names_str[all_link_idx].length();
- uint table_nm_max_len = table_nm_max_length;
- DBUG_ENTER("spider_oracle_share::append_table_name_with_adjusting");
- DBUG_PRINT("info",("spider this=%p", this));
- spider_db_oracle_utility.append_name(str, db_nm, db_nm_len);
- str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN);
- spider_db_oracle_utility.append_name(str, table_nm, table_nm_len);
- uint length =
- db_nm_max_len - db_nm_len +
- table_nm_max_len - table_nm_len;
- memset((char *) str->ptr() + str->length(), ' ', length);
- str->length(str->length() + length);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_share::append_from_with_adjusted_table_name(
- spider_string *str,
- int *table_name_pos
-) {
- const char *db_nm = db_names_str[0].ptr();
- uint db_nm_len = db_names_str[0].length();
- uint db_nm_max_len = db_nm_max_length;
- const char *table_nm = table_names_str[0].ptr();
- uint table_nm_len = table_names_str[0].length();
- uint table_nm_max_len = table_nm_max_length;
- DBUG_ENTER("spider_oracle_share::append_from_with_adjusted_table_name");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_FROM_LEN + db_nm_max_length +
- SPIDER_SQL_DOT_LEN + table_nm_max_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- *table_name_pos = str->length();
- spider_db_oracle_utility.append_name(str, db_nm, db_nm_len);
- str->q_append(SPIDER_SQL_DOT_STR, SPIDER_SQL_DOT_LEN);
- spider_db_oracle_utility.append_name(str, table_nm, table_nm_len);
- uint length =
- db_nm_max_len - db_nm_len +
- table_nm_max_len - table_nm_len;
- memset((char *) str->ptr() + str->length(), ' ', length);
- str->length(str->length() + length);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_share::create_table_names_str()
-{
- int error_num, roop_count;
- uint table_nm_len, db_nm_len;
- spider_string *str, *first_tbl_nm_str, *first_db_nm_str, *first_db_tbl_str;
- char *first_tbl_nm, *first_db_nm;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_share::create_table_names_str");
- table_names_str = NULL;
- db_names_str = NULL;
- db_table_str = NULL;
- if (
- !(table_names_str = new spider_string[spider_share->all_link_count]) ||
- !(db_names_str = new spider_string[spider_share->all_link_count]) ||
- !(db_table_str = new spider_string[spider_share->all_link_count])
- ) {
- error_num = HA_ERR_OUT_OF_MEM;
- goto error;
- }
-
- same_db_table_name = TRUE;
- first_tbl_nm = spider_share->tgt_table_names[0];
- first_db_nm = spider_share->tgt_dbs[0];
- table_nm_len = spider_share->tgt_table_names_lengths[0];
- db_nm_len = spider_share->tgt_dbs_lengths[0];
- first_tbl_nm_str = &table_names_str[0];
- first_db_nm_str = &db_names_str[0];
- first_db_tbl_str = &db_table_str[0];
- for (roop_count = 0; roop_count < (int) spider_share->all_link_count;
- roop_count++)
- {
- table_names_str[roop_count].init_calc_mem(193);
- db_names_str[roop_count].init_calc_mem(194);
- db_table_str[roop_count].init_calc_mem(195);
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
- if (first_all_link_idx == -1)
- first_all_link_idx = roop_count;
-
- str = &table_names_str[roop_count];
- if (
- roop_count != 0 &&
- same_db_table_name &&
- spider_share->tgt_table_names_lengths[roop_count] == table_nm_len &&
- !memcmp(first_tbl_nm, spider_share->tgt_table_names[roop_count],
- table_nm_len)
- ) {
- if (str->copy(*first_tbl_nm_str))
- {
- error_num = HA_ERR_OUT_OF_MEM;
- goto error;
- }
- } else {
- str->set_charset(spider_share->access_charset);
- if ((error_num = spider_db_append_name_with_quote_str(str,
- spider_share->tgt_table_names[roop_count], dbton_id)))
- goto error;
- if (roop_count)
- {
- same_db_table_name = FALSE;
- DBUG_PRINT("info", ("spider found different table name %s",
- spider_share->tgt_table_names[roop_count]));
- if (str->length() > table_nm_max_length)
- table_nm_max_length = str->length();
- } else
- table_nm_max_length = str->length();
- }
-
- str = &db_names_str[roop_count];
- if (
- roop_count != 0 &&
- same_db_table_name &&
- spider_share->tgt_dbs_lengths[roop_count] == db_nm_len &&
- !memcmp(first_db_nm, spider_share->tgt_dbs[roop_count],
- db_nm_len)
- ) {
- if (str->copy(*first_db_nm_str))
- {
- error_num = HA_ERR_OUT_OF_MEM;
- goto error;
- }
- } else {
- str->set_charset(spider_share->access_charset);
- if ((error_num = spider_db_append_name_with_quote_str(str,
- spider_share->tgt_dbs[roop_count], dbton_id)))
- goto error;
- if (roop_count)
- {
- same_db_table_name = FALSE;
- DBUG_PRINT("info", ("spider found different db name %s",
- spider_share->tgt_dbs[roop_count]));
- if (str->length() > db_nm_max_length)
- db_nm_max_length = str->length();
- } else
- db_nm_max_length = str->length();
- }
-
- str = &db_table_str[roop_count];
- if (
- roop_count != 0 &&
- same_db_table_name
- ) {
- if (str->copy(*first_db_tbl_str))
- {
- error_num = HA_ERR_OUT_OF_MEM;
- goto error;
- }
- } else {
- str->set_charset(spider_share->access_charset);
- if ((error_num = append_table_name(str, roop_count)))
- goto error;
- }
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- db_table_str_hash_value[roop_count] = my_calc_hash(
- &spider_open_connections, (uchar*) str->ptr(), str->length());
-#endif
- }
- DBUG_RETURN(0);
-
-error:
- if (db_table_str)
- {
- delete [] db_table_str;
- db_table_str = NULL;
- }
- if (db_names_str)
- {
- delete [] db_names_str;
- db_names_str = NULL;
- }
- if (table_names_str)
- {
- delete [] table_names_str;
- table_names_str = NULL;
- }
- DBUG_RETURN(error_num);
-}
-
-void spider_oracle_share::free_table_names_str()
-{
- DBUG_ENTER("spider_oracle_share::free_table_names_str");
- if (db_table_str)
- {
- delete [] db_table_str;
- db_table_str = NULL;
- }
- if (db_names_str)
- {
- delete [] db_names_str;
- db_names_str = NULL;
- }
- if (table_names_str)
- {
- delete [] table_names_str;
- table_names_str = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::create_column_name_str()
-{
- spider_string *str;
- int error_num;
- Field **field;
- TABLE_SHARE *table_share = spider_share->table_share;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_share::create_column_name_str");
- if (
- table_share->fields &&
- !(column_name_str = new spider_string[table_share->fields])
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- for (field = table_share->field, str = column_name_str;
- *field; field++, str++)
- {
- str->init_calc_mem(196);
- str->set_charset(spider_share->access_charset);
- if ((error_num = spider_db_append_name_with_quote_str(str,
- (*field)->field_name, dbton_id)))
- goto error;
- }
- DBUG_RETURN(0);
-
-error:
- if (column_name_str)
- {
- delete [] column_name_str;
- column_name_str = NULL;
- }
- DBUG_RETURN(error_num);
-}
-
-void spider_oracle_share::free_column_name_str()
-{
- DBUG_ENTER("spider_oracle_share::free_column_name_str");
- if (column_name_str)
- {
- delete [] column_name_str;
- column_name_str = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::convert_key_hint_str()
-{
- spider_string *tmp_key_hint;
- int roop_count;
- TABLE_SHARE *table_share = spider_share->table_share;
- DBUG_ENTER("spider_oracle_share::convert_key_hint_str");
- if (spider_share->access_charset->cset != system_charset_info->cset)
- {
- /* need conversion */
- for (roop_count = 0, tmp_key_hint = key_hint;
- roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++)
- {
- tmp_key_hint->length(0);
- if (tmp_key_hint->append(spider_share->key_hint->ptr(),
- spider_share->key_hint->length(), system_charset_info))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- } else {
- for (roop_count = 0, tmp_key_hint = key_hint;
- roop_count < (int) table_share->keys; roop_count++, tmp_key_hint++)
- {
- if (tmp_key_hint->copy(spider_share->key_hint[roop_count]))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_share::append_show_table_status()
-{
- int roop_count;
- spider_string *str;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_append_show_table_status");
- if (!(show_table_status =
- new spider_string[2 * spider_share->all_link_count]))
- goto error;
-
- for (roop_count = 0; roop_count < (int) spider_share->all_link_count;
- roop_count++)
- {
- show_table_status[0 + (2 * roop_count)].init_calc_mem(197);
- show_table_status[1 + (2 * roop_count)].init_calc_mem(207);
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
-
- if (
- show_table_status[0 + (2 * roop_count)].reserve(
- SPIDER_SQL_SHOW_TABLE_STATUS_LEN +
- db_names_str[roop_count].length() +
- SPIDER_SQL_LIKE_LEN + table_names_str[roop_count].length() +
- ((SPIDER_SQL_NAME_QUOTE_LEN) * 2) +
- ((SPIDER_SQL_VALUE_QUOTE_LEN) * 2)) ||
- show_table_status[1 + (2 * roop_count)].reserve(
- SPIDER_SQL_SELECT_TABLES_STATUS_LEN +
- db_names_str[roop_count].length() +
- SPIDER_SQL_AND_LEN + SPIDER_SQL_TABLE_NAME_LEN + SPIDER_SQL_EQUAL_LEN +
- table_names_str[roop_count].length() +
- ((SPIDER_SQL_VALUE_QUOTE_LEN) * 4))
- )
- goto error;
- str = &show_table_status[0 + (2 * roop_count)];
- str->q_append(
- SPIDER_SQL_SHOW_TABLE_STATUS_STR, SPIDER_SQL_SHOW_TABLE_STATUS_LEN);
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->q_append(db_names_str[roop_count].ptr(),
- db_names_str[roop_count].length());
- str->q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- str->q_append(SPIDER_SQL_LIKE_STR, SPIDER_SQL_LIKE_LEN);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(table_names_str[roop_count].ptr(),
- table_names_str[roop_count].length());
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str = &show_table_status[1 + (2 * roop_count)];
- str->q_append(
- SPIDER_SQL_SELECT_TABLES_STATUS_STR,
- SPIDER_SQL_SELECT_TABLES_STATUS_LEN);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(db_names_str[roop_count].ptr(),
- db_names_str[roop_count].length());
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- str->q_append(SPIDER_SQL_TABLE_NAME_STR, SPIDER_SQL_TABLE_NAME_LEN);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(table_names_str[roop_count].ptr(),
- table_names_str[roop_count].length());
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- }
- DBUG_RETURN(0);
-
-error:
- if (show_table_status)
- {
- delete [] show_table_status;
- show_table_status = NULL;
- }
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-}
-
-void spider_oracle_share::free_show_table_status()
-{
- DBUG_ENTER("spider_oracle_free_show_table_status");
- if (show_table_status)
- {
- delete [] show_table_status;
- show_table_status = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::append_show_records()
-{
- int roop_count;
- spider_string *str;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_share::append_show_records");
- if (!(show_records = new spider_string[spider_share->all_link_count]))
- goto error;
-
- for (roop_count = 0; roop_count < (int) spider_share->all_link_count;
- roop_count++)
- {
- show_records[roop_count].init_calc_mem(208);
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
-
- if (
- show_records[roop_count].reserve(
- SPIDER_SQL_SHOW_RECORDS_LEN +
- db_names_str[roop_count].length() +
- SPIDER_SQL_DOT_LEN +
- table_names_str[roop_count].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4)
- )
- goto error;
- str = &show_records[roop_count];
- str->q_append(SPIDER_SQL_SHOW_RECORDS_STR, SPIDER_SQL_SHOW_RECORDS_LEN);
- append_table_name(str, roop_count);
- }
- DBUG_RETURN(0);
-
-error:
- if (show_records)
- {
- delete [] show_records;
- show_records = NULL;
- }
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-}
-
-void spider_oracle_share::free_show_records()
-{
- DBUG_ENTER("spider_oracle_share::free_show_records");
- if (show_records)
- {
- delete [] show_records;
- show_records = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::append_show_autoinc()
-{
- uint roop_count, field_length;
- spider_string *str;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- Field **found_next_number_field =
- spider_share->table_share->found_next_number_field;
- DBUG_ENTER("spider_oracle_share::append_show_autoinc");
- if (!found_next_number_field)
- DBUG_RETURN(0);
-
- if (!(show_autoinc = new spider_string[spider_share->all_link_count]))
- goto error;
-
- field_length =
- column_name_str[(*found_next_number_field)->field_index].length();
- for (roop_count = 0; roop_count < spider_share->all_link_count;
- roop_count++)
- {
- show_autoinc[roop_count].init_calc_mem(224);
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
-
- if (
- show_autoinc[roop_count].reserve(
- SPIDER_SQL_SELECT_LEN +
- SPIDER_SQL_MAX_LEN +
- SPIDER_SQL_OPEN_PAREN_LEN +
- field_length +
- SPIDER_SQL_CLOSE_PAREN_LEN +
- SPIDER_SQL_FROM_LEN +
- db_names_str[roop_count].length() +
- SPIDER_SQL_DOT_LEN +
- table_names_str[roop_count].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 6)
- )
- goto error;
- str = &show_autoinc[roop_count];
- str->q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN);
- str->q_append(SPIDER_SQL_MAX_STR, SPIDER_SQL_MAX_LEN);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- append_column_name(str, (*found_next_number_field)->field_index);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- append_table_name(str, roop_count);
- }
- DBUG_RETURN(0);
-
-error:
- if (show_autoinc)
- {
- delete [] show_autoinc;
- show_autoinc = NULL;
- }
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-}
-
-void spider_oracle_share::free_show_autoinc()
-{
- DBUG_ENTER("spider_oracle_share::free_show_autoinc");
- if (show_autoinc)
- {
- delete [] show_autoinc;
- show_autoinc = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::append_show_last_insert_id()
-{
- uint roop_count;
- spider_string *str;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- Field **found_next_number_field =
- spider_share->table_share->found_next_number_field;
- uint seq_nm_max_length = 0;
- DBUG_ENTER("spider_oracle_share::append_show_last_insert_id");
- if (!found_next_number_field)
- DBUG_RETURN(0);
-
- if (
- !(show_last_insert_id = new spider_string[spider_share->all_link_count]) ||
- !(nextval_str = new spider_string[spider_share->all_link_count])
- )
- goto error;
-
- for (roop_count = 0; roop_count < spider_share->all_link_count;
- roop_count++)
- {
- show_last_insert_id[roop_count].init_calc_mem(225);
- nextval_str[roop_count].init_calc_mem(226);
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
-
- if (
- show_last_insert_id[roop_count].reserve(
- SPIDER_SQL_SELECT_LEN +
- spider_share->tgt_sequence_names_lengths[roop_count] +
- SPIDER_SQL_CURRVAL_LEN +
- SPIDER_SQL_FROM_DUAL_LEN +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2)
- )
- goto error;
- str = &show_last_insert_id[roop_count];
- str->q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN);
- spider_db_oracle_utility.append_name(str,
- spider_share->tgt_sequence_names[roop_count],
- spider_share->tgt_sequence_names_lengths[roop_count]);
- str->q_append(SPIDER_SQL_CURRVAL_STR, SPIDER_SQL_CURRVAL_LEN);
- str->q_append(SPIDER_SQL_FROM_DUAL_STR, SPIDER_SQL_FROM_DUAL_LEN);
-
- if (seq_nm_max_length <
- spider_share->tgt_sequence_names_lengths[roop_count])
- {
- seq_nm_max_length =
- spider_share->tgt_sequence_names_lengths[roop_count];
- }
- }
- for (roop_count = 0; roop_count < spider_share->all_link_count;
- roop_count++)
- {
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
-
- if (
- nextval_str[roop_count].reserve(
- seq_nm_max_length +
- SPIDER_SQL_NEXTVAL_LEN +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2)
- )
- goto error;
- str = &nextval_str[roop_count];
- spider_db_oracle_utility.append_name(str,
- spider_share->tgt_sequence_names[roop_count],
- spider_share->tgt_sequence_names_lengths[roop_count]);
- str->q_append(SPIDER_SQL_NEXTVAL_STR, SPIDER_SQL_NEXTVAL_LEN);
- uint length =
- seq_nm_max_length - spider_share->tgt_sequence_names_lengths[roop_count];
- memset((char *) str->ptr() + str->length(), ' ', length);
- str->length(str->length() + length);
- nextval_max_length = str->length();
- }
- DBUG_RETURN(0);
-
-error:
- if (show_last_insert_id)
- {
- delete [] show_last_insert_id;
- show_last_insert_id = NULL;
- }
- if (nextval_str)
- {
- delete [] nextval_str;
- nextval_str = NULL;
- }
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-}
-
-void spider_oracle_share::free_show_last_insert_id()
-{
- DBUG_ENTER("spider_oracle_share::free_show_last_insert_id");
- if (show_last_insert_id)
- {
- delete [] show_last_insert_id;
- show_last_insert_id = NULL;
- }
- if (nextval_str)
- {
- delete [] nextval_str;
- nextval_str = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::append_show_index()
-{
- int roop_count;
- spider_string *str;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_share::append_show_index");
- if (!(show_index = new spider_string[2 * spider_share->all_link_count]))
- goto error;
-
- for (roop_count = 0; roop_count < (int) spider_share->all_link_count;
- roop_count++)
- {
- show_index[0 + (2 * roop_count)].init_calc_mem(209);
- show_index[1 + (2 * roop_count)].init_calc_mem(210);
- if (spider_share->sql_dbton_ids[roop_count] != dbton_id)
- continue;
-
- if (
- show_index[0 + (2 * roop_count)].reserve(
- SPIDER_SQL_SHOW_INDEX_LEN + db_names_str[roop_count].length() +
- SPIDER_SQL_DOT_LEN +
- table_names_str[roop_count].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4) ||
- show_index[1 + (2 * roop_count)].reserve(
- SPIDER_SQL_SELECT_STATISTICS_LEN +
- db_names_str[roop_count].length() +
- SPIDER_SQL_AND_LEN + SPIDER_SQL_TABLE_NAME_LEN + SPIDER_SQL_EQUAL_LEN +
- table_names_str[roop_count].length() +
- ((SPIDER_SQL_VALUE_QUOTE_LEN) * 4) +
- SPIDER_SQL_GROUP_LEN + SPIDER_SQL_COLUMN_NAME_LEN)
- )
- goto error;
- str = &show_index[0 + (2 * roop_count)];
- str->q_append(
- SPIDER_SQL_SHOW_INDEX_STR, SPIDER_SQL_SHOW_INDEX_LEN);
- append_table_name(str, roop_count);
- str = &show_index[1 + (2 * roop_count)];
- str->q_append(
- SPIDER_SQL_SELECT_STATISTICS_STR, SPIDER_SQL_SELECT_STATISTICS_LEN);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(db_names_str[roop_count].ptr(),
- db_names_str[roop_count].length());
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- str->q_append(SPIDER_SQL_TABLE_NAME_STR, SPIDER_SQL_TABLE_NAME_LEN);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(table_names_str[roop_count].ptr(),
- table_names_str[roop_count].length());
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
- str->q_append(SPIDER_SQL_COLUMN_NAME_STR, SPIDER_SQL_COLUMN_NAME_LEN);
- }
- DBUG_RETURN(0);
-
-error:
- if (show_index)
- {
- delete [] show_index;
- show_index = NULL;
- }
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-}
-
-void spider_oracle_share::free_show_index()
-{
- DBUG_ENTER("spider_oracle_share::free_show_index");
- if (show_index)
- {
- delete [] show_index;
- show_index = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_share::append_table_select()
-{
- Field **field;
- uint field_length;
- spider_string *str = table_select;
- TABLE_SHARE *table_share = spider_share->table_share;
- DBUG_ENTER("spider_oracle_share::append_table_select");
-
- if (!*table_share->field)
- DBUG_RETURN(0);
-
- for (field = table_share->field; *field; field++)
- {
- field_length = column_name_str[(*field)->field_index].length();
- if (str->reserve(field_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(append_from_with_adjusted_table_name(str, &table_select_pos));
-}
-
-int spider_oracle_share::append_key_select(
- uint idx
-) {
- KEY_PART_INFO *key_part;
- Field *field;
- uint part_num;
- uint field_length;
- spider_string *str = &key_select[idx];
- TABLE_SHARE *table_share = spider_share->table_share;
- const KEY *key_info = &table_share->key_info[idx];
- DBUG_ENTER("spider_oracle_share::append_key_select");
-
- if (!spider_user_defined_key_parts(key_info))
- DBUG_RETURN(0);
-
- for (key_part = key_info->key_part, part_num = 0;
- part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
- {
- field = key_part->field;
- field_length = column_name_str[field->field_index].length();
- if (str->reserve(field_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(append_from_with_adjusted_table_name(str, &key_select_pos[idx]));
-}
-
-bool spider_oracle_share::need_change_db_table_name()
-{
- DBUG_ENTER("spider_oracle_share::need_change_db_table_name");
- DBUG_RETURN(!same_db_table_name);
-}
-
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
-int spider_oracle_share::discover_table_structure(
- SPIDER_TRX *trx,
- SPIDER_SHARE *spider_share,
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_share::discover_table_structure");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
-}
-#endif
-
-spider_oracle_handler::spider_oracle_handler(
- ha_spider *spider,
- spider_oracle_share *db_share
-) : spider_db_handler(
- spider,
- db_share
-),
- where_pos(0),
- order_pos(0),
- limit_pos(0),
- table_name_pos(0),
- update_set_pos(0),
- ha_read_pos(0),
- ha_next_pos(0),
- ha_where_pos(0),
- ha_limit_pos(0),
- ha_table_name_pos(0),
- insert_pos(0),
- insert_table_name_pos(0),
- upd_tmp_tbl(NULL),
- tmp_sql_pos1(0),
- tmp_sql_pos2(0),
- tmp_sql_pos3(0),
- tmp_sql_pos4(0),
- tmp_sql_pos5(0),
- table_lock_mode(0),
- reading_from_bulk_tmp_table(FALSE),
- filled_up(FALSE),
- select_rownum_appended(FALSE),
- update_rownum_appended(FALSE),
- union_table_name_pos_first(NULL),
- union_table_name_pos_current(NULL),
- oracle_share(db_share),
- link_for_hash(NULL)
-{
- DBUG_ENTER("spider_oracle_handler::spider_oracle_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- spider_alloc_calc_mem_init(mem_calc, 222);
- spider_alloc_calc_mem(spider_current_trx, mem_calc, sizeof(*this));
- DBUG_VOID_RETURN;
-}
-
-spider_oracle_handler::~spider_oracle_handler()
-{
- DBUG_ENTER("spider_oracle_handler::~spider_oracle_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- while (union_table_name_pos_first)
- {
- SPIDER_INT_HLD *tmp_pos = union_table_name_pos_first;
- union_table_name_pos_first = tmp_pos->next;
- spider_free(spider_current_trx, tmp_pos, MYF(0));
- }
- if (link_for_hash)
- {
- spider_free(spider_current_trx, link_for_hash, MYF(0));
- }
- spider_free_mem_calc(spider_current_trx, mem_calc_id, sizeof(*this));
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_handler::init()
-{
- uint roop_count;
- THD *thd = spider->wide_handler->trx->thd;
- st_spider_share *share = spider->share;
- int init_sql_alloc_size =
- spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size);
- TABLE *table = spider->get_table();
- DBUG_ENTER("spider_oracle_handler::init");
- DBUG_PRINT("info",("spider this=%p", this));
- sql.init_calc_mem(67);
- sql_part.init_calc_mem(68);
- sql_part2.init_calc_mem(69);
- ha_sql.init_calc_mem(70);
- insert_sql.init_calc_mem(72);
- update_sql.init_calc_mem(73);
- tmp_sql.init_calc_mem(74);
- dup_update_sql.init_calc_mem(167);
- if (
- (sql.real_alloc(init_sql_alloc_size)) ||
- (insert_sql.real_alloc(init_sql_alloc_size)) ||
- (update_sql.real_alloc(init_sql_alloc_size)) ||
- (tmp_sql.real_alloc(init_sql_alloc_size))
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- sql.set_charset(share->access_charset);
- sql_part.set_charset(share->access_charset);
- sql_part2.set_charset(share->access_charset);
- ha_sql.set_charset(share->access_charset);
- insert_sql.set_charset(share->access_charset);
- update_sql.set_charset(share->access_charset);
- tmp_sql.set_charset(share->access_charset);
- dup_update_sql.set_charset(share->access_charset);
- upd_tmp_tbl_prm.init();
- upd_tmp_tbl_prm.field_count = 1;
- if (!(link_for_hash = (SPIDER_LINK_FOR_HASH *)
- spider_bulk_alloc_mem(spider_current_trx, 223,
- __func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
- &link_for_hash,
- sizeof(SPIDER_LINK_FOR_HASH) * share->link_count,
- &minimum_select_bitmap,
- table ? sizeof(uchar) * no_bytes_in_map(table->read_set) : 0,
- NullS))
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- for (roop_count = 0; roop_count < share->link_count; roop_count++)
- {
- link_for_hash[roop_count].spider = spider;
- link_for_hash[roop_count].link_idx = roop_count;
- link_for_hash[roop_count].db_table_str =
- &oracle_share->db_table_str[roop_count];
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- link_for_hash[roop_count].db_table_str_hash_value =
- oracle_share->db_table_str_hash_value[roop_count];
-#endif
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_index_hint(
- spider_string *str,
- int link_idx,
- ulong sql_type
- )
-{
- DBUG_ENTER("spider_oracle_handler::append_index_hint");
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_table_name_with_adjusting(
- spider_string *str,
- int link_idx,
- ulong sql_type
-) {
- int error_num = 0;
- DBUG_ENTER("spider_oracle_handler::append_table_name_with_adjusting");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql_type == SPIDER_SQL_TYPE_HANDLER)
- {
- str->q_append(spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_LEN);
- } else {
- error_num = oracle_share->append_table_name_with_adjusting(str,
- spider->conn_link_idx[link_idx]);
- }
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_column_types(
- const key_range *start_key,
- spider_string *str
-) {
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- KEY *key_info = result_list->key_info;
- uint key_name_length, key_count;
- key_part_map full_key_part_map =
- make_prev_keypart_map(spider_user_defined_key_parts(key_info));
- key_part_map start_key_part_map;
- KEY_PART_INFO *key_part;
- Field *field;
- char tmp_buf[MAX_FIELD_WIDTH];
- spider_string tmp_str(tmp_buf, sizeof(tmp_buf), system_charset_info);
- DBUG_ENTER("spider_oracle_handler::append_key_column_types");
- DBUG_PRINT("info",("spider this=%p", this));
- tmp_str.init_calc_mem(227);
-
- start_key_part_map = start_key->keypart_map & full_key_part_map;
- DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u",
- spider_user_defined_key_parts(key_info)));
- DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
- DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
-
- if (!start_key_part_map)
- DBUG_RETURN(0);
-
- for (
- key_part = key_info->key_part,
- key_count = 0;
- start_key_part_map;
- start_key_part_map >>= 1,
- key_part++,
- key_count++
- ) {
- field = key_part->field;
- key_name_length = my_sprintf(tmp_buf, (tmp_buf, "c%u", key_count));
- if (str->reserve(key_name_length + SPIDER_SQL_SPACE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(tmp_buf, key_name_length);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
-
- if (tmp_str.ptr() != tmp_buf)
- tmp_str.set(tmp_buf, sizeof(tmp_buf), system_charset_info);
- else
- tmp_str.set_charset(system_charset_info);
- field->sql_type(*tmp_str.get_str());
- tmp_str.mem_calc();
- str->append(tmp_str);
-
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
-
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_join_columns_for_bka(
- const key_range *start_key,
- spider_string *str,
- const char **table_aliases,
- uint *table_alias_lengths
-) {
- KEY *key_info = spider->result_list.key_info;
- uint length, key_name_length, key_count;
- key_part_map full_key_part_map =
- make_prev_keypart_map(spider_user_defined_key_parts(key_info));
- key_part_map start_key_part_map;
- KEY_PART_INFO *key_part;
- Field *field;
- char tmp_buf[MAX_FIELD_WIDTH];
- bool start_where = ((int) str->length() == where_pos);
- DBUG_ENTER("spider_oracle_handler::append_key_join_columns_for_bka");
- DBUG_PRINT("info",("spider this=%p", this));
- start_key_part_map = start_key->keypart_map & full_key_part_map;
- DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u",
- spider_user_defined_key_parts(key_info)));
- DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
- DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
-
- if (!start_key_part_map)
- DBUG_RETURN(0);
-
- if (start_where)
- {
- if (str->reserve(SPIDER_SQL_WHERE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- }
-
- for (
- key_part = key_info->key_part,
- key_count = 0;
- start_key_part_map;
- start_key_part_map >>= 1,
- key_part++,
- key_count++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- length = my_sprintf(tmp_buf, (tmp_buf, "c%u", key_count));
- if (str->reserve(length + table_alias_lengths[0] + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- table_alias_lengths[1] + SPIDER_SQL_PF_EQUAL_LEN + SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(table_aliases[0], table_alias_lengths[0]);
- str->q_append(tmp_buf, length);
- str->q_append(SPIDER_SQL_PF_EQUAL_STR, SPIDER_SQL_PF_EQUAL_LEN);
- str->q_append(table_aliases[1], table_alias_lengths[1]);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- }
- str->length(str->length() - SPIDER_SQL_AND_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_tmp_table_and_sql_for_bka(
- const key_range *start_key
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_tmp_table_and_sql_for_bka");
- DBUG_PRINT("info",("spider this=%p", this));
- char tmp_table_name[MAX_FIELD_WIDTH * 2],
- tgt_table_name[MAX_FIELD_WIDTH * 2];
- int tmp_table_name_length;
- spider_string tgt_table_name_str(tgt_table_name, MAX_FIELD_WIDTH * 2,
- oracle_share->db_names_str[0].charset());
- const char *table_names[2], *table_aliases[2], *table_dot_aliases[2];
- uint table_name_lengths[2], table_alias_lengths[2],
- table_dot_alias_lengths[2];
- tgt_table_name_str.init_calc_mem(200);
- tgt_table_name_str.length(0);
- create_tmp_bka_table_name(tmp_table_name, &tmp_table_name_length,
- first_link_idx);
- if ((error_num = append_table_name_with_adjusting(&tgt_table_name_str,
- first_link_idx, SPIDER_SQL_TYPE_SELECT_SQL)))
- {
- DBUG_RETURN(error_num);
- }
- table_names[0] = tmp_table_name;
- table_names[1] = tgt_table_name_str.c_ptr_safe();
- table_name_lengths[0] = tmp_table_name_length;
- table_name_lengths[1] = tgt_table_name_str.length();
- table_aliases[0] = SPIDER_SQL_A_STR;
- table_aliases[1] = SPIDER_SQL_B_STR;
- table_alias_lengths[0] = SPIDER_SQL_A_LEN;
- table_alias_lengths[1] = SPIDER_SQL_B_LEN;
- table_dot_aliases[0] = SPIDER_SQL_A_DOT_STR;
- table_dot_aliases[1] = SPIDER_SQL_B_DOT_STR;
- table_dot_alias_lengths[0] = SPIDER_SQL_A_DOT_LEN;
- table_dot_alias_lengths[1] = SPIDER_SQL_B_DOT_LEN;
- if (
- (error_num = append_drop_tmp_bka_table(
- &tmp_sql, tmp_table_name, tmp_table_name_length,
- &tmp_sql_pos1, &tmp_sql_pos5, TRUE)) ||
- (error_num = append_create_tmp_bka_table(
- start_key,
- &tmp_sql, tmp_table_name,
- tmp_table_name_length,
- &tmp_sql_pos2, spider->share->table_share->table_charset)) ||
- (error_num = append_insert_tmp_bka_table(
- start_key,
- &tmp_sql, tmp_table_name,
- tmp_table_name_length, &tmp_sql_pos3))
- )
- DBUG_RETURN(error_num);
- tmp_sql_pos4 = tmp_sql.length();
- if ((error_num = spider_db_append_select(spider)))
- DBUG_RETURN(error_num);
- if (sql.reserve(SPIDER_SQL_A_DOT_LEN + SPIDER_SQL_ID_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_A_DOT_STR, SPIDER_SQL_A_DOT_LEN);
- sql.q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- if (
- (error_num = append_select_columns_with_alias(&sql,
- SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)) ||
- (error_num = spider_db_oracle_utility.append_from_with_alias(&sql,
- table_names, table_name_lengths,
- table_aliases, table_alias_lengths, 2,
- &table_name_pos, FALSE))
- )
- DBUG_RETURN(error_num);
- if (
- oracle_share->key_hint &&
- (error_num = spider_db_append_hint_after_table(spider,
- &sql, &oracle_share->key_hint[spider->active_index]))
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- where_pos = sql.length();
- if (
- (error_num = append_key_join_columns_for_bka(
- start_key, &sql,
- table_dot_aliases, table_dot_alias_lengths)) ||
- (error_num = append_condition_part(
- SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN,
- SPIDER_SQL_TYPE_SELECT_SQL, FALSE))
- )
- DBUG_RETURN(error_num);
- if (spider->result_list.direct_order_limit)
- {
- if ((error_num = append_key_order_for_direct_order_limit_with_alias(&sql,
- SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
- DBUG_RETURN(error_num);
- }
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- else if (spider->result_list.direct_aggregate)
- {
- if ((error_num =
- append_group_by(&sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
- DBUG_RETURN(error_num);
- }
-#endif
-
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::reuse_tmp_table_and_sql_for_bka()
-{
- DBUG_ENTER("spider_oracle_handler::reuse_tmp_table_and_sql_for_bka");
- DBUG_PRINT("info",("spider this=%p", this));
- tmp_sql.length(tmp_sql_pos4);
- sql.length(limit_pos);
- ha_sql.length(ha_limit_pos);
- DBUG_RETURN(0);
-}
-
-void spider_oracle_handler::create_tmp_bka_table_name(
- char *tmp_table_name,
- int *tmp_table_name_length,
- int link_idx
-) {
- uint adjust_length, length;
- DBUG_ENTER("spider_oracle_handler::create_tmp_bka_table_name");
- if (spider_param_bka_table_name_type(current_thd,
- oracle_share->spider_share->
- bka_table_name_types[spider->conn_link_idx[link_idx]]) == 1)
- {
- adjust_length =
- oracle_share->db_nm_max_length -
- oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length() +
- oracle_share->table_nm_max_length -
- oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length();
- *tmp_table_name_length = oracle_share->db_nm_max_length +
- oracle_share->table_nm_max_length;
- memset(tmp_table_name, ' ', adjust_length);
- tmp_table_name += adjust_length;
- memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(),
- oracle_share->db_names_str[link_idx].length());
- tmp_table_name += oracle_share->db_names_str[link_idx].length();
- length = my_sprintf(tmp_table_name, (tmp_table_name,
- "%s%s%p%s", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider,
- SPIDER_SQL_UNDERSCORE_STR));
- *tmp_table_name_length += length;
- tmp_table_name += length;
- memcpy(tmp_table_name,
- oracle_share->table_names_str[spider->conn_link_idx[link_idx]].c_ptr(),
- oracle_share->table_names_str[spider->conn_link_idx[link_idx]].length());
- } else {
- adjust_length =
- oracle_share->db_nm_max_length -
- oracle_share->db_names_str[spider->conn_link_idx[link_idx]].length();
- *tmp_table_name_length = oracle_share->db_nm_max_length;
- memset(tmp_table_name, ' ', adjust_length);
- tmp_table_name += adjust_length;
- memcpy(tmp_table_name, oracle_share->db_names_str[link_idx].c_ptr(),
- oracle_share->db_names_str[link_idx].length());
- tmp_table_name += oracle_share->db_names_str[link_idx].length();
- length = my_sprintf(tmp_table_name, (tmp_table_name,
- "%s%s%p", SPIDER_SQL_DOT_STR, SPIDER_SQL_TMP_BKA_STR, spider));
- *tmp_table_name_length += length;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_handler::append_create_tmp_bka_table(
- const key_range *start_key,
- spider_string *str,
- char *tmp_table_name,
- int tmp_table_name_length,
- int *db_name_pos,
- CHARSET_INFO *table_charset
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- THD *thd = spider->wide_handler->trx->thd;
- char *bka_engine = spider_param_bka_engine(thd, share->bka_engine);
- uint bka_engine_length = strlen(bka_engine),
- cset_length = strlen(table_charset->csname);
- DBUG_ENTER("spider_oracle_handler::append_create_tmp_bka_table");
- if (str->reserve(SPIDER_SQL_CREATE_TMP_LEN + tmp_table_name_length +
- SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_ID_LEN + SPIDER_SQL_ID_TYPE_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CREATE_TMP_STR, SPIDER_SQL_CREATE_TMP_LEN);
- *db_name_pos = str->length();
- str->q_append(tmp_table_name, tmp_table_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- str->q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN);
- str->q_append(SPIDER_SQL_ID_TYPE_STR, SPIDER_SQL_ID_TYPE_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- if ((error_num = append_key_column_types(start_key, str)))
- DBUG_RETURN(error_num);
- if (str->reserve(SPIDER_SQL_ENGINE_LEN + bka_engine_length +
- SPIDER_SQL_DEF_CHARSET_LEN + cset_length + SPIDER_SQL_SEMICOLON_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ENGINE_STR, SPIDER_SQL_ENGINE_LEN);
- str->q_append(bka_engine, bka_engine_length);
- str->q_append(SPIDER_SQL_DEF_CHARSET_STR, SPIDER_SQL_DEF_CHARSET_LEN);
- str->q_append(table_charset->csname, cset_length);
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_drop_tmp_bka_table(
- spider_string *str,
- char *tmp_table_name,
- int tmp_table_name_length,
- int *db_name_pos,
- int *drop_table_end_pos,
- bool with_semicolon
-) {
- DBUG_ENTER("spider_oracle_handler::append_drop_tmp_bka_table");
- if (str->reserve(SPIDER_SQL_DROP_TMP_LEN + tmp_table_name_length +
- (with_semicolon ? SPIDER_SQL_SEMICOLON_LEN : 0)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_DROP_TMP_STR, SPIDER_SQL_DROP_TMP_LEN);
- *db_name_pos = str->length();
- str->q_append(tmp_table_name, tmp_table_name_length);
- *drop_table_end_pos = str->length();
- if (with_semicolon)
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_insert_tmp_bka_table(
- const key_range *start_key,
- spider_string *str,
- char *tmp_table_name,
- int tmp_table_name_length,
- int *db_name_pos
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_insert_tmp_bka_table");
- if (str->reserve(SPIDER_SQL_INSERT_LEN + SPIDER_SQL_INTO_LEN +
- tmp_table_name_length + SPIDER_SQL_OPEN_PAREN_LEN + SPIDER_SQL_ID_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN);
- str->q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN);
- *db_name_pos = str->length();
- str->q_append(tmp_table_name, tmp_table_name_length);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- str->q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- if ((error_num = spider_db_append_key_columns(start_key, spider, str)))
- DBUG_RETURN(error_num);
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN +
- SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_union_table_and_sql_for_bka(
- const key_range *start_key
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_union_table_and_sql_for_bka");
- DBUG_PRINT("info",("spider this=%p", this));
- char tgt_table_name[MAX_FIELD_WIDTH * 2];
- spider_string tgt_table_name_str(tgt_table_name, MAX_FIELD_WIDTH * 2,
- oracle_share->db_names_str[0].charset());
- const char *table_names[2], *table_aliases[2], *table_dot_aliases[2];
- uint table_name_lengths[2], table_alias_lengths[2],
- table_dot_alias_lengths[2];
- tgt_table_name_str.init_calc_mem(234);
- tgt_table_name_str.length(0);
- if ((error_num = append_table_name_with_adjusting(&tgt_table_name_str,
- first_link_idx, SPIDER_SQL_TYPE_SELECT_SQL)))
- {
- DBUG_RETURN(error_num);
- }
- table_names[0] = "";
- table_names[1] = tgt_table_name_str.c_ptr_safe();
- table_name_lengths[0] = 0;
- table_name_lengths[1] = tgt_table_name_str.length();
- table_aliases[0] = SPIDER_SQL_A_STR;
- table_aliases[1] = SPIDER_SQL_B_STR;
- table_alias_lengths[0] = SPIDER_SQL_A_LEN;
- table_alias_lengths[1] = SPIDER_SQL_B_LEN;
- table_dot_aliases[0] = SPIDER_SQL_A_DOT_STR;
- table_dot_aliases[1] = SPIDER_SQL_B_DOT_STR;
- table_dot_alias_lengths[0] = SPIDER_SQL_A_DOT_LEN;
- table_dot_alias_lengths[1] = SPIDER_SQL_B_DOT_LEN;
-
- if ((error_num = spider_db_append_select(spider)))
- DBUG_RETURN(error_num);
- if (sql.reserve(SPIDER_SQL_A_DOT_LEN + SPIDER_SQL_ID_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_A_DOT_STR, SPIDER_SQL_A_DOT_LEN);
- sql.q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- if ((error_num = append_select_columns_with_alias(&sql,
- SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
- DBUG_RETURN(error_num);
- if (sql.reserve(SPIDER_SQL_FROM_LEN + (SPIDER_SQL_OPEN_PAREN_LEN * 2)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- tmp_sql_pos1 = sql.length();
-
- if (
- (error_num = spider_db_oracle_utility.append_from_with_alias(&tmp_sql,
- table_names, table_name_lengths,
- table_aliases, table_alias_lengths, 2,
- &table_name_pos, FALSE))
- )
- DBUG_RETURN(error_num);
- if (
- oracle_share->key_hint &&
- (error_num = spider_db_append_hint_after_table(spider,
- &tmp_sql, &oracle_share->key_hint[spider->active_index]))
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- where_pos = tmp_sql.length();
- if (
- (error_num = append_key_join_columns_for_bka(
- start_key, &tmp_sql,
- table_dot_aliases, table_dot_alias_lengths)) ||
- (error_num = append_condition_part(
- SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN,
- SPIDER_SQL_TYPE_TMP_SQL, FALSE))
- )
- DBUG_RETURN(error_num);
- if (spider->result_list.direct_order_limit)
- {
- if ((error_num = append_key_order_for_direct_order_limit_with_alias(
- &tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
- DBUG_RETURN(error_num);
- }
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- else if (spider->result_list.direct_aggregate)
- {
- if ((error_num =
- append_group_by(&tmp_sql, SPIDER_SQL_B_DOT_STR, SPIDER_SQL_B_DOT_LEN)))
- DBUG_RETURN(error_num);
- }
-#endif
-
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::reuse_union_table_and_sql_for_bka()
-{
- DBUG_ENTER("spider_oracle_handler::reuse_union_table_and_sql_for_bka");
- DBUG_PRINT("info",("spider this=%p", this));
- sql.length(tmp_sql_pos1);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_insert_for_recovery(
- ulong sql_type,
- int link_idx
-) {
- const TABLE *table = spider->get_table();
- SPIDER_SHARE *share = spider->share;
- Field **field;
- uint field_name_length = 0;
- bool add_value = FALSE;
- spider_string *insert_sql;
- DBUG_ENTER("spider_oracle_handler::append_insert_for_recovery");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql_type == SPIDER_SQL_TYPE_INSERT_SQL)
- {
- insert_sql = &spider->result_list.insert_sqls[link_idx];
- insert_sql->length(0);
- } else {
- insert_sql = &spider->result_list.update_sqls[link_idx];
- }
- if (insert_sql->reserve(
- SPIDER_SQL_INSERT_LEN + SPIDER_SQL_SQL_IGNORE_LEN +
- SPIDER_SQL_INTO_LEN + oracle_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- insert_sql->q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN);
- insert_sql->q_append(SPIDER_SQL_SQL_IGNORE_STR, SPIDER_SQL_SQL_IGNORE_LEN);
- insert_sql->q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN);
- oracle_share->append_table_name(insert_sql, spider->conn_link_idx[link_idx]);
- insert_sql->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- for (field = table->field; *field; field++)
- {
- field_name_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if (insert_sql->reserve(field_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(insert_sql, (*field)->field_index);
- insert_sql->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if (field_name_length)
- insert_sql->length(insert_sql->length() - SPIDER_SQL_COMMA_LEN);
- if (insert_sql->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN +
- SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- insert_sql->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- insert_sql->q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN);
- insert_sql->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- for (field = table->field; *field; field++)
- {
- add_value = TRUE;
- if ((*field)->is_null())
- {
- if (insert_sql->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- insert_sql->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
- } else {
- if (
- spider_db_oracle_utility.
- append_column_value(spider, insert_sql, *field, NULL,
- share->access_charset) ||
- insert_sql->reserve(SPIDER_SQL_COMMA_LEN)
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- insert_sql->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if (add_value)
- insert_sql->length(insert_sql->length() - SPIDER_SQL_COMMA_LEN);
- if (insert_sql->reserve(SPIDER_SQL_CLOSE_PAREN_LEN, SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- insert_sql->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- if (sql_type == SPIDER_SQL_TYPE_INSERT_SQL)
- {
- exec_insert_sql = insert_sql;
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_update(
- const TABLE *table,
- my_ptrdiff_t ptr_diff
-) {
- int error_num;
- spider_string *str = &update_sql;
- DBUG_ENTER("spider_oracle_handler::append_update");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->length() > 0)
- {
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
-
- if (
- (error_num = append_update(str, 0)) ||
- (error_num = append_update_set(str)) ||
- (error_num = append_update_where(str, table, ptr_diff))
- )
- DBUG_RETURN(error_num);
- filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_update(
- const TABLE *table,
- my_ptrdiff_t ptr_diff,
- int link_idx
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.update_sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::append_update");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->length() > 0)
- {
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
-
- if (
- (error_num = append_update(str, link_idx)) ||
- (error_num = append_update_set(str)) ||
- (error_num = append_update_where(str, table, ptr_diff))
- )
- DBUG_RETURN(error_num);
-
- if (
- spider->pk_update &&
- share->link_statuses[link_idx] == SPIDER_LINK_STATUS_RECOVERY
- ) {
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- if ((error_num = append_insert_for_recovery(
- SPIDER_SQL_TYPE_UPDATE_SQL, link_idx)))
- DBUG_RETURN(error_num);
- }
-
- if (!filled_up)
- filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_delete(
- const TABLE *table,
- my_ptrdiff_t ptr_diff
-) {
- int error_num;
- spider_string *str = &update_sql;
- DBUG_ENTER("spider_oracle_handler::append_delete");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->length() > 0)
- {
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
-
- if (
- (error_num = append_delete(str)) ||
- (error_num = append_from(str, SPIDER_SQL_TYPE_DELETE_SQL,
- first_link_idx)) ||
- (error_num = append_update_where(str, table, ptr_diff))
- )
- DBUG_RETURN(error_num);
- filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_delete(
- const TABLE *table,
- my_ptrdiff_t ptr_diff,
- int link_idx
-) {
- int error_num;
- spider_string *str = &spider->result_list.update_sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::append_delete");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->length() > 0)
- {
- if (str->reserve(SPIDER_SQL_SEMICOLON_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SEMICOLON_STR, SPIDER_SQL_SEMICOLON_LEN);
- }
-
- if (
- (error_num = append_delete(str)) ||
- (error_num = append_from(str, SPIDER_SQL_TYPE_DELETE_SQL, link_idx)) ||
- (error_num = append_update_where(str, table, ptr_diff))
- )
- DBUG_RETURN(error_num);
- if (!filled_up)
- filled_up = (str->length() >= (uint) spider->result_list.bulk_update_size);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_insert_part()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_insert_part");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = append_insert(&insert_sql, 0);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_insert(
- spider_string *str,
- int link_idx
-) {
- DBUG_ENTER("spider_oracle_handler::append_insert");
- if (str->reserve(SPIDER_SQL_INSERT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_update_part()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_update_part");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = append_update(&update_sql, 0);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_update(
- spider_string *str,
- int link_idx
-) {
- DBUG_ENTER("spider_oracle_handler::append_update");
- if (str->reserve(SPIDER_SQL_UPDATE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_UPDATE_STR, SPIDER_SQL_UPDATE_LEN);
- if (str->reserve(oracle_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- table_name_pos = str->length();
- append_table_name_with_adjusting(str, link_idx, SPIDER_SQL_TYPE_UPDATE_SQL);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_delete_part()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_delete_part");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = append_delete(&update_sql);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_delete(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_delete");
- if (str->reserve(SPIDER_SQL_DELETE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_DELETE_STR, SPIDER_SQL_DELETE_LEN);
- str->length(str->length() - 1);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_update_set_part()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_update_set_part");
- DBUG_PRINT("info",("spider this=%p", this));
- update_set_pos = update_sql.length();
- error_num = append_update_set(&update_sql);
- where_pos = update_sql.length();
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_update_set(
- spider_string *str
-) {
- uint field_name_length;
- SPIDER_SHARE *share = spider->share;
- TABLE *table = spider->get_table();
- Field **fields;
- DBUG_ENTER("spider_oracle_handler::append_update_set");
- if (str->reserve(SPIDER_SQL_SET_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN);
- for (fields = table->field; *fields; fields++)
- {
- if (bitmap_is_set(table->write_set, (*fields)->field_index))
- {
- field_name_length =
- oracle_share->column_name_str[(*fields)->field_index].length();
- if ((*fields)->is_null())
- {
- if (str->reserve(field_name_length + /* SPIDER_SQL_NAME_QUOTE_LEN */
- 2 + SPIDER_SQL_EQUAL_LEN + SPIDER_SQL_NULL_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*fields)->field_index);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
- } else {
- if (str->reserve(field_name_length + /* SPIDER_SQL_NAME_QUOTE_LEN */
- 2 + SPIDER_SQL_EQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*fields)->field_index);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
-#ifndef DBUG_OFF
- my_bitmap_map *tmp_map = dbug_tmp_use_all_columns(table,
- table->read_set);
-#endif
- if (
- spider_db_oracle_utility.
- append_column_value(spider, str, *fields, NULL,
- share->access_charset) ||
- str->reserve(SPIDER_SQL_COMMA_LEN)
- ) {
-#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
-#endif
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
-#endif
- }
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
-int spider_oracle_handler::append_direct_update_set_part()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_direct_update_set_part");
- DBUG_PRINT("info",("spider this=%p", this));
- update_set_pos = update_sql.length();
- error_num = append_direct_update_set(&update_sql);
- where_pos = update_sql.length();
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_direct_update_set(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_direct_update_set");
- if (
- spider->direct_update_kinds == SPIDER_SQL_KIND_SQL &&
- spider->wide_handler->direct_update_fields
- ) {
- if (str->reserve(SPIDER_SQL_SET_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SET_STR, SPIDER_SQL_SET_LEN);
- DBUG_RETURN(append_update_columns(str, NULL, 0));
- }
-
- if (
- (spider->direct_update_kinds & SPIDER_SQL_KIND_SQL)
- ) {
- DBUG_ASSERT(0);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_dup_update_pushdown_part(
- const char *alias,
- uint alias_length
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_dup_update_pushdown_part");
- DBUG_PRINT("info",("spider this=%p", this));
- dup_update_sql.length(0);
- error_num = append_update_columns(&dup_update_sql, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_update_columns_part(
- const char *alias,
- uint alias_length
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_update_columns_part");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = append_update_columns(&update_sql, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::check_update_columns_part()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::check_update_columns_part");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = append_update_columns(NULL, NULL, 0);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_update_columns(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- List_iterator_fast<Item> fi(*spider->wide_handler->direct_update_fields),
- vi(*spider->wide_handler->direct_update_values);
- Item *field, *value;
- DBUG_ENTER("spider_oracle_handler::append_update_columns");
- while ((field = fi++))
- {
- value = vi++;
- if ((error_num = spider_db_print_item_type(
- (Item *) field, NULL, spider, str, alias, alias_length,
- spider_dbton_oracle.dbton_id, FALSE, NULL)))
- {
- if (
- error_num == ER_SPIDER_COND_SKIP_NUM &&
- field->type() == Item::FIELD_ITEM &&
- ((Item_field *) field)->field
- )
- continue;
- DBUG_RETURN(error_num);
- }
- if (str)
- {
- if (str->reserve(SPIDER_SQL_EQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- }
- if ((error_num = spider_db_print_item_type(
- (Item *) value, ((Item_field *) field)->field, spider, str,
- alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
- DBUG_RETURN(error_num);
- if (str)
- {
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- if (str)
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-/*
- error_num = spider_db_append_update_columns(spider, str,
- alias, alias_length, spider_dbton_oracle.dbton_id);
- DBUG_RETURN(error_num);
-*/
-}
-#endif
-
-int spider_oracle_handler::append_select_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_select(str, sql_type);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_select(
- spider_string *str,
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::append_select");
- if (sql_type == SPIDER_SQL_TYPE_HANDLER)
- {
- if (str->reserve(SPIDER_SQL_HANDLER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_HANDLER_STR, SPIDER_SQL_HANDLER_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_SELECT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN);
- if (spider->result_list.direct_distinct)
- {
- if (str->reserve(SPIDER_SQL_DISTINCT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_DISTINCT_STR, SPIDER_SQL_DISTINCT_LEN);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_table_select_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_table_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_table_select(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_table_select(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_table_select");
- table_name_pos = str->length() + oracle_share->table_select_pos;
- if (str->append(*(oracle_share->table_select)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_select_part(
- ulong sql_type,
- uint idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_key_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_select(str, idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_select(
- spider_string *str,
- uint idx
-) {
- DBUG_ENTER("spider_oracle_handler::append_key_select");
- table_name_pos = str->length() + oracle_share->key_select_pos[idx];
- if (str->append(oracle_share->key_select[idx]))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_minimum_select_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_minimum_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_minimum_select(str, sql_type);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_minimum_select(
- spider_string *str,
- ulong sql_type
-) {
- TABLE *table = spider->get_table();
- Field **field;
- int field_length;
- bool appended = FALSE;
- DBUG_ENTER("spider_oracle_handler::append_minimum_select");
- minimum_select_bitmap_create();
- for (field = table->field; *field; field++)
- {
- if (minimum_select_bit_is_set((*field)->field_index))
- {
-/*
- spider_set_bit(minimum_select_bitmap, (*field)->field_index);
-*/
- field_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if (str->reserve(field_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- appended = TRUE;
- }
- }
- if (appended)
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- else {
- if (str->reserve(SPIDER_SQL_ONE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ONE_STR, SPIDER_SQL_ONE_LEN);
- }
- DBUG_RETURN(append_from(str, sql_type, first_link_idx));
-}
-
-int spider_oracle_handler::append_table_select_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- TABLE *table = spider->get_table();
- Field **field;
- int field_length;
- DBUG_ENTER("spider_oracle_handler::append_table_select_with_alias");
- for (field = table->field; *field; field++)
- {
- field_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if (str->reserve(alias_length + field_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_select_with_alias(
- spider_string *str,
- const KEY *key_info,
- const char *alias,
- uint alias_length
-) {
- KEY_PART_INFO *key_part;
- Field *field;
- uint part_num;
- int field_length;
- DBUG_ENTER("spider_oracle_handler::append_key_select_with_alias");
- for (key_part = key_info->key_part, part_num = 0;
- part_num < spider_user_defined_key_parts(key_info); key_part++, part_num++)
- {
- field = key_part->field;
- field_length = oracle_share->column_name_str[field->field_index].length();
- if (str->reserve(alias_length + field_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_minimum_select_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- TABLE *table = spider->get_table();
- Field **field;
- int field_length;
- bool appended = FALSE;
- DBUG_ENTER("spider_oracle_handler::append_minimum_select_with_alias");
- minimum_select_bitmap_create();
- for (field = table->field; *field; field++)
- {
- if (minimum_select_bit_is_set((*field)->field_index))
- {
-/*
- spider_set_bit(minimum_select_bitmap, (*field)->field_index);
-*/
- field_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if (str->reserve(alias_length + field_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- appended = TRUE;
- }
- }
- if (appended)
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- else {
- if (str->reserve(SPIDER_SQL_ONE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ONE_STR, SPIDER_SQL_ONE_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_select_columns_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- DBUG_ENTER("spider_oracle_handler::append_select_columns_with_alias");
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- if (
- result_list->direct_aggregate &&
- (error_num = append_sum_select(str, alias, alias_length))
- )
- DBUG_RETURN(error_num);
-#endif
- if ((error_num = append_match_select(str, alias, alias_length)))
- DBUG_RETURN(error_num);
- if (!spider->select_column_mode)
- {
- if (result_list->keyread)
- DBUG_RETURN(append_key_select_with_alias(
- str, result_list->key_info, alias, alias_length));
- else
- DBUG_RETURN(append_table_select_with_alias(
- str, alias, alias_length));
- }
- DBUG_RETURN(append_minimum_select_with_alias(str, alias, alias_length));
-}
-
-int spider_oracle_handler::append_hint_after_table_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_hint_after_table_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_hint_after_table(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_hint_after_table(
- spider_string *str
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_hint_after_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (
- oracle_share->key_hint &&
- (error_num = spider_db_append_hint_after_table(spider,
- str, &oracle_share->key_hint[spider->active_index]))
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- DBUG_RETURN(0);
-}
-
-void spider_oracle_handler::set_where_pos(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::set_where_pos");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- where_pos = sql.length();
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- where_pos = update_sql.length();
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- ha_read_pos = ha_sql.length();
- break;
- default:
- break;
- }
- DBUG_VOID_RETURN;
-}
-
-void spider_oracle_handler::set_where_to_pos(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::set_where_to_pos");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- sql.length(where_pos);
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- update_sql.length(where_pos);
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- ha_sql.length(ha_read_pos);
- break;
- default:
- break;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_handler::check_item_type(
- Item *item
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::check_item_type");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = spider_db_print_item_type(item, NULL, spider, NULL, NULL, 0,
- spider_dbton_oracle.dbton_id, FALSE, NULL);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_values_connector_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_values_connector_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_values_connector(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_values_connector(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_values_connector");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN +
- SPIDER_SQL_COMMA_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_values_terminator_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_values_terminator_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_values_terminator(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_values_terminator(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_values_terminator");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(str->length() -
- SPIDER_SQL_COMMA_LEN - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_union_table_connector_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_union_table_connector_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_union_table_connector(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_union_table_connector(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_union_table_connector");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve((SPIDER_SQL_SPACE_LEN * 2) + SPIDER_SQL_UNION_ALL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(SPIDER_SQL_UNION_ALL_STR, SPIDER_SQL_UNION_ALL_LEN);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_union_table_terminator_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_union_table_terminator_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_union_table_terminator(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_union_table_terminator(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_union_table_terminator");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(str->length() -
- ((SPIDER_SQL_SPACE_LEN * 2) + SPIDER_SQL_UNION_ALL_LEN));
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- table_name_pos = str->length() + SPIDER_SQL_SPACE_LEN + SPIDER_SQL_A_LEN +
- SPIDER_SQL_COMMA_LEN;
- if (str->reserve(tmp_sql.length() - SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(tmp_sql.ptr() + SPIDER_SQL_FROM_LEN,
- tmp_sql.length() - SPIDER_SQL_FROM_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_column_values_part(
- const key_range *start_key,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_key_column_values_part");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_column_values(str, start_key);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_column_values(
- spider_string *str,
- const key_range *start_key
-) {
- int error_num;
- const uchar *ptr;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- SPIDER_SHARE *share = spider->share;
- KEY *key_info = result_list->key_info;
- uint length;
- uint store_length;
- key_part_map full_key_part_map =
- make_prev_keypart_map(spider_user_defined_key_parts(key_info));
- key_part_map start_key_part_map;
- KEY_PART_INFO *key_part;
- Field *field;
- DBUG_ENTER("spider_oracle_handler::append_key_column_values");
- start_key_part_map = start_key->keypart_map & full_key_part_map;
- DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u",
- spider_user_defined_key_parts(key_info)));
- DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
- DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
-
- if (!start_key_part_map)
- DBUG_RETURN(0);
-
- for (
- key_part = key_info->key_part,
- length = 0;
- start_key_part_map;
- start_key_part_map >>= 1,
- key_part++,
- length += store_length
- ) {
- store_length = key_part->store_length;
- ptr = start_key->key + length;
- field = key_part->field;
- if ((error_num = spider_db_append_null_value(str, key_part, &ptr)))
- {
- if (error_num > 0)
- DBUG_RETURN(error_num);
- } else {
- if (spider_db_oracle_utility.append_column_value(spider, str, field, ptr,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_column_values_with_name_part(
- const key_range *start_key,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_key_column_values_with_name_part");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_column_values_with_name(str, start_key);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_column_values_with_name(
- spider_string *str,
- const key_range *start_key
-) {
- int error_num;
- const uchar *ptr;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- SPIDER_SHARE *share = spider->share;
- KEY *key_info = result_list->key_info;
- uint length;
- uint key_name_length, key_count;
- uint store_length;
- key_part_map full_key_part_map =
- make_prev_keypart_map(spider_user_defined_key_parts(key_info));
- key_part_map start_key_part_map;
- KEY_PART_INFO *key_part;
- Field *field;
- char tmp_buf[MAX_FIELD_WIDTH];
- DBUG_ENTER("spider_oracle_handler::append_key_column_values_with_name");
- start_key_part_map = start_key->keypart_map & full_key_part_map;
- DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u",
- spider_user_defined_key_parts(key_info)));
- DBUG_PRINT("info", ("spider full_key_part_map=%lu", full_key_part_map));
- DBUG_PRINT("info", ("spider start_key_part_map=%lu", start_key_part_map));
-
- if (!start_key_part_map)
- DBUG_RETURN(0);
-
- for (
- key_part = key_info->key_part,
- length = 0,
- key_count = 0;
- start_key_part_map;
- start_key_part_map >>= 1,
- key_part++,
- length += store_length,
- key_count++
- ) {
- store_length = key_part->store_length;
- ptr = start_key->key + length;
- field = key_part->field;
- if ((error_num = spider_db_append_null_value(str, key_part, &ptr)))
- {
- if (error_num > 0)
- DBUG_RETURN(error_num);
- } else {
- if (spider_db_oracle_utility.append_column_value(spider, str, field, ptr,
- share->access_charset))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
-
- key_name_length = my_sprintf(tmp_buf, (tmp_buf, "c%u", key_count));
- if (str->reserve(SPIDER_SQL_SPACE_LEN + key_name_length +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(tmp_buf, key_name_length);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_where_part(
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type
-) {
- int error_num;
- spider_string *str, *str_part = NULL, *str_part2 = NULL;
- bool set_order;
- DBUG_ENTER("spider_oracle_handler::append_key_where_part");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- set_order = FALSE;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- set_order = FALSE;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- set_order = FALSE;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- ha_read_pos = str->length();
- str_part = &sql_part;
- str_part2 = &sql_part2;
- str_part->length(0);
- str_part2->length(0);
- set_order = TRUE;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_where(str, str_part, str_part2, start_key, end_key,
- sql_type, set_order);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_where(
- spider_string *str,
- spider_string *str_part,
- spider_string *str_part2,
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type,
- bool set_order
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_key_where");
- error_num = spider_db_append_key_where_internal(str, str_part, str_part2,
- start_key, end_key, spider, set_order, sql_type,
- spider_dbton_oracle.dbton_id);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_is_null_part(
- ulong sql_type,
- KEY_PART_INFO *key_part,
- const key_range *key,
- const uchar **ptr,
- bool key_eq,
- bool tgt_final
-) {
- int error_num;
- spider_string *str, *str_part = NULL, *str_part2 = NULL;
- DBUG_ENTER("spider_oracle_handler::append_is_null_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- str_part = &sql_part;
- str_part2 = &sql_part2;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_is_null(sql_type, str, str_part, str_part2,
- key_part, key, ptr, key_eq, tgt_final);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_is_null(
- ulong sql_type,
- spider_string *str,
- spider_string *str_part,
- spider_string *str_part2,
- KEY_PART_INFO *key_part,
- const key_range *key,
- const uchar **ptr,
- bool key_eq,
- bool tgt_final
-) {
- DBUG_ENTER("spider_oracle_handler::append_is_null");
- DBUG_PRINT("info",("spider this=%p", this));
- if (key_part->null_bit)
- {
- if (*(*ptr)++)
- {
- if (sql_type == SPIDER_SQL_TYPE_HANDLER)
- {
- str = str_part;
- if (
- key_eq ||
- key->flag == HA_READ_KEY_EXACT ||
- key->flag == HA_READ_KEY_OR_NEXT
- ) {
- if (str->reserve(SPIDER_SQL_IS_NULL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
- } else {
- str->length(str->length() - SPIDER_SQL_OPEN_PAREN_LEN);
- ha_next_pos = str->length();
- if (str->reserve(SPIDER_SQL_FIRST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN);
- spider->result_list.ha_read_kind = 1;
- }
- str = str_part2;
- }
- if (
- key_eq ||
- key->flag == HA_READ_KEY_EXACT ||
- key->flag == HA_READ_KEY_OR_NEXT
- ) {
- if (str->reserve(SPIDER_SQL_IS_NULL_LEN +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- oracle_share->column_name_str[key_part->field->field_index].length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, key_part->field->field_index);
- str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_IS_NOT_NULL_LEN +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- oracle_share->column_name_str[key_part->field->field_index].length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, key_part->field->field_index);
- str->q_append(SPIDER_SQL_IS_NOT_NULL_STR, SPIDER_SQL_IS_NOT_NULL_LEN);
- }
- DBUG_RETURN(-1);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_where_terminator_part(
- ulong sql_type,
- bool set_order,
- int key_count
-) {
- int error_num;
- spider_string *str, *str_part = NULL, *str_part2 = NULL;
- DBUG_ENTER("spider_oracle_handler::append_where_terminator_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- str_part = &sql_part;
- str_part2 = &sql_part2;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_where_terminator(sql_type, str, str_part, str_part2,
- set_order, key_count);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_where_terminator(
- ulong sql_type,
- spider_string *str,
- spider_string *str_part,
- spider_string *str_part2,
- bool set_order,
- int key_count
-) {
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- DBUG_ENTER("spider_oracle_handler::append_where_terminator");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql_type != SPIDER_SQL_TYPE_HANDLER)
- {
- str->length(str->length() - SPIDER_SQL_AND_LEN);
- if (!set_order)
- result_list->key_order = key_count;
- } else {
- str_part2->length(str_part2->length() - SPIDER_SQL_AND_LEN);
-
- str_part->length(str_part->length() - SPIDER_SQL_COMMA_LEN);
- if (!result_list->ha_read_kind)
- str_part->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- if (str->append(*str_part))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- uint clause_length = str->length() - ha_next_pos;
- if (clause_length < SPIDER_SQL_NEXT_LEN)
- {
- int roop_count;
- clause_length = SPIDER_SQL_NEXT_LEN - clause_length;
- if (str->reserve(clause_length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- for (roop_count = 0; roop_count < (int) clause_length; roop_count++)
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_match_where_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_match_where_part");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_ASSERT(0);
- DBUG_RETURN(0);
- }
- error_num = append_match_where(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_match_where(
- spider_string *str
-) {
- int error_num;
- bool first = TRUE;
- st_spider_ft_info *ft_info = spider->ft_first;
- DBUG_ENTER("spider_oracle_handler::append_match_where");
- if (spider->ft_current)
- {
- while (TRUE)
- {
- if (ft_info->used_in_where)
- {
- if (first)
- {
- if (str->reserve(SPIDER_SQL_WHERE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- first = FALSE;
- }
- if ((error_num = append_match_against(str, ft_info, NULL, 0)))
- DBUG_RETURN(error_num);
- if (str->reserve(SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- }
-
- if (ft_info == spider->ft_current)
- break;
- ft_info = ft_info->next;
- }
- if (!first)
- str->length(str->length() - SPIDER_SQL_AND_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_update_where(
- spider_string *str,
- const TABLE *table,
- my_ptrdiff_t ptr_diff
-) {
- uint field_name_length;
- Field **field;
- THD *thd = spider->wide_handler->trx->thd;
- SPIDER_SHARE *share = spider->share;
- bool no_pk = (table->s->primary_key == MAX_KEY);
- DBUG_ENTER("spider_oracle_handler::append_update_where");
- uint str_len_bakup = str->length();
- if (str->reserve(SPIDER_SQL_WHERE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- if (
- no_pk ||
- spider_param_use_cond_other_than_pk_for_update(thd)
- ) {
- for (field = table->field; *field; field++)
- {
- if (
- no_pk ||
- bitmap_is_set(table->read_set, (*field)->field_index)
- ) {
- field_name_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if ((*field)->is_null(ptr_diff))
- {
- if (str->reserve(field_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
- } else {
- if (str->reserve(field_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_EQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- (*field)->move_field_offset(ptr_diff);
- if (
- spider_db_oracle_utility.
- append_column_value(spider, str, *field, NULL,
- share->access_charset) ||
- str->reserve(SPIDER_SQL_AND_LEN)
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- (*field)->move_field_offset(-ptr_diff);
- }
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- }
- }
- } else {
- KEY *key_info = &table->key_info[table->s->primary_key];
- KEY_PART_INFO *key_part;
- uint part_num;
- for (
- key_part = key_info->key_part, part_num = 0;
- part_num < spider_user_defined_key_parts(key_info);
- key_part++, part_num++
- ) {
- field = &key_part->field;
- field_name_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if ((*field)->is_null(ptr_diff))
- {
- if (str->reserve(field_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_IS_NULL_LEN + SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_IS_NULL_STR, SPIDER_SQL_IS_NULL_LEN);
- } else {
- if (str->reserve(field_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_EQUAL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN);
- (*field)->move_field_offset(ptr_diff);
- if (
- spider_db_oracle_utility.
- append_column_value(spider, str, *field, NULL,
- share->access_charset) ||
- str->reserve(SPIDER_SQL_AND_LEN)
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- (*field)->move_field_offset(-ptr_diff);
- }
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- }
- }
- if (str->length() == str_len_bakup + SPIDER_SQL_WHERE_LEN)
- {
- /* no condition */
- str->length(str_len_bakup);
- } else {
- str->length(str->length() - SPIDER_SQL_AND_LEN);
- }
- if (str->reserve(SPIDER_SQL_LIMIT1_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LIMIT1_STR, SPIDER_SQL_LIMIT1_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_condition_part(
- const char *alias,
- uint alias_length,
- ulong sql_type,
- bool test_flg
-) {
- int error_num;
- spider_string *str;
- bool start_where = FALSE;
- DBUG_ENTER("spider_oracle_handler::append_condition_part");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- DBUG_PRINT("info",("spider case1 sql_type=%lu", sql_type));
- if (test_flg)
- {
- str = NULL;
- } else {
- str = &sql;
- start_where = ((int) str->length() == where_pos);
- }
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- DBUG_PRINT("info",("spider case1 sql_type=%lu", sql_type));
- if (test_flg)
- {
- str = NULL;
- } else {
- str = &tmp_sql;
- start_where = ((int) str->length() == where_pos);
- }
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- DBUG_PRINT("info",("spider case2 sql_type=%lu", sql_type));
- if (test_flg)
- {
- str = NULL;
- } else {
- str = &update_sql;
- start_where = ((int) str->length() == where_pos);
- }
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- DBUG_PRINT("info",("spider case3 sql_type=%lu", sql_type));
- if (test_flg)
- {
- str = NULL;
- } else {
- str = &ha_sql;
- start_where = TRUE;
- if (spider->active_index == MAX_KEY)
- {
- set_where_pos(SPIDER_SQL_TYPE_HANDLER);
- if (str->reserve(SPIDER_SQL_READ_LEN + SPIDER_SQL_FIRST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_READ_STR, SPIDER_SQL_READ_LEN);
- ha_next_pos = str->length();
- str->q_append(SPIDER_SQL_FIRST_STR, SPIDER_SQL_FIRST_LEN);
- sql_part2.length(0);
- }
- ha_where_pos = str->length();
-
- if (sql_part2.length())
- {
- str->append(sql_part2);
- start_where = FALSE;
- }
- }
- break;
- default:
- DBUG_PRINT("info",("spider default sql_type=%lu", sql_type));
- DBUG_RETURN(0);
- }
- error_num = append_condition(str, alias, alias_length, start_where,
- sql_type);
- DBUG_PRINT("info",("spider str=%s", str ? str->c_ptr_safe() : "NULL"));
- DBUG_PRINT("info",("spider length=%u", str ? str->length() : 0));
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_condition(
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool start_where,
- ulong sql_type
-) {
- int error_num, restart_pos = 0, start_where_pos;
- SPIDER_CONDITION *tmp_cond = spider->condition;
- DBUG_ENTER("spider_oracle_handler::append_condition");
- DBUG_PRINT("info",("spider str=%p", str));
- DBUG_PRINT("info",("spider alias=%p", alias));
- DBUG_PRINT("info",("spider alias_length=%u", alias_length));
- DBUG_PRINT("info",("spider start_where=%s", start_where ? "TRUE" : "FALSE"));
- DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
- if (str && start_where)
- {
- start_where_pos = str->length();
- } else {
- start_where_pos = 0;
- }
-
- if (spider->is_clone && !tmp_cond)
- {
- tmp_cond = spider->pt_clone_source_handler->condition;
- }
-
- while (tmp_cond)
- {
- if (str)
- {
- restart_pos = str->length();
- if (start_where)
- {
- if (str->reserve(SPIDER_SQL_WHERE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- start_where = FALSE;
- } else {
- if (str->reserve(SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- }
- }
- if ((error_num = spider_db_print_item_type(
- (Item *) tmp_cond->cond, NULL, spider, str, alias, alias_length,
- spider_dbton_oracle.dbton_id, FALSE, NULL)))
- {
- if (str && error_num == ER_SPIDER_COND_SKIP_NUM)
- {
- DBUG_PRINT("info",("spider COND skip"));
- str->length(restart_pos);
- start_where = (restart_pos == start_where_pos);
- } else
- DBUG_RETURN(error_num);
- }
- tmp_cond = tmp_cond->next;
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_match_against_part(
- ulong sql_type,
- st_spider_ft_info *ft_info,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_match_against_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_match_against(str, ft_info, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_match_against(
- spider_string *str,
- st_spider_ft_info *ft_info,
- const char *alias,
- uint alias_length
-) {
- SPIDER_SHARE *share = spider->share;
- TABLE *table = spider->get_table();
- String *ft_init_key;
- KEY *key_info;
- uint key_name_length;
- int key_count;
- KEY_PART_INFO *key_part;
- Field *field;
- DBUG_ENTER("spider_oracle_handler::append_match_against");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_MATCH_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_MATCH_STR, SPIDER_SQL_MATCH_LEN);
-
- ft_init_key = ft_info->key;
- key_info = &table->key_info[ft_info->inx];
- DBUG_PRINT("info", ("spider spider_user_defined_key_parts=%u",
- spider_user_defined_key_parts(key_info)));
-
- for (
- key_part = key_info->key_part,
- key_count = 0;
- key_count < (int) spider_user_defined_key_parts(key_info);
- key_part++,
- key_count++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (alias_length)
- {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- } else {
- if (str->reserve(key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- if (str->reserve(SPIDER_SQL_AGAINST_LEN + SPIDER_SQL_VALUE_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_AGAINST_STR, SPIDER_SQL_AGAINST_LEN);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
-
- char buf[MAX_FIELD_WIDTH];
- spider_string tmp_str(buf, MAX_FIELD_WIDTH, share->access_charset);
- tmp_str.init_calc_mem(211);
- tmp_str.length(0);
- if (
- tmp_str.append(ft_init_key->ptr(), ft_init_key->length(),
- ft_init_key->charset()) ||
- str->reserve(tmp_str.length() * 2) ||
- spider_db_oracle_utility.append_escaped_util(str, tmp_str.get_str())
- )
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
-
- if (str->reserve(
- SPIDER_SQL_VALUE_QUOTE_LEN + SPIDER_SQL_CLOSE_PAREN_LEN +
- ((ft_info->match_flags & FT_BOOL) ? SPIDER_SQL_IN_BOOLEAN_MODE_LEN : 0) +
- ((ft_info->match_flags & FT_EXPAND) ?
- SPIDER_SQL_WITH_QUERY_EXPANSION_LEN : 0)
- ))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
- if (ft_info->match_flags & FT_BOOL)
- str->q_append(SPIDER_SQL_IN_BOOLEAN_MODE_STR,
- SPIDER_SQL_IN_BOOLEAN_MODE_LEN);
- if (ft_info->match_flags & FT_EXPAND)
- str->q_append(SPIDER_SQL_WITH_QUERY_EXPANSION_STR,
- SPIDER_SQL_WITH_QUERY_EXPANSION_LEN);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_match_select_part(
- ulong sql_type,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_match_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_match_select(str, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_match_select(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_match_select");
- DBUG_PRINT("info",("spider this=%p", this));
- if (spider->ft_current)
- {
- st_spider_ft_info *ft_info = spider->ft_first;
- while (TRUE)
- {
- if ((error_num = append_match_against(str, ft_info,
- alias, alias_length)))
- DBUG_RETURN(error_num);
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- if (ft_info == spider->ft_current)
- break;
- ft_info = ft_info->next;
- }
- }
- DBUG_RETURN(0);
-}
-
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
-int spider_oracle_handler::append_sum_select_part(
- ulong sql_type,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_sum_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_sum_select(str, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_sum_select(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- st_select_lex *select_lex;
- DBUG_ENTER("spider_oracle_handler::append_sum_select");
- DBUG_PRINT("info",("spider this=%p", this));
- select_lex = spider_get_select_lex(spider);
- JOIN *join = select_lex->join;
- Item_sum **item_sum_ptr;
- for (item_sum_ptr = join->sum_funcs; *item_sum_ptr; ++item_sum_ptr)
- {
- if ((error_num = spider_db_oracle_utility.open_item_sum_func(*item_sum_ptr,
- spider, str, alias, alias_length, FALSE, NULL)))
- {
- DBUG_RETURN(error_num);
- }
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-#endif
-
-void spider_oracle_handler::set_order_pos(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::set_order_pos");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- order_pos = sql.length();
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- order_pos = update_sql.length();
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- ha_next_pos = ha_sql.length();
- break;
- default:
- DBUG_ASSERT(0);
- break;
- }
- DBUG_VOID_RETURN;
-}
-
-void spider_oracle_handler::set_order_to_pos(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::set_order_to_pos");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- sql.length(order_pos);
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- update_sql.length(order_pos);
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- ha_sql.length(ha_next_pos);
- break;
- default:
- DBUG_ASSERT(0);
- break;
- }
- DBUG_VOID_RETURN;
-}
-
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
-int spider_oracle_handler::append_group_by_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_group_by_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_group_by(str, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_group_by(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- st_select_lex *select_lex;
- DBUG_ENTER("spider_oracle_handler::append_group_by");
- DBUG_PRINT("info",("spider this=%p", this));
- select_lex = spider_get_select_lex(spider);
- ORDER *group = (ORDER *) select_lex->group_list.first;
- if (group)
- {
- if (str->reserve(SPIDER_SQL_GROUP_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
- for (; group; group = group->next)
- {
- if ((error_num = spider_db_print_item_type((*group->item), NULL, spider,
- str, alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
- {
- DBUG_RETURN(error_num);
- }
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-#endif
-
-int spider_oracle_handler::append_key_order_for_merge_with_alias_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- ha_limit_pos = ha_sql.length();
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_order_for_merge_with_alias(str, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_order_for_merge_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- /* sort for index merge */
- TABLE *table = spider->get_table();
- int length;
- Field *field;
- uint key_name_length;
- DBUG_ENTER("spider_oracle_handler::append_key_order_for_merge_with_alias");
- DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- if (spider->result_list.direct_aggregate)
- {
- int error_num;
- if ((error_num = append_group_by(str, alias, alias_length)))
- DBUG_RETURN(error_num);
- }
-#endif
- if (
- spider->result_list.direct_order_limit ||
- spider->result_list.internal_limit < 9223372036854775807LL ||
- spider->result_list.split_read < 9223372036854775807LL ||
- spider->result_list.internal_offset
- ) {
- if (update_rownum_appended || select_rownum_appended)
- {
- if (str->reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- order_pos = str->length();
- limit_pos = str->length();
- DBUG_RETURN(0);
- }
- sql_part.length(0);
- if (str == &update_sql)
- {
- if (sql_part.reserve(str->length() + SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(str->ptr(), where_pos);
- sql_part.q_append(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR,
- SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN);
- } else {
- if (sql_part.reserve(str->length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN +
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR,
- SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN);
- sql_part.q_append(str->ptr(), table_name_pos - SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR,
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN);
- }
- if (table->s->primary_key < MAX_KEY)
- {
- /* sort by primary key */
- KEY *key_info = &table->key_info[table->s->primary_key];
- KEY_PART_INFO *key_part;
- for (
- key_part = key_info->key_part,
- length = 1;
- length <= (int) spider_user_defined_key_parts(key_info);
- key_part++,
- length++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (sql_part.reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(alias, alias_length);
- oracle_share->append_column_name(&sql_part, field->field_index);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- } else {
- /* sort by all columns */
- Field **fieldp;
- for (
- fieldp = table->field, length = 1;
- *fieldp;
- fieldp++, length++
- ) {
- key_name_length =
- oracle_share->column_name_str[(*fieldp)->field_index].length();
- if (sql_part.reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(alias, alias_length);
- oracle_share->append_column_name(&sql_part, (*fieldp)->field_index);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- uint pos_diff;
- if (str == &update_sql)
- {
- uint table_name_size = (update_set_pos ? update_set_pos : where_pos) -
- table_name_pos;
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos +
- SPIDER_SQL_FROM_LEN + table_name_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- sql_part.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- sql_part.q_append(str->ptr() + table_name_pos, table_name_size);
- pos_diff = sql_part.length() - where_pos;
- sql_part.q_append(str->ptr() + where_pos, str->length() - where_pos);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- update_rownum_appended = TRUE;
- } else {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos;
- sql_part.q_append(str->ptr() + table_name_pos - SPIDER_SQL_FROM_LEN,
- str->length() - table_name_pos + SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- select_rownum_appended = TRUE;
- table_name_pos = table_name_pos + pos_diff;
- }
- if (str->copy(sql_part))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- where_pos = where_pos + pos_diff;
- order_pos = str->length();
- limit_pos = str->length();
- DBUG_RETURN(0);
- }
- if (table->s->primary_key < MAX_KEY)
- {
- /* sort by primary key */
- KEY *key_info = &table->key_info[table->s->primary_key];
- KEY_PART_INFO *key_part;
- for (
- key_part = key_info->key_part,
- length = 1;
- length <= (int) spider_user_defined_key_parts(key_info);
- key_part++,
- length++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (length == 1)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- }
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if (length > 1)
- {
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- } else {
- /* sort by all columns */
- Field **fieldp;
- for (
- fieldp = table->field, length = 1;
- *fieldp;
- fieldp++, length++
- ) {
- key_name_length =
- oracle_share->column_name_str[(*fieldp)->field_index].length();
- if (length == 1)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- }
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, (*fieldp)->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if (length > 1)
- {
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- }
- limit_pos = str->length();
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_order_for_direct_order_limit_with_alias(
- str, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- int error_num;
- ORDER *order;
- st_select_lex *select_lex;
- longlong select_limit;
- longlong offset_limit;
- DBUG_ENTER("spider_oracle_handler::append_key_order_for_direct_order_limit_with_alias");
- DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- if (spider->result_list.direct_aggregate)
- {
- if ((error_num = append_group_by(str, alias, alias_length)))
- DBUG_RETURN(error_num);
- }
-#endif
- spider_get_select_limit(spider, &select_lex, &select_limit,
- &offset_limit);
- if (
- spider->result_list.direct_order_limit ||
- spider->result_list.internal_limit < 9223372036854775807LL ||
- spider->result_list.split_read < 9223372036854775807LL ||
- spider->result_list.internal_offset
- ) {
- if (update_rownum_appended || select_rownum_appended)
- {
- if (str->reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- order_pos = str->length();
- limit_pos = str->length();
- DBUG_RETURN(0);
- }
- sql_part.length(0);
- if (str == &update_sql)
- {
- if (sql_part.reserve(str->length() + SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(str->ptr(), where_pos);
- sql_part.q_append(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR,
- SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN);
- } else {
- if (sql_part.reserve(str->length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN +
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR,
- SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN);
- sql_part.q_append(str->ptr(), table_name_pos - SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR,
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN);
- }
- bool all_desc = TRUE;
- if (select_lex->order_list.first)
- {
- for (order = (ORDER *) select_lex->order_list.first; order;
- order = order->next)
- {
- if ((error_num =
- spider_db_print_item_type((*order->item), NULL, spider, &sql_part,
- alias, alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
- {
- DBUG_PRINT("info",("spider error=%d", error_num));
- DBUG_RETURN(error_num);
- }
- if (SPIDER_order_direction_is_asc(order))
- {
- if (sql_part.reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- all_desc = FALSE;
- } else {
- if (sql_part.reserve(SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- } else {
- all_desc = FALSE;
- }
- uint pos_diff;
- if (str == &update_sql)
- {
- uint table_name_size = (update_set_pos ? update_set_pos : where_pos) -
- table_name_pos;
- if (all_desc)
- {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos +
- SPIDER_SQL_FROM_LEN + table_name_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos +
- SPIDER_SQL_FROM_LEN + table_name_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- }
- sql_part.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- sql_part.q_append(str->ptr() + table_name_pos, table_name_size);
- pos_diff = sql_part.length() - where_pos;
- sql_part.q_append(str->ptr() + where_pos, str->length() - where_pos);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- update_rownum_appended = TRUE;
- } else {
- if (all_desc)
- {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- }
- pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos;
- sql_part.q_append(str->ptr() + table_name_pos - SPIDER_SQL_FROM_LEN,
- str->length() - table_name_pos + SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- select_rownum_appended = TRUE;
- table_name_pos = table_name_pos + pos_diff;
- }
- if (str->copy(sql_part))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- where_pos = where_pos + pos_diff;
- order_pos = str->length();
- limit_pos = str->length();
- DBUG_RETURN(0);
- }
- if (select_lex->order_list.first)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- for (order = (ORDER *) select_lex->order_list.first; order;
- order = order->next)
- {
- if ((error_num =
- spider_db_print_item_type((*order->item), NULL, spider, str, alias,
- alias_length, spider_dbton_oracle.dbton_id, FALSE, NULL)))
- {
- DBUG_PRINT("info",("spider error=%d", error_num));
- DBUG_RETURN(error_num);
- }
- if (SPIDER_order_direction_is_asc(order))
- {
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- limit_pos = str->length();
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_order_with_alias_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- error_num = append_key_order_for_handler(str, alias, alias_length);
- DBUG_RETURN(error_num);
- default:
- DBUG_RETURN(0);
- }
- error_num = append_key_order_with_alias(str, alias, alias_length);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_key_order_for_handler(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- DBUG_ENTER("spider_oracle_handler::append_key_order_for_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider ha_next_pos=%d", ha_next_pos));
- DBUG_PRINT("info",("spider ha_where_pos=%d", ha_where_pos));
- str->q_append(alias, alias_length);
- memset((char *) str->ptr() + str->length(), ' ',
- ha_where_pos - ha_next_pos - alias_length);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_key_order_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
-) {
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- KEY *key_info = result_list->key_info;
- int length;
- KEY_PART_INFO *key_part;
- Field *field;
- uint key_name_length;
- DBUG_ENTER("spider_oracle_handler::append_key_order_with_alias");
- DBUG_PRINT("info",("spider this=%p", this));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- if (spider->result_list.direct_aggregate)
- {
- int error_num;
- if ((error_num = append_group_by(str, alias, alias_length)))
- DBUG_RETURN(error_num);
- }
-#endif
- if (
- spider->result_list.direct_order_limit ||
- spider->result_list.internal_limit < 9223372036854775807LL ||
- spider->result_list.split_read < 9223372036854775807LL ||
- spider->result_list.internal_offset
- ) {
- if (update_rownum_appended || select_rownum_appended)
- {
- if (str->reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- order_pos = str->length();
- limit_pos = str->length();
- DBUG_RETURN(0);
- }
- sql_part.length(0);
- if (str == &update_sql)
- {
- if (sql_part.reserve(str->length() + SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(str->ptr(), where_pos);
- sql_part.q_append(SPIDER_SQL_UPDATE_WRAPPER_HEAD_STR,
- SPIDER_SQL_UPDATE_WRAPPER_HEAD_LEN);
- } else {
- if (sql_part.reserve(str->length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN +
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR,
- SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN);
- sql_part.q_append(str->ptr(), table_name_pos - SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR,
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN);
- }
- if (result_list->sorted == TRUE)
- {
- if (result_list->desc_flg == TRUE)
- {
- for (
- key_part = key_info->key_part + result_list->key_order,
- length = 1;
- length + result_list->key_order <=
- (int) spider_user_defined_key_parts(key_info) &&
- length <= result_list->max_order;
- key_part++,
- length++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (sql_part.reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(alias, alias_length);
- oracle_share->append_column_name(&sql_part, field->field_index);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (sql_part.reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(alias, alias_length);
- oracle_share->append_column_name(&sql_part, field->field_index);
- sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- } else {
- for (
- key_part = key_info->key_part + result_list->key_order,
- length = 1;
- length + result_list->key_order <=
- (int) spider_user_defined_key_parts(key_info) &&
- length <= result_list->max_order;
- key_part++,
- length++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (sql_part.reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(alias, alias_length);
- oracle_share->append_column_name(&sql_part, field->field_index);
- sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (sql_part.reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(alias, alias_length);
- oracle_share->append_column_name(&sql_part, field->field_index);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- }
- }
- uint pos_diff;
- if (str == &update_sql)
- {
- uint table_name_size = (update_set_pos ? update_set_pos : where_pos) -
- table_name_pos;
- if (result_list->sorted == TRUE && result_list->desc_flg == TRUE)
- {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos +
- SPIDER_SQL_FROM_LEN + table_name_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - where_pos +
- SPIDER_SQL_FROM_LEN + table_name_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- }
- sql_part.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- sql_part.q_append(str->ptr() + table_name_pos,
- table_name_size);
- pos_diff = sql_part.length() - where_pos;
- sql_part.q_append(str->ptr() + where_pos, str->length() - where_pos);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- update_rownum_appended = TRUE;
- } else {
- if (result_list->sorted == TRUE && result_list->desc_flg == TRUE)
- {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + str->length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- }
- pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos;
- sql_part.q_append(str->ptr() + table_name_pos - SPIDER_SQL_FROM_LEN,
- str->length() - table_name_pos + SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- select_rownum_appended = TRUE;
- table_name_pos = table_name_pos + pos_diff;
- }
- if (str->copy(sql_part))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- where_pos = where_pos + pos_diff;
- order_pos = str->length();
- limit_pos = str->length();
- DBUG_RETURN(0);
- }
- if (result_list->sorted == TRUE)
- {
- if (result_list->desc_flg == TRUE)
- {
- for (
- key_part = key_info->key_part + result_list->key_order,
- length = 1;
- length + result_list->key_order <
- (int) spider_user_defined_key_parts(key_info) &&
- length < result_list->max_order;
- key_part++,
- length++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (length == 1)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- }
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- if (
- length + result_list->key_order <=
- (int) spider_user_defined_key_parts(key_info) &&
- length <= result_list->max_order
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (length == 1)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- }
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- } else {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_DESC_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- }
- }
- } else {
- for (
- key_part = key_info->key_part + result_list->key_order,
- length = 1;
- length + result_list->key_order <
- (int) spider_user_defined_key_parts(key_info) &&
- length < result_list->max_order;
- key_part++,
- length++
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (length == 1)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- }
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- if (
- length + result_list->key_order <=
- (int) spider_user_defined_key_parts(key_info) &&
- length <= result_list->max_order
- ) {
- field = key_part->field;
- key_name_length =
- oracle_share->column_name_str[field->field_index].length();
- if (length == 1)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- }
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_DESC_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- } else {
- if (str->reserve(alias_length + key_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(alias, alias_length);
- oracle_share->append_column_name(str, field->field_index);
- }
- }
- }
- }
- limit_pos = str->length();
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_limit_part(
- longlong offset,
- longlong limit,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_limit_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- limit_pos = str->length();
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- limit_pos = str->length();
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- limit_pos = str->length();
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- ha_limit_pos = str->length();
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_limit(str, offset, limit);
- DBUG_PRINT("info",("spider str=%s", str->c_ptr_safe()));
- DBUG_PRINT("info",("spider length=%u", str->length()));
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::reappend_limit_part(
- longlong offset,
- longlong limit,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::reappend_limit_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- str->length(limit_pos);
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- str->length(limit_pos);
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- str->length(limit_pos);
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- str->length(ha_limit_pos);
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_limit(str, offset, limit);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_limit(
- spider_string *str,
- longlong offset,
- longlong limit
-) {
- char buf[SPIDER_LONGLONG_LEN + 1];
- uint32 length;
- DBUG_ENTER("spider_oracle_handler::append_limit");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info", ("spider offset=%lld", offset));
- DBUG_PRINT("info", ("spider limit=%lld", limit));
- if (offset || limit < 9223372036854775807LL)
- {
- if ((int) str->length() == where_pos)
- {
- if (offset)
- {
- int error_num;
- if ((error_num = append_key_order_for_direct_order_limit_with_alias(
- str, NULL, 0)))
- DBUG_RETURN(error_num);
- } else {
- if (str->reserve(SPIDER_SQL_WHERE_LEN + SPIDER_SQL_ROWNUM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- str->q_append(SPIDER_SQL_ROWNUM_STR, SPIDER_SQL_ROWNUM_LEN);
- }
- }
- if (offset)
- {
- if (str->reserve(SPIDER_SQL_BETWEEN_LEN + SPIDER_SQL_AND_LEN +
- ((SPIDER_LONGLONG_LEN) * 2)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_BETWEEN_STR, SPIDER_SQL_BETWEEN_LEN);
- length = (uint32) (my_charset_bin.longlong10_to_str)(
- buf, SPIDER_LONGLONG_LEN + 1, -10, offset + 1);
- str->q_append(buf, length);
- str->q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- length = (uint32) (my_charset_bin.longlong10_to_str)(
- buf, SPIDER_LONGLONG_LEN + 1, -10, limit + offset);
- str->q_append(buf, length);
- } else {
- if (str->reserve(SPIDER_SQL_HS_LTEQUAL_LEN +
- (SPIDER_LONGLONG_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_HS_LTEQUAL_STR, SPIDER_SQL_HS_LTEQUAL_LEN);
- length = (uint32) (my_charset_bin.longlong10_to_str)(
- buf, SPIDER_LONGLONG_LEN + 1, -10, limit);
- str->q_append(buf, length);
- }
- if (update_rownum_appended)
- {
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_select_lock_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_select_lock_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_select_lock(str);
- DBUG_PRINT("info",("spider str=%s", str->c_ptr_safe()));
- DBUG_PRINT("info",("spider length=%u", str->length()));
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_select_lock(
- spider_string *str
-) {
- int lock_mode = spider_conn_lock_mode(spider);
- DBUG_ENTER("spider_oracle_handler::append_select_lock");
- DBUG_PRINT("info",("spider this=%p", this));
- if (select_rownum_appended)
- {
- table_lock_mode = lock_mode;
- } else {
- if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE)
- {
- if (str->reserve(SPIDER_SQL_FOR_UPDATE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN);
- } else if (lock_mode == SPIDER_LOCK_MODE_SHARED)
- {
- if (str->reserve(SPIDER_SQL_FOR_UPDATE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_union_all_start_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_union_all_start_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_union_all_start(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_union_all_start(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_union_all_start");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_union_all_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_union_all_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_union_all(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_union_all(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_union_all");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_UNION_ALL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_UNION_ALL_STR, SPIDER_SQL_UNION_ALL_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_union_all_end_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_union_all_end_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_union_all_end(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_union_all_end(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_union_all_end");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(str->length() -
- SPIDER_SQL_UNION_ALL_LEN + SPIDER_SQL_CLOSE_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_multi_range_cnt_part(
- ulong sql_type,
- uint multi_range_cnt,
- bool with_comma
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_multi_range_cnt(str, multi_range_cnt, with_comma);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_multi_range_cnt(
- spider_string *str,
- uint multi_range_cnt,
- bool with_comma
-) {
- int range_cnt_length;
- char range_cnt_str[SPIDER_SQL_INT_LEN];
- DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt");
- DBUG_PRINT("info",("spider this=%p", this));
- range_cnt_length = my_sprintf(range_cnt_str, (range_cnt_str, "%u",
- multi_range_cnt));
- if (with_comma)
- {
- if (str->reserve(range_cnt_length + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(range_cnt_str, range_cnt_length);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (str->reserve(range_cnt_length))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(range_cnt_str, range_cnt_length);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_multi_range_cnt_with_name_part(
- ulong sql_type,
- uint multi_range_cnt
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt_with_name_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- str = &tmp_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_multi_range_cnt_with_name(str, multi_range_cnt);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_multi_range_cnt_with_name(
- spider_string *str,
- uint multi_range_cnt
-) {
- int range_cnt_length;
- char range_cnt_str[SPIDER_SQL_INT_LEN];
- DBUG_ENTER("spider_oracle_handler::append_multi_range_cnt_with_name");
- DBUG_PRINT("info",("spider this=%p", this));
- range_cnt_length = my_sprintf(range_cnt_str, (range_cnt_str, "%u",
- multi_range_cnt));
- if (str->reserve(range_cnt_length + SPIDER_SQL_SPACE_LEN +
- SPIDER_SQL_ID_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(range_cnt_str, range_cnt_length);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- str->q_append(SPIDER_SQL_ID_STR, SPIDER_SQL_ID_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_open_handler_part(
- ulong sql_type,
- uint handler_id,
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_open_handler_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_open_handler(str, handler_id, conn, link_idx);
- exec_ha_sql = str;
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_open_handler(
- spider_string *str,
- uint handler_id,
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_open_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider link_idx=%d", link_idx));
- DBUG_PRINT("info",("spider m_handler_cid=%s",
- spider->m_handler_cid[link_idx]));
- if (str->reserve(SPIDER_SQL_HANDLER_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_HANDLER_STR, SPIDER_SQL_HANDLER_LEN);
- if ((error_num = oracle_share->append_table_name(str,
- spider->conn_link_idx[link_idx])))
- DBUG_RETURN(error_num);
- if (str->reserve(SPIDER_SQL_OPEN_LEN + SPIDER_SQL_AS_LEN +
- SPIDER_SQL_HANDLER_CID_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_OPEN_STR, SPIDER_SQL_OPEN_LEN);
- str->q_append(SPIDER_SQL_AS_STR, SPIDER_SQL_AS_LEN);
- str->q_append(spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_close_handler_part(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_close_handler_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_close_handler(str, link_idx);
- exec_ha_sql = str;
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_close_handler(
- spider_string *str,
- int link_idx
-) {
- DBUG_ENTER("spider_oracle_handler::append_close_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_HANDLER_LEN + SPIDER_SQL_CLOSE_LEN +
- SPIDER_SQL_HANDLER_CID_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_HANDLER_STR, SPIDER_SQL_HANDLER_LEN);
- str->q_append(spider->m_handler_cid[link_idx],
- SPIDER_SQL_HANDLER_CID_LEN);
- str->q_append(SPIDER_SQL_CLOSE_STR, SPIDER_SQL_CLOSE_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_insert_terminator_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_insert_terminator_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_INSERT_SQL:
- str = &insert_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_insert_terminator(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_insert_terminator(
- spider_string *str
-) {
- DBUG_ENTER("spider_oracle_handler::append_insert_terminator");
- DBUG_PRINT("info",("spider this=%p", this));
- if (spider->result_list.insert_dup_update_pushdown)
- {
- DBUG_PRINT("info",("spider add duplicate key update"));
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- if (str->reserve(SPIDER_SQL_DUPLICATE_KEY_UPDATE_LEN +
- dup_update_sql.length()))
- {
- str->length(0);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_DUPLICATE_KEY_UPDATE_STR,
- SPIDER_SQL_DUPLICATE_KEY_UPDATE_LEN);
- if (str->append(dup_update_sql))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- } else {
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_insert_values_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_insert_values_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_INSERT_SQL:
- str = &insert_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_insert_values(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_insert_values(
- spider_string *str
-) {
- SPIDER_SHARE *share = spider->share;
- TABLE *table = spider->get_table();
- Field **field;
- bool add_value = FALSE;
- DBUG_ENTER("spider_oracle_handler::append_insert_values");
- DBUG_PRINT("info",("spider this=%p", this));
- nextval_pos = 0;
- if (str->reserve(SPIDER_SQL_OPEN_PAREN_LEN))
- {
- str->length(0);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- for (field = table->field; *field; field++)
- {
- DBUG_PRINT("info",("spider field_index=%u", (*field)->field_index));
- if (
- bitmap_is_set(table->write_set, (*field)->field_index) ||
- bitmap_is_set(table->read_set, (*field)->field_index)
- ) {
-#ifndef DBUG_OFF
- my_bitmap_map *tmp_map =
- dbug_tmp_use_all_columns(table, table->read_set);
-#endif
- add_value = TRUE;
- DBUG_PRINT("info",("spider is_null()=%s",
- (*field)->is_null() ? "TRUE" : "FALSE"));
- DBUG_PRINT("info",("spider table->next_number_field=%p",
- table->next_number_field));
- DBUG_PRINT("info",("spider *field=%p", *field));
- DBUG_PRINT("info",("spider force_auto_increment=%s",
- (table->next_number_field && spider->force_auto_increment) ?
- "TRUE" : "FALSE"));
- if (
- table->next_number_field == *field &&
- !table->auto_increment_field_not_null &&
- !spider->force_auto_increment
- ) {
- nextval_pos = str->length();
- if (str->reserve(oracle_share->nextval_max_length +
- SPIDER_SQL_COMMA_LEN))
- {
-#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
-#endif
- str->length(0);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->length(str->length() + oracle_share->nextval_max_length);
- } else if ((*field)->is_null())
- {
- if (str->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN))
- {
-#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
-#endif
- str->length(0);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
- } else {
- if (
- spider_db_oracle_utility.
- append_column_value(spider, str, *field, NULL,
- share->access_charset) ||
- str->reserve(SPIDER_SQL_COMMA_LEN)
- ) {
-#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
-#endif
- str->length(0);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- }
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
-#ifndef DBUG_OFF
- dbug_tmp_restore_column_map(table->read_set, tmp_map);
-#endif
- }
- }
- if (add_value)
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_COMMA_LEN))
- {
- str->length(0);
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_into_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_into_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_INSERT_SQL:
- str = &insert_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_into(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_into(
- spider_string *str
-) {
- const TABLE *table = spider->get_table();
- Field **field;
- uint field_name_length = 0;
- DBUG_ENTER("spider_oracle_handler::append_into");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_INTO_LEN + oracle_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN);
- insert_table_name_pos = str->length();
- append_table_name_with_adjusting(str, first_link_idx,
- SPIDER_SQL_TYPE_INSERT_SQL);
- str->q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- for (field = table->field; *field; field++)
- {
- if (
- bitmap_is_set(table->write_set, (*field)->field_index) ||
- bitmap_is_set(table->read_set, (*field)->field_index)
- ) {
- field_name_length =
- oracle_share->column_name_str[(*field)->field_index].length();
- if (str->reserve(field_name_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- oracle_share->append_column_name(str, (*field)->field_index);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- if (field_name_length)
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- if (str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- str->q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN);
- insert_pos = str->length();
- DBUG_RETURN(0);
-}
-
-void spider_oracle_handler::set_insert_to_pos(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::set_insert_to_pos");
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_INSERT_SQL:
- insert_sql.length(insert_pos);
- break;
- default:
- DBUG_ASSERT(0);
- break;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_handler::append_from_part(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_from_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_HANDLER:
- str = &ha_sql;
- break;
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- str = &update_sql;
- break;
- default:
- str = &sql;
- break;
- }
- error_num = append_from(str, sql_type, link_idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_from(
- spider_string *str,
- ulong sql_type,
- int link_idx
-) {
- DBUG_ENTER("spider_oracle_handler::append_from");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider link_idx=%d", link_idx));
- if (sql_type == SPIDER_SQL_TYPE_HANDLER)
- {
- ha_table_name_pos = str->length();
- DBUG_PRINT("info",("spider ha_table_name_pos=%u", ha_table_name_pos));
- ha_sql_handler_id = spider->m_handler_id[link_idx];
- DBUG_PRINT("info",("spider ha_sql_handler_id=%u", ha_sql_handler_id));
- if (str->reserve(SPIDER_SQL_HANDLER_CID_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(spider->m_handler_cid[link_idx], SPIDER_SQL_HANDLER_CID_LEN);
- DBUG_PRINT("info",("spider m_handler_cid=%s",
- spider->m_handler_cid[link_idx]));
- } else {
- if (str->reserve(SPIDER_SQL_FROM_LEN + oracle_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- table_name_pos = str->length();
- append_table_name_with_adjusting(str, link_idx, sql_type);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_flush_tables_part(
- ulong sql_type,
- int link_idx,
- bool lock
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_flush_tables_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_flush_tables(str, link_idx, lock);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_flush_tables(
- spider_string *str,
- int link_idx,
- bool lock
-) {
- DBUG_ENTER("spider_oracle_handler::append_flush_tables");
- DBUG_PRINT("info",("spider this=%p", this));
- if (lock)
- {
- if (str->reserve(SPIDER_SQL_FLUSH_TABLES_LEN +
- SPIDER_SQL_WITH_READ_LOCK_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FLUSH_TABLES_STR, SPIDER_SQL_FLUSH_TABLES_LEN);
- str->q_append(SPIDER_SQL_WITH_READ_LOCK_STR,
- SPIDER_SQL_WITH_READ_LOCK_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_FLUSH_TABLES_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_FLUSH_TABLES_STR, SPIDER_SQL_FLUSH_TABLES_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_optimize_table_part(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_optimize_table_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_optimize_table(str, link_idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_optimize_table(
- spider_string *str,
- int link_idx
-) {
- SPIDER_SHARE *share = spider->share;
- int conn_link_idx = spider->conn_link_idx[link_idx];
- int local_length = spider_param_internal_optimize_local(
- spider->wide_handler->trx->thd,
- share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN;
- DBUG_ENTER("spider_oracle_handler::append_optimize_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SQL_OPTIMIZE_LEN + SPIDER_SQL_SQL_TABLE_LEN +
- local_length +
- oracle_share->db_names_str[conn_link_idx].length() +
- SPIDER_SQL_DOT_LEN +
- oracle_share->table_names_str[conn_link_idx].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_OPTIMIZE_STR, SPIDER_SQL_SQL_OPTIMIZE_LEN);
- if (local_length)
- str->q_append(SPIDER_SQL_SQL_LOCAL_STR, SPIDER_SQL_SQL_LOCAL_LEN);
- str->q_append(SPIDER_SQL_SQL_TABLE_STR, SPIDER_SQL_SQL_TABLE_LEN);
- oracle_share->append_table_name(str, conn_link_idx);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_analyze_table_part(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_analyze_table_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_analyze_table(str, link_idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_analyze_table(
- spider_string *str,
- int link_idx
-) {
- SPIDER_SHARE *share = spider->share;
- int conn_link_idx = spider->conn_link_idx[link_idx];
- int local_length = spider_param_internal_optimize_local(
- spider->wide_handler->trx->thd,
- share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN;
- DBUG_ENTER("spider_oracle_handler::append_analyze_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SQL_ANALYZE_LEN + SPIDER_SQL_SQL_TABLE_LEN +
- local_length +
- oracle_share->db_names_str[conn_link_idx].length() +
- SPIDER_SQL_DOT_LEN +
- oracle_share->table_names_str[conn_link_idx].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_ANALYZE_STR, SPIDER_SQL_SQL_ANALYZE_LEN);
- if (local_length)
- str->q_append(SPIDER_SQL_SQL_LOCAL_STR, SPIDER_SQL_SQL_LOCAL_LEN);
- str->q_append(SPIDER_SQL_SQL_TABLE_STR, SPIDER_SQL_SQL_TABLE_LEN);
- oracle_share->append_table_name(str, conn_link_idx);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_repair_table_part(
- ulong sql_type,
- int link_idx,
- HA_CHECK_OPT* check_opt
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_repair_table_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_repair_table(str, link_idx, check_opt);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_repair_table(
- spider_string *str,
- int link_idx,
- HA_CHECK_OPT* check_opt
-) {
- SPIDER_SHARE *share = spider->share;
- int conn_link_idx = spider->conn_link_idx[link_idx];
- int local_length = spider_param_internal_optimize_local(
- spider->wide_handler->trx->thd,
- share->internal_optimize_local) * SPIDER_SQL_SQL_LOCAL_LEN;
- DBUG_ENTER("spider_oracle_handler::append_repair_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SQL_REPAIR_LEN + SPIDER_SQL_SQL_TABLE_LEN +
- local_length +
- oracle_share->db_names_str[conn_link_idx].length() +
- SPIDER_SQL_DOT_LEN +
- oracle_share->table_names_str[conn_link_idx].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_REPAIR_STR, SPIDER_SQL_SQL_REPAIR_LEN);
- if (local_length)
- str->q_append(SPIDER_SQL_SQL_LOCAL_STR, SPIDER_SQL_SQL_LOCAL_LEN);
- str->q_append(SPIDER_SQL_SQL_TABLE_STR, SPIDER_SQL_SQL_TABLE_LEN);
- oracle_share->append_table_name(str, conn_link_idx);
- if (check_opt->flags & T_QUICK)
- {
- if (str->reserve(SPIDER_SQL_SQL_QUICK_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_QUICK_STR, SPIDER_SQL_SQL_QUICK_LEN);
- }
- if (check_opt->flags & T_EXTEND)
- {
- if (str->reserve(SPIDER_SQL_SQL_EXTENDED_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_EXTENDED_STR, SPIDER_SQL_SQL_EXTENDED_LEN);
- }
- if (check_opt->sql_flags & TT_USEFRM)
- {
- if (str->reserve(SPIDER_SQL_SQL_USE_FRM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_USE_FRM_STR, SPIDER_SQL_SQL_USE_FRM_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_check_table_part(
- ulong sql_type,
- int link_idx,
- HA_CHECK_OPT* check_opt
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_check_table_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_check_table(str, link_idx, check_opt);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_check_table(
- spider_string *str,
- int link_idx,
- HA_CHECK_OPT* check_opt
-) {
- int conn_link_idx = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::append_check_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SQL_CHECK_TABLE_LEN +
- oracle_share->db_names_str[conn_link_idx].length() +
- SPIDER_SQL_DOT_LEN +
- oracle_share->table_names_str[conn_link_idx].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_CHECK_TABLE_STR,
- SPIDER_SQL_SQL_CHECK_TABLE_LEN);
- oracle_share->append_table_name(str, conn_link_idx);
- if (check_opt->flags & T_QUICK)
- {
- if (str->reserve(SPIDER_SQL_SQL_QUICK_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_QUICK_STR, SPIDER_SQL_SQL_QUICK_LEN);
- }
- if (check_opt->flags & T_FAST)
- {
- if (str->reserve(SPIDER_SQL_SQL_FAST_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_FAST_STR, SPIDER_SQL_SQL_FAST_LEN);
- }
- if (check_opt->flags & T_MEDIUM)
- {
- if (str->reserve(SPIDER_SQL_SQL_MEDIUM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_MEDIUM_STR, SPIDER_SQL_SQL_MEDIUM_LEN);
- }
- if (check_opt->flags & T_EXTEND)
- {
- if (str->reserve(SPIDER_SQL_SQL_EXTENDED_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_EXTENDED_STR, SPIDER_SQL_SQL_EXTENDED_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_enable_keys_part(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_enable_keys_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_enable_keys(str, link_idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_enable_keys(
- spider_string *str,
- int link_idx
-) {
- int conn_link_idx = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::append_enable_keys");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SQL_ALTER_TABLE_LEN +
- oracle_share->db_names_str[conn_link_idx].length() +
- SPIDER_SQL_DOT_LEN +
- oracle_share->table_names_str[conn_link_idx].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_SQL_ENABLE_KEYS_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_ALTER_TABLE_STR,
- SPIDER_SQL_SQL_ALTER_TABLE_LEN);
- oracle_share->append_table_name(str, conn_link_idx);
- str->q_append(SPIDER_SQL_SQL_ENABLE_KEYS_STR,
- SPIDER_SQL_SQL_ENABLE_KEYS_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_disable_keys_part(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_disable_keys_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_disable_keys(str, link_idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_disable_keys(
- spider_string *str,
- int link_idx
-) {
- int conn_link_idx = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::append_disable_keys");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_SQL_ALTER_TABLE_LEN +
- oracle_share->db_names_str[conn_link_idx].length() +
- SPIDER_SQL_DOT_LEN +
- oracle_share->table_names_str[conn_link_idx].length() +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_SQL_DISABLE_KEYS_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SQL_ALTER_TABLE_STR,
- SPIDER_SQL_SQL_ALTER_TABLE_LEN);
- oracle_share->append_table_name(str, conn_link_idx);
- str->q_append(SPIDER_SQL_SQL_DISABLE_KEYS_STR,
- SPIDER_SQL_SQL_DISABLE_KEYS_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_delete_all_rows_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_delete_all_rows_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_DELETE_SQL:
- str = &update_sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_delete_all_rows(str, sql_type);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_delete_all_rows(
- spider_string *str,
- ulong sql_type
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_delete_all_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- if (spider->sql_command == SQLCOM_TRUNCATE)
- {
- if ((error_num = append_truncate(str, sql_type, first_link_idx)))
- DBUG_RETURN(error_num);
- } else {
- if (
- (error_num = append_delete(str)) ||
- (error_num = append_from(str, sql_type, first_link_idx))
- )
- DBUG_RETURN(error_num);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_truncate(
- spider_string *str,
- ulong sql_type,
- int link_idx
-) {
- DBUG_ENTER("spider_oracle_handler::append_truncate");
- if (str->reserve(SPIDER_SQL_TRUNCATE_TABLE_LEN +
- oracle_share->db_nm_max_length +
- SPIDER_SQL_DOT_LEN + oracle_share->table_nm_max_length +
- /* SPIDER_SQL_NAME_QUOTE_LEN */ 4 + SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_TRUNCATE_TABLE_STR, SPIDER_SQL_TRUNCATE_TABLE_LEN);
- table_name_pos = str->length();
- append_table_name_with_adjusting(str, link_idx, sql_type);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_explain_select_part(
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_explain_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_OTHER_SQL:
- str = &spider->result_list.sqls[link_idx];
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num =
- append_explain_select(str, start_key, end_key, sql_type, link_idx);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_explain_select(
- spider_string *str,
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::append_explain_select");
- DBUG_PRINT("info",("spider this=%p", this));
- if (str->reserve(SPIDER_SQL_EXPLAIN_SELECT_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_EXPLAIN_SELECT_STR, SPIDER_SQL_EXPLAIN_SELECT_LEN);
- if (
- (error_num = append_from(str, sql_type, link_idx)) ||
- (error_num = append_key_where(str, NULL, NULL, start_key, end_key,
- sql_type, FALSE))
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- DBUG_RETURN(0);
-}
-
-/********************************************************************
- * Determine whether the current query's projection list
- * consists solely of the specified column.
- *
- * Params IN - field_index:
- * Field index of the column of interest within
- * its table.
- *
- * Returns TRUE - if the query's projection list consists
- * solely of the specified column.
- * FALSE - otherwise.
- ********************************************************************/
-bool spider_oracle_handler::is_sole_projection_field( uint16 field_index )
-{
- // Determine whether the projection list consists solely of the field of interest
- bool is_field_in_projection_list = FALSE;
- TABLE* table = spider->get_table();
- uint16 projection_field_count = 0;
- uint16 projection_field_index;
- Field** field;
- DBUG_ENTER( "spider_oracle_handler::is_sole_projection_field" );
-
- for ( field = table->field; *field; field++ )
- {
- projection_field_index = ( *field )->field_index;
-
- if ( !( minimum_select_bit_is_set( projection_field_index ) ) )
- {
- // Current field is not in the projection list
- continue;
- }
-
- projection_field_count++;
-
- if ( !is_field_in_projection_list )
- {
- if (field_index == projection_field_index)
- {
- // Field of interest is in the projection list
- is_field_in_projection_list = TRUE;
- }
- }
-
- if ( is_field_in_projection_list && ( projection_field_count != 1 ) )
- {
- // Field of interest is not the sole column in the projection list
- DBUG_RETURN( FALSE );
- }
- }
-
- if ( is_field_in_projection_list && ( projection_field_count == 1 ) )
- {
- // Field of interest is the only column in the projection list
- DBUG_RETURN( TRUE );
- }
-
- DBUG_RETURN( FALSE );
-}
-
-bool spider_oracle_handler::is_bulk_insert_exec_period(
- bool bulk_end
-) {
- DBUG_ENTER("spider_oracle_handler::is_bulk_insert_exec_period");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_PRINT("info",("spider insert_sql.length=%u", insert_sql.length()));
- DBUG_PRINT("info",("spider insert_pos=%d", insert_pos));
- DBUG_PRINT("info",("spider insert_sql=%s", insert_sql.c_ptr_safe()));
- if (
-/*
- (bulk_end || (int) insert_sql.length() >= spider->bulk_size) &&
-*/
- (int) insert_sql.length() > insert_pos
- ) {
- DBUG_RETURN(TRUE);
- }
- DBUG_RETURN(FALSE);
-}
-
-bool spider_oracle_handler::sql_is_filled_up(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::sql_is_filled_up");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(filled_up);
-}
-
-bool spider_oracle_handler::sql_is_empty(
- ulong sql_type
-) {
- bool is_empty;
- DBUG_ENTER("spider_oracle_handler::sql_is_empty");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- is_empty = (sql.length() == 0);
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- is_empty = (insert_sql.length() == 0);
- break;
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- is_empty = (update_sql.length() == 0);
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- is_empty = (tmp_sql.length() == 0);
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- is_empty = (ha_sql.length() == 0);
- break;
- default:
- is_empty = TRUE;
- break;
- }
- DBUG_RETURN(is_empty);
-}
-
-bool spider_oracle_handler::support_multi_split_read()
-{
- DBUG_ENTER("spider_oracle_handler::support_multi_split_read");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-bool spider_oracle_handler::support_bulk_update()
-{
- DBUG_ENTER("spider_oracle_handler::support_bulk_update");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-int spider_oracle_handler::bulk_tmp_table_insert()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_insert");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = store_sql_to_bulk_tmp_table(&update_sql, upd_tmp_tbl);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::bulk_tmp_table_insert(
- int link_idx
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_insert");
- DBUG_PRINT("info",("spider this=%p", this));
- error_num = store_sql_to_bulk_tmp_table(
- &spider->result_list.update_sqls[link_idx],
- spider->result_list.upd_tmp_tbls[link_idx]);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::bulk_tmp_table_end_bulk_insert()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_end_bulk_insert");
- DBUG_PRINT("info",("spider this=%p", this));
- if ((error_num = upd_tmp_tbl->file->ha_end_bulk_insert()))
- {
- DBUG_RETURN(error_num);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::bulk_tmp_table_rnd_init()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_rnd_init");
- DBUG_PRINT("info",("spider this=%p", this));
- upd_tmp_tbl->file->extra(HA_EXTRA_CACHE);
- if ((error_num = upd_tmp_tbl->file->ha_rnd_init(TRUE)))
- {
- DBUG_RETURN(error_num);
- }
- reading_from_bulk_tmp_table = TRUE;
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::bulk_tmp_table_rnd_next()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_rnd_next");
- DBUG_PRINT("info",("spider this=%p", this));
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
- error_num = upd_tmp_tbl->file->ha_rnd_next(upd_tmp_tbl->record[0]);
-#else
- error_num = upd_tmp_tbl->file->rnd_next(upd_tmp_tbl->record[0]);
-#endif
- if (!error_num)
- {
- error_num = restore_sql_from_bulk_tmp_table(&insert_sql, upd_tmp_tbl);
- }
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::bulk_tmp_table_rnd_end()
-{
- int error_num;
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_rnd_end");
- DBUG_PRINT("info",("spider this=%p", this));
- reading_from_bulk_tmp_table = FALSE;
- if ((error_num = upd_tmp_tbl->file->ha_rnd_end()))
- {
- DBUG_RETURN(error_num);
- }
- DBUG_RETURN(0);
-}
-
-bool spider_oracle_handler::need_copy_for_update(
- int link_idx
-) {
- int all_link_idx = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::need_copy_for_update");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(!oracle_share->same_db_table_name ||
- spider->share->link_statuses[all_link_idx] == SPIDER_LINK_STATUS_RECOVERY);
-}
-
-bool spider_oracle_handler::bulk_tmp_table_created()
-{
- DBUG_ENTER("spider_oracle_handler::bulk_tmp_table_created");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(upd_tmp_tbl);
-}
-
-int spider_oracle_handler::mk_bulk_tmp_table_and_bulk_start()
-{
- THD *thd = spider->wide_handler->trx->thd;
- TABLE *table = spider->get_table();
- DBUG_ENTER("spider_oracle_handler::mk_bulk_tmp_table_and_bulk_start");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!upd_tmp_tbl)
- {
-#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor
- LEX_CSTRING field_name = {STRING_WITH_LEN("a")};
- if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
- thd, table, &upd_tmp_tbl_prm, &field_name, update_sql.charset())))
-#else
- if (!(upd_tmp_tbl = spider_mk_sys_tmp_table(
- thd, table, &upd_tmp_tbl_prm, "a", update_sql.charset())))
-#endif
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- upd_tmp_tbl->file->extra(HA_EXTRA_WRITE_CACHE);
- upd_tmp_tbl->file->ha_start_bulk_insert((ha_rows) 0);
- }
- DBUG_RETURN(0);
-}
-
-void spider_oracle_handler::rm_bulk_tmp_table()
-{
- DBUG_ENTER("spider_oracle_handler::rm_bulk_tmp_table");
- DBUG_PRINT("info",("spider this=%p", this));
- if (upd_tmp_tbl)
- {
- spider_rm_sys_tmp_table(spider->wide_handler->trx->thd, upd_tmp_tbl,
- &upd_tmp_tbl_prm);
- upd_tmp_tbl = NULL;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_handler::store_sql_to_bulk_tmp_table(
- spider_string *str,
- TABLE *tmp_table
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_handler::store_sql_to_bulk_tmp_table");
- DBUG_PRINT("info",("spider this=%p", this));
- tmp_table->field[0]->set_notnull();
- tmp_table->field[0]->store(str->ptr(), str->length(), str->charset());
- if ((error_num = tmp_table->file->ha_write_row(tmp_table->record[0])))
- DBUG_RETURN(error_num);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::restore_sql_from_bulk_tmp_table(
- spider_string *str,
- TABLE *tmp_table
-) {
- DBUG_ENTER("spider_oracle_handler::restore_sql_from_bulk_tmp_table");
- DBUG_PRINT("info",("spider this=%p", this));
- tmp_table->field[0]->val_str(str->get_str());
- str->mem_calc();
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::insert_lock_tables_list(
- SPIDER_CONN *conn,
- int link_idx
-) {
- spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn;
- SPIDER_LINK_FOR_HASH *tmp_link_for_hash2 = &link_for_hash[link_idx];
- DBUG_ENTER("spider_oracle_handler::insert_lock_tables_list");
- DBUG_PRINT("info",("spider this=%p", this));
- uint old_elements =
- db_conn->lock_table_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash2->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash2))
-#else
- if (my_hash_insert(&db_conn->lock_table_hash,
- (uchar*) tmp_link_for_hash2))
-#endif
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- if (db_conn->lock_table_hash.array.max_element > old_elements)
- {
- spider_alloc_calc_mem(spider_current_trx,
- db_conn->lock_table_hash,
- (db_conn->lock_table_hash.array.max_element - old_elements) *
- db_conn->lock_table_hash.array.size_of_element);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_lock_tables_list(
- SPIDER_CONN *conn,
- int link_idx,
- int *appended
-) {
- int error_num;
- SPIDER_LINK_FOR_HASH *tmp_link_for_hash, *tmp_link_for_hash2;
- int conn_link_idx = spider->conn_link_idx[link_idx];
- spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn;
- DBUG_ENTER("spider_oracle_handler::append_lock_tables_list");
- DBUG_PRINT("info",("spider this=%p", this));
- tmp_link_for_hash2 = &link_for_hash[link_idx];
- tmp_link_for_hash2->db_table_str =
- &oracle_share->db_table_str[conn_link_idx];
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- tmp_link_for_hash2->db_table_str_hash_value =
- oracle_share->db_table_str_hash_value[conn_link_idx];
- if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *)
- my_hash_search_using_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash2->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash2->db_table_str->ptr(),
- tmp_link_for_hash2->db_table_str->length())))
-#else
- if (!(tmp_link_for_hash = (SPIDER_LINK_FOR_HASH *) my_hash_search(
- &db_conn->lock_table_hash,
- (uchar*) tmp_link_for_hash2->db_table_str->ptr(),
- tmp_link_for_hash2->db_table_str->length())))
-#endif
- {
- if ((error_num = insert_lock_tables_list(conn, link_idx)))
- DBUG_RETURN(error_num);
- *appended = 1;
- } else {
- if (tmp_link_for_hash->spider->wide_handler->lock_type <
- spider->wide_handler->lock_type)
- {
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash);
-#else
- my_hash_delete(&db_conn->lock_table_hash,
- (uchar*) tmp_link_for_hash);
-#endif
- uint old_elements =
- db_conn->lock_table_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(
- &db_conn->lock_table_hash,
- tmp_link_for_hash2->db_table_str_hash_value,
- (uchar*) tmp_link_for_hash2))
-#else
- if (my_hash_insert(&db_conn->lock_table_hash,
- (uchar*) tmp_link_for_hash2))
-#endif
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- if (db_conn->lock_table_hash.array.max_element > old_elements)
- {
- spider_alloc_calc_mem(spider_current_trx,
- db_conn->lock_table_hash,
- (db_conn->lock_table_hash.array.max_element - old_elements) *
- db_conn->lock_table_hash.array.size_of_element);
- }
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::realloc_sql(
- ulong *realloced
-) {
- THD *thd = spider->wide_handler->trx->thd;
- st_spider_share *share = spider->share;
- int init_sql_alloc_size =
- spider_param_init_sql_alloc_size(thd, share->init_sql_alloc_size);
- DBUG_ENTER("spider_oracle_handler::realloc_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- if ((int) sql.alloced_length() > init_sql_alloc_size * 2)
- {
- sql.free();
- if (sql.real_alloc(init_sql_alloc_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- *realloced |= SPIDER_SQL_TYPE_SELECT_SQL;
- }
- if ((int) ha_sql.alloced_length() > init_sql_alloc_size * 2)
- {
- ha_sql.free();
- if (ha_sql.real_alloc(init_sql_alloc_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- *realloced |= SPIDER_SQL_TYPE_SELECT_SQL;
- }
- if ((int) dup_update_sql.alloced_length() > init_sql_alloc_size * 2)
- {
- dup_update_sql.free();
- if (dup_update_sql.real_alloc(init_sql_alloc_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- if ((int) insert_sql.alloced_length() > init_sql_alloc_size * 2)
- {
- insert_sql.free();
- if (insert_sql.real_alloc(init_sql_alloc_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- *realloced |= SPIDER_SQL_TYPE_INSERT_SQL;
- }
- if ((int) update_sql.alloced_length() > init_sql_alloc_size * 2)
- {
- update_sql.free();
- if (update_sql.real_alloc(init_sql_alloc_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- *realloced |= (SPIDER_SQL_TYPE_UPDATE_SQL | SPIDER_SQL_TYPE_DELETE_SQL);
- }
- update_sql.length(0);
- if ((int) tmp_sql.alloced_length() > init_sql_alloc_size * 2)
- {
- tmp_sql.free();
- if (tmp_sql.real_alloc(init_sql_alloc_size))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- *realloced |= SPIDER_SQL_TYPE_TMP_SQL;
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::reset_sql(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::reset_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL)
- {
- table_lock_mode = 0;
- select_rownum_appended = FALSE;
- sql.length(0);
- }
- if (sql_type & SPIDER_SQL_TYPE_INSERT_SQL)
- {
- insert_sql.length(0);
- }
- if (sql_type & (SPIDER_SQL_TYPE_UPDATE_SQL | SPIDER_SQL_TYPE_DELETE_SQL |
- SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
- {
- update_rownum_appended = FALSE;
- update_set_pos = 0;
- update_sql.length(0);
- }
- if (sql_type & SPIDER_SQL_TYPE_TMP_SQL)
- {
- tmp_sql.length(0);
- }
- if (sql_type & SPIDER_SQL_TYPE_HANDLER)
- {
- ha_sql.length(0);
- }
- DBUG_RETURN(0);
-}
-
-bool spider_oracle_handler::need_lock_before_set_sql_for_exec(
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::need_lock_before_set_sql_for_exec");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
-int spider_oracle_handler::set_sql_for_exec(
- ulong sql_type,
- int link_idx,
- SPIDER_LINK_IDX_CHAIN *link_idx_chain
-) {
- int error_num;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- int all_link_idx = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::set_sql_for_exec");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL)
- {
- if (table_lock_mode)
- {
- spider_string *str = &result_list->insert_sqls[link_idx];
- str->length(0);
- if (str->reserve(SPIDER_SQL_LOCK_TABLE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN);
- if ((error_num = oracle_share->append_table_name(str, all_link_idx)))
- DBUG_RETURN(error_num);
- if (table_lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE)
- {
- if (str->reserve(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR,
- SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN);
- } else if (table_lock_mode == SPIDER_LOCK_MODE_SHARED)
- {
- if (str->reserve(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR,
- SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN);
- }
- exec_lock_sql = str;
- }
-
- if ((error_num = spider_db_oracle_utility.reappend_tables(
- spider->fields, link_idx_chain, &sql)))
- DBUG_RETURN(error_num);
- exec_sql = &sql;
- }
- DBUG_RETURN(0);
-}
-#endif
-
-int spider_oracle_handler::set_sql_for_exec(
- ulong sql_type,
- int link_idx
-) {
- int error_num;
- uint tmp_pos;
- SPIDER_SHARE *share = spider->share;
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- int all_link_idx = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::set_sql_for_exec");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql_type & (SPIDER_SQL_TYPE_SELECT_SQL | SPIDER_SQL_TYPE_TMP_SQL))
- {
- if (table_lock_mode)
- {
- spider_string *str = &result_list->insert_sqls[link_idx];
- str->length(0);
- if (str->reserve(SPIDER_SQL_LOCK_TABLE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN);
- if ((error_num = oracle_share->append_table_name(str, all_link_idx)))
- DBUG_RETURN(error_num);
- if (table_lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE)
- {
- if (str->reserve(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR,
- SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN);
- } else if (table_lock_mode == SPIDER_LOCK_MODE_SHARED)
- {
- if (str->reserve(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR,
- SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN);
- }
- exec_lock_sql = str;
- }
-
- if (oracle_share->same_db_table_name || link_idx == first_link_idx)
- {
- if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL)
- exec_sql = &sql;
- if (sql_type & SPIDER_SQL_TYPE_TMP_SQL)
- exec_tmp_sql = &tmp_sql;
- } else {
- char tmp_table_name[MAX_FIELD_WIDTH * 2],
- tgt_table_name[MAX_FIELD_WIDTH * 2];
- int tmp_table_name_length;
- spider_string tgt_table_name_str(tgt_table_name,
- MAX_FIELD_WIDTH * 2,
- oracle_share->db_names_str[link_idx].charset());
- const char *table_names[2], *table_aliases[2];
- uint table_name_lengths[2], table_alias_lengths[2];
- tgt_table_name_str.init_calc_mem(212);
- tgt_table_name_str.length(0);
- if (result_list->tmp_table_join && spider->bka_mode != 2)
- {
- create_tmp_bka_table_name(tmp_table_name, &tmp_table_name_length,
- link_idx);
- append_table_name_with_adjusting(&tgt_table_name_str, link_idx,
- SPIDER_SQL_TYPE_TMP_SQL);
- table_names[0] = tmp_table_name;
- table_names[1] = tgt_table_name_str.ptr();
- table_name_lengths[0] = tmp_table_name_length;
- table_name_lengths[1] = tgt_table_name_str.length();
- table_aliases[0] = SPIDER_SQL_A_STR;
- table_aliases[1] = SPIDER_SQL_B_STR;
- table_alias_lengths[0] = SPIDER_SQL_A_LEN;
- table_alias_lengths[1] = SPIDER_SQL_B_LEN;
- }
- if (sql_type & SPIDER_SQL_TYPE_SELECT_SQL)
- {
- exec_sql = &result_list->sqls[link_idx];
- if (exec_sql->copy(sql))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- else if (result_list->use_union)
- {
- if ((error_num = reset_union_table_name(exec_sql, link_idx,
- SPIDER_SQL_TYPE_SELECT_SQL)))
- DBUG_RETURN(error_num);
- } else {
- tmp_pos = exec_sql->length();
- exec_sql->length(table_name_pos);
- if (result_list->tmp_table_join && spider->bka_mode != 2)
- {
- if ((error_num = spider_db_oracle_utility.append_from_with_alias(
- exec_sql, table_names, table_name_lengths,
- table_aliases, table_alias_lengths, 2,
- &table_name_pos, TRUE))
- )
- DBUG_RETURN(error_num);
- exec_sql->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- } else {
- append_table_name_with_adjusting(exec_sql, link_idx,
- SPIDER_SQL_TYPE_SELECT_SQL);
- }
- exec_sql->length(tmp_pos);
- }
- }
- if (sql_type & SPIDER_SQL_TYPE_TMP_SQL)
- {
- exec_tmp_sql = &result_list->tmp_sqls[link_idx];
- if (result_list->tmp_table_join && spider->bka_mode != 2)
- {
- if (exec_tmp_sql->copy(tmp_sql))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- else {
- tmp_pos = exec_tmp_sql->length();
- exec_tmp_sql->length(tmp_sql_pos1);
- exec_tmp_sql->q_append(tmp_table_name, tmp_table_name_length);
- exec_tmp_sql->length(tmp_sql_pos2);
- exec_tmp_sql->q_append(tmp_table_name, tmp_table_name_length);
- exec_tmp_sql->length(tmp_sql_pos3);
- exec_tmp_sql->q_append(tmp_table_name, tmp_table_name_length);
- exec_tmp_sql->length(tmp_pos);
- }
- }
- }
- }
- }
- if (sql_type & SPIDER_SQL_TYPE_INSERT_SQL)
- {
- if (oracle_share->same_db_table_name || link_idx == first_link_idx)
- exec_insert_sql = &insert_sql;
- else {
- exec_insert_sql = &result_list->insert_sqls[link_idx];
- if (exec_insert_sql->copy(insert_sql))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- DBUG_PRINT("info",("spider exec_insert_sql=%s",
- exec_insert_sql->c_ptr_safe()));
- tmp_pos = exec_insert_sql->length();
- exec_insert_sql->length(insert_table_name_pos);
- append_table_name_with_adjusting(exec_insert_sql, link_idx,
- sql_type);
- exec_insert_sql->length(tmp_pos);
- DBUG_PRINT("info",("spider exec_insert_sql->length=%u",
- exec_insert_sql->length()));
- DBUG_PRINT("info",("spider exec_insert_sql=%s",
- exec_insert_sql->c_ptr_safe()));
- }
- if (nextval_pos)
- {
- memcpy((uchar *) exec_insert_sql->ptr() + nextval_pos,
- oracle_share->nextval_str[all_link_idx].ptr(),
- oracle_share->nextval_max_length);
- }
- }
- if (sql_type & SPIDER_SQL_TYPE_BULK_UPDATE_SQL)
- {
- if (reading_from_bulk_tmp_table)
- {
- if (
- oracle_share->same_db_table_name &&
- share->link_statuses[all_link_idx] != SPIDER_LINK_STATUS_RECOVERY
- ) {
- exec_update_sql = &insert_sql;
- } else if (!spider->result_list.upd_tmp_tbls[link_idx])
- {
- DBUG_RETURN(ER_SPIDER_COND_SKIP_NUM);
- } else {
- exec_update_sql = &spider->result_list.insert_sqls[link_idx];
- if ((error_num = restore_sql_from_bulk_tmp_table(exec_update_sql,
- spider->result_list.upd_tmp_tbls[link_idx])))
- {
- DBUG_RETURN(error_num);
- }
- }
- } else {
- if (
- oracle_share->same_db_table_name &&
- share->link_statuses[all_link_idx] != SPIDER_LINK_STATUS_RECOVERY
- ) {
- exec_update_sql = &update_sql;
- } else {
- exec_update_sql = &spider->result_list.update_sqls[link_idx];
- }
- }
- DBUG_PRINT("info",("spider exec_update_sql=%s",
- exec_update_sql->c_ptr_safe()));
- } else if (sql_type &
- (SPIDER_SQL_TYPE_UPDATE_SQL | SPIDER_SQL_TYPE_DELETE_SQL))
- {
- if (oracle_share->same_db_table_name || link_idx == first_link_idx)
- exec_update_sql = &update_sql;
- else {
- exec_update_sql = &spider->result_list.update_sqls[link_idx];
- if (exec_update_sql->copy(update_sql))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- tmp_pos = exec_update_sql->length();
- exec_update_sql->length(table_name_pos);
- append_table_name_with_adjusting(exec_update_sql, link_idx,
- sql_type);
- exec_update_sql->length(tmp_pos);
- }
- DBUG_PRINT("info",("spider exec_update_sql=%s",
- exec_update_sql->c_ptr_safe()));
- }
- if (sql_type & SPIDER_SQL_TYPE_HANDLER)
- {
- if (spider->m_handler_id[link_idx] == ha_sql_handler_id)
- exec_ha_sql = &ha_sql;
- else {
- exec_ha_sql = &result_list->sqls[link_idx];
- if (exec_ha_sql->copy(ha_sql))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- else {
- tmp_pos = exec_ha_sql->length();
- exec_ha_sql->length(ha_table_name_pos);
- append_table_name_with_adjusting(exec_ha_sql, link_idx,
- SPIDER_SQL_TYPE_HANDLER);
- exec_ha_sql->length(tmp_pos);
- }
- }
- DBUG_PRINT("info",("spider exec_ha_sql=%s",
- exec_ha_sql->c_ptr_safe()));
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::set_sql_for_exec(
- spider_db_copy_table *tgt_ct,
- ulong sql_type
-) {
- spider_oracle_copy_table *oracle_ct = (spider_oracle_copy_table *) tgt_ct;
- DBUG_ENTER("spider_oracle_handler::set_sql_for_exec");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_INSERT_SQL:
- exec_insert_sql = &oracle_ct->sql;
- break;
- default:
- DBUG_ASSERT(0);
- break;
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::execute_sql(
- ulong sql_type,
- SPIDER_CONN *conn,
- int quick_mode,
- int *need_mon
-) {
- spider_string *tgt_sql;
- uint tgt_length;
- DBUG_ENTER("spider_oracle_handler::execute_sql");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_SELECT_SQL"));
- tgt_sql = exec_sql;
- tgt_length = tgt_sql->length();
- if (table_lock_mode)
- {
- DBUG_PRINT("info",("spider table_lock_mode=%d", table_lock_mode));
- spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn;
- db_conn->table_lock_mode = table_lock_mode;
- db_conn->exec_lock_sql = exec_lock_sql;
- table_lock_mode = 0;
- }
- break;
- case SPIDER_SQL_TYPE_INSERT_SQL:
- DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_SELECT_SQL"));
- tgt_sql = exec_insert_sql;
- tgt_length = tgt_sql->length();
- break;
- case SPIDER_SQL_TYPE_UPDATE_SQL:
- case SPIDER_SQL_TYPE_DELETE_SQL:
- case SPIDER_SQL_TYPE_BULK_UPDATE_SQL:
- DBUG_PRINT("info",("spider %s",
- sql_type == SPIDER_SQL_TYPE_UPDATE_SQL ? "SPIDER_SQL_TYPE_UPDATE_SQL" :
- sql_type == SPIDER_SQL_TYPE_DELETE_SQL ? "SPIDER_SQL_TYPE_DELETE_SQL" :
- "SPIDER_SQL_TYPE_BULK_UPDATE_SQL"
- ));
- tgt_sql = exec_update_sql;
- tgt_length = tgt_sql->length();
- break;
- case SPIDER_SQL_TYPE_TMP_SQL:
- DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_TMP_SQL"));
- tgt_sql = exec_tmp_sql;
- tgt_length = tgt_sql->length();
- break;
- case SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL:
- DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL"));
- tgt_sql = exec_tmp_sql;
- tgt_length = tmp_sql_pos5;
- break;
- case SPIDER_SQL_TYPE_HANDLER:
- DBUG_PRINT("info",("spider SPIDER_SQL_TYPE_HANDLER"));
- tgt_sql = exec_ha_sql;
- tgt_length = tgt_sql->length();
- break;
- default:
- /* nothing to do */
- DBUG_PRINT("info",("spider default"));
- DBUG_RETURN(0);
- }
- DBUG_RETURN(spider_db_query(
- conn,
- tgt_sql->ptr(),
- tgt_length,
- quick_mode,
- need_mon
- ));
-}
-
-int spider_oracle_handler::reset()
-{
- DBUG_ENTER("spider_oracle_handler::reset");
- DBUG_PRINT("info",("spider this=%p", this));
- update_sql.length(0);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::sts_mode_exchange(
- int sts_mode
-) {
- DBUG_ENTER("spider_oracle_handler::sts_mode_exchange");
- DBUG_PRINT("info",("spider sts_mode=%d", sts_mode));
- DBUG_RETURN(1);
-}
-
-int spider_oracle_handler::show_table_status(
- int link_idx,
- int sts_mode,
- uint flag
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- SPIDER_DB_RESULT *res;
- SPIDER_SHARE *share = spider->share;
- uint pos = (2 * spider->conn_link_idx[link_idx]);
- ulonglong auto_increment_value = 0;
- DBUG_ENTER("spider_oracle_handler::show_table_status");
- DBUG_PRINT("info",("spider sts_mode=%d", sts_mode));
- if (
- (flag & HA_STATUS_AUTO) &&
- (error_num = show_autoinc(link_idx))
- ) {
- DBUG_RETURN(error_num);
- }
-
- if (sts_mode == 1)
- {
- if (!share->stat.records)
- share->stat.records = 10000;
- share->stat.mean_rec_length = 65535;
- share->stat.data_file_length = 65535;
- share->stat.max_data_file_length = 65535;
- share->stat.index_file_length = 65535;
- share->stat.create_time = (time_t) 0;
- share->stat.update_time = (time_t) 0;
- share->stat.check_time = (time_t) 0;
- } else {
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- oracle_share->show_table_status[1 + pos].ptr(),
- oracle_share->show_table_status[1 + pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
- /* retry */
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- oracle_share->show_table_status[1 + pos].ptr(),
- oracle_share->show_table_status[1 + pos].length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- } else {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id;
- request_key.query_id = spider->wide_handler->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num || (error_num = spider_db_errorno(conn)))
- DBUG_RETURN(error_num);
- else
- DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- error_num = res->fetch_table_status(
- sts_mode,
- share->stat
- );
- auto_increment_value = share->stat.auto_increment_value;
- res->free_result();
- delete res;
- if (error_num)
- DBUG_RETURN(error_num);
- }
- if (auto_increment_value > share->lgtm_tblhnd_share->auto_increment_value)
- {
- share->lgtm_tblhnd_share->auto_increment_value = auto_increment_value;
- DBUG_PRINT("info",("spider auto_increment_value=%llu",
- share->lgtm_tblhnd_share->auto_increment_value));
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::crd_mode_exchange(
- int crd_mode
-) {
- DBUG_ENTER("spider_oracle_handler::crd_mode_exchange");
- DBUG_PRINT("info",("spider crd_mode=%d", crd_mode));
- DBUG_RETURN(1);
-}
-
-int spider_oracle_handler::show_index(
- int link_idx,
- int crd_mode
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- SPIDER_SHARE *share = spider->share;
- TABLE *table = spider->get_table();
- SPIDER_DB_RESULT *res;
- int roop_count;
- longlong *tmp_cardinality;
- uint pos = (2 * spider->conn_link_idx[link_idx]);
- DBUG_ENTER("spider_oracle_handler::show_index");
- DBUG_PRINT("info",("spider crd_mode=%d", crd_mode));
- if (crd_mode == 1)
- {
- for (roop_count = 0, tmp_cardinality = share->cardinality;
- roop_count < (int) table->s->fields;
- roop_count++, tmp_cardinality++)
- {
- if (!spider_bit_is_set(share->cardinality_upd, roop_count))
- {
- DBUG_PRINT("info",
- ("spider init column cardinality id=%d", roop_count));
- *tmp_cardinality = 1;
- }
- }
- } else {
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- oracle_share->show_index[1 + pos].ptr(),
- oracle_share->show_index[1 + pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
- /* retry */
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- oracle_share->show_index[1 + pos].ptr(),
- oracle_share->show_index[1 + pos].length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- } else {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id;
- request_key.query_id = spider->wide_handler->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- if (error_num || (error_num = spider_db_errorno(conn)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- /* no record is ok */
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- if (res)
- {
- error_num = res->fetch_table_cardinality(
- crd_mode,
- table,
- share->cardinality,
- share->cardinality_upd,
- share->bitmap_size
- );
- }
- for (roop_count = 0, tmp_cardinality = share->cardinality;
- roop_count < (int) table->s->fields;
- roop_count++, tmp_cardinality++)
- {
- if (!spider_bit_is_set(share->cardinality_upd, roop_count))
- {
- DBUG_PRINT("info",
- ("spider init column cardinality id=%d", roop_count));
- *tmp_cardinality = 1;
- }
- }
- if (res)
- {
- res->free_result();
- delete res;
- }
- if (error_num)
- DBUG_RETURN(error_num);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::show_records(
- int link_idx
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- SPIDER_DB_RESULT *res;
- SPIDER_SHARE *share = spider->share;
- uint pos = spider->conn_link_idx[link_idx];
- DBUG_ENTER("spider_oracle_handler::show_records");
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- oracle_share->show_records[pos].ptr(),
- oracle_share->show_records[pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
- /* retry */
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 1", error_num));
- DBUG_RETURN(error_num);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 2", error_num));
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- oracle_share->show_records[pos].ptr(),
- oracle_share->show_records[pos].length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_PRINT("info", ("spider error_num=%d 3", error_num));
- DBUG_RETURN(spider_db_errorno(conn));
- }
- } else {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 4", error_num));
- DBUG_RETURN(error_num);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id;
- request_key.query_id = spider->wide_handler->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 5", error_num));
- DBUG_RETURN(error_num);
- }
- else if (error_num || (error_num = spider_db_errorno(conn)))
- {
- DBUG_PRINT("info", ("spider error_num=%d 6", error_num));
- DBUG_RETURN(error_num);
- } else {
- DBUG_PRINT("info", ("spider error_num=%d 7",
- ER_QUERY_ON_FOREIGN_DATA_SOURCE));
- DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
- }
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- error_num = res->fetch_table_records(
- 1,
- spider->table_rows
- );
- res->free_result();
- delete res;
- if (error_num)
- {
- DBUG_PRINT("info", ("spider error_num=%d 7", error_num));
- DBUG_RETURN(error_num);
- }
- spider->wide_handler->trx->direct_aggregate_count++;
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::show_autoinc(
- int link_idx
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- SPIDER_DB_RESULT *res;
- SPIDER_SHARE *share = spider->share;
- uint pos = spider->conn_link_idx[link_idx];
- ulonglong auto_increment_value;
- DBUG_ENTER("spider_oracle_handler::show_autoinc");
- if (!oracle_share->show_autoinc)
- DBUG_RETURN(0);
-
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- oracle_share->show_autoinc[pos].ptr(),
- oracle_share->show_autoinc[pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
- /* retry */
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 1", error_num));
- DBUG_RETURN(error_num);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 2", error_num));
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- oracle_share->show_records[pos].ptr(),
- oracle_share->show_records[pos].length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_PRINT("info", ("spider error_num=%d 3", error_num));
- DBUG_RETURN(spider_db_errorno(conn));
- }
- } else {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 4", error_num));
- DBUG_RETURN(error_num);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id;
- request_key.query_id = spider->wide_handler->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- if (error_num)
- {
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_PRINT("info", ("spider error_num=%d 5", error_num));
- DBUG_RETURN(error_num);
- }
- else if ((error_num = spider_db_errorno(conn)))
- {
- DBUG_PRINT("info", ("spider error_num=%d 6", error_num));
- DBUG_RETURN(error_num);
- } else {
- DBUG_PRINT("info", ("spider error_num=%d 7",
- ER_QUERY_ON_FOREIGN_DATA_SOURCE));
- DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
- }
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- error_num = res->fetch_table_records(
- 1,
- auto_increment_value
- );
- res->free_result();
- delete res;
- if (error_num)
- {
- DBUG_PRINT("info", ("spider error_num=%d 7", error_num));
- DBUG_RETURN(error_num);
- }
- if (auto_increment_value >=
- share->lgtm_tblhnd_share->auto_increment_value)
- {
- share->lgtm_tblhnd_share->auto_increment_value =
- auto_increment_value + 1;
- DBUG_PRINT("info",("spider auto_increment_value=%llu",
- share->lgtm_tblhnd_share->auto_increment_value));
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::show_last_insert_id(
- int link_idx,
- ulonglong &last_insert_id
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- SPIDER_DB_RESULT *res;
- uint pos = spider->conn_link_idx[link_idx];
- spider_db_oracle *db_oracle = (spider_db_oracle *) conn->db_conn;
- DBUG_ENTER("spider_oracle_handler::show_last_insert_id");
- if (!oracle_share->show_last_insert_id)
- {
- DBUG_ASSERT(0);
- last_insert_id = 0;
- db_oracle->stored_last_insert_id = 0;
- DBUG_RETURN(0);
- }
-
- if (
- spider_db_query(
- conn,
- oracle_share->show_last_insert_id[pos].ptr(),
- oracle_share->show_last_insert_id[pos].length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- ) {
- DBUG_PRINT("info", ("spider error_num=%d 4", error_num));
- DBUG_RETURN(error_num);
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id;
- request_key.query_id = spider->wide_handler->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- if (error_num || (error_num = spider_db_errorno(conn)))
- {
- DBUG_PRINT("info", ("spider error_num=%d 5", error_num));
- DBUG_RETURN(error_num);
- } else {
- DBUG_PRINT("info", ("spider error_num=%d 6",
- ER_QUERY_ON_FOREIGN_DATA_SOURCE));
- DBUG_RETURN(ER_QUERY_ON_FOREIGN_DATA_SOURCE);
- }
- }
- error_num = res->fetch_table_records(
- 1,
- last_insert_id
- );
- res->free_result();
- delete res;
- if (error_num)
- {
- DBUG_PRINT("info", ("spider error_num=%d 7", error_num));
- DBUG_RETURN(error_num);
- }
- db_oracle->stored_last_insert_id = last_insert_id;
- DBUG_RETURN(0);
-}
-
-ha_rows spider_oracle_handler::explain_select(
- const key_range *start_key,
- const key_range *end_key,
- int link_idx
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- SPIDER_RESULT_LIST *result_list = &spider->result_list;
- spider_string *str = &result_list->sqls[link_idx];
- SPIDER_DB_RESULT *res;
- ha_rows rows;
- spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
- DBUG_ENTER("spider_oracle_handler::explain_select");
- if ((error_num = dbton_hdl->append_explain_select_part(
- start_key, end_key, SPIDER_SQL_TYPE_OTHER_SQL, link_idx)))
- {
- my_errno = error_num;
- DBUG_RETURN(HA_POS_ERROR);
- }
-
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- spider->share);
- if (
- (error_num = spider_db_set_names(spider, conn, link_idx)) ||
- (
- spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx]) &&
- (error_num = spider_db_errorno(conn))
- )
- ) {
- if (
- error_num == ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM &&
- !conn->disable_reconnect
- ) {
- /* retry */
- if ((error_num = spider_db_ping(spider, conn, link_idx)))
- {
- if (spider->check_error_mode(error_num))
- my_errno = error_num;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(HA_POS_ERROR);
- }
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- if (spider->check_error_mode(error_num))
- my_errno = error_num;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(HA_POS_ERROR);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- spider->share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- error_num = spider_db_errorno(conn);
- if (spider->check_error_mode(error_num))
- my_errno = error_num;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(HA_POS_ERROR);
- }
- } else {
- if (spider->check_error_mode(error_num))
- my_errno = error_num;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(HA_POS_ERROR);
- }
- }
- st_spider_db_request_key request_key;
- request_key.spider_thread_id = spider->wide_handler->trx->spider_thread_id;
- request_key.query_id = spider->wide_handler->trx->thd->query_id;
- request_key.handler = spider;
- request_key.request_id = 1;
- request_key.next = NULL;
- if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
- {
- if (error_num || (error_num = spider_db_errorno(conn)))
- {
- if (spider->check_error_mode(error_num))
- my_errno = error_num;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(HA_POS_ERROR);
- } else {
- my_errno = ER_QUERY_ON_FOREIGN_DATA_SOURCE;
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(HA_POS_ERROR);
- }
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- error_num = res->fetch_table_records(
- 2,
- rows
- );
- res->free_result();
- delete res;
- if (error_num)
- {
- my_errno = error_num;
- DBUG_RETURN(HA_POS_ERROR);
- }
- DBUG_RETURN(rows);
-}
-
-int spider_oracle_handler::lock_tables(
- int link_idx
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- spider_string *str = &sql;
- DBUG_ENTER("spider_oracle_handler::lock_tables");
- do {
- str->length(0);
- if ((error_num = conn->db_conn->append_lock_tables(str)))
- {
- DBUG_RETURN(error_num);
- }
- if (str->length())
- {
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- spider->share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- DBUG_RETURN(spider_db_errorno(conn));
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- }
- if (!conn->table_locked)
- {
- conn->table_locked = TRUE;
- spider->wide_handler->trx->locked_connections++;
- }
- } while (str->length());
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::unlock_tables(
- int link_idx
-) {
- int error_num;
- SPIDER_CONN *conn = spider->conns[link_idx];
- DBUG_ENTER("spider_oracle_handler::unlock_tables");
- if (conn->table_locked)
- {
- if ((error_num = conn->db_conn->commit(&spider->need_mons[link_idx])))
- {
- DBUG_RETURN(error_num);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::disable_keys(
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::disable_keys");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_disable_keys_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx)))
- {
- DBUG_RETURN(error_num);
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::enable_keys(
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::enable_keys");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_enable_keys_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx)))
- {
- DBUG_RETURN(error_num);
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::check_table(
- SPIDER_CONN *conn,
- int link_idx,
- HA_CHECK_OPT* check_opt
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::check_table");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_check_table_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx, check_opt)))
- {
- DBUG_RETURN(error_num);
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::repair_table(
- SPIDER_CONN *conn,
- int link_idx,
- HA_CHECK_OPT* check_opt
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::repair_table");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_repair_table_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx, check_opt)))
- {
- DBUG_RETURN(error_num);
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::analyze_table(
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::analyze_table");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_analyze_table_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx)))
- {
- DBUG_RETURN(error_num);
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::optimize_table(
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::optimize_table");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_optimize_table_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx)))
- {
- DBUG_RETURN(error_num);
- }
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if ((error_num = spider_db_set_names(spider, conn, link_idx)))
- {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::flush_tables(
- SPIDER_CONN *conn,
- int link_idx,
- bool lock
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- spider_string *str = &spider->result_list.sqls[link_idx];
- DBUG_ENTER("spider_oracle_handler::flush_tables");
- DBUG_PRINT("info",("spider this=%p", this));
- str->length(0);
- if ((error_num = append_flush_tables_part(SPIDER_SQL_TYPE_OTHER_HS,
- link_idx, lock)))
- {
- DBUG_RETURN(error_num);
- }
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (spider_db_query(
- conn,
- str->ptr(),
- str->length(),
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::flush_logs(
- SPIDER_CONN *conn,
- int link_idx
-) {
- int error_num;
- SPIDER_SHARE *share = spider->share;
- DBUG_ENTER("spider_oracle_handler::flush_logs");
- DBUG_PRINT("info",("spider this=%p", this));
- spider_conn_set_timeout_from_share(conn, link_idx,
- spider->wide_handler->trx->thd,
- share);
- pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
- pthread_mutex_lock(&conn->mta_conn_mutex);
- SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
- conn->need_mon = &spider->need_mons[link_idx];
- DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = TRUE;
- conn->mta_conn_mutex_unlock_later = TRUE;
- if (spider_db_query(
- conn,
- SPIDER_SQL_FLUSH_LOGS_STR,
- SPIDER_SQL_FLUSH_LOGS_LEN,
- -1,
- &spider->need_mons[link_idx])
- ) {
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- error_num = spider_db_errorno(conn);
- DBUG_RETURN(error_num);
- }
- DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
- DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
- conn->mta_conn_mutex_lock_already = FALSE;
- conn->mta_conn_mutex_unlock_later = FALSE;
- SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
- pthread_mutex_unlock(&conn->mta_conn_mutex);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::insert_opened_handler(
- SPIDER_CONN *conn,
- int link_idx
-) {
- spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn;
- SPIDER_LINK_FOR_HASH *tmp_link_for_hash = &link_for_hash[link_idx];
- DBUG_ASSERT(tmp_link_for_hash->spider == spider);
- DBUG_ASSERT(tmp_link_for_hash->link_idx == link_idx);
- uint old_elements = db_conn->handler_open_array.max_element;
- DBUG_ENTER("spider_oracle_handler::insert_opened_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- if (insert_dynamic(&db_conn->handler_open_array,
- (uchar*) &tmp_link_for_hash))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- if (db_conn->handler_open_array.max_element > old_elements)
- {
- spider_alloc_calc_mem(spider_current_trx,
- db_conn->handler_open_array,
- (db_conn->handler_open_array.max_element - old_elements) *
- db_conn->handler_open_array.size_of_element);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::delete_opened_handler(
- SPIDER_CONN *conn,
- int link_idx
-) {
- spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn;
- uint roop_count, elements = db_conn->handler_open_array.elements;
- SPIDER_LINK_FOR_HASH *tmp_link_for_hash;
- DBUG_ENTER("spider_oracle_handler::delete_opened_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- for (roop_count = 0; roop_count < elements; roop_count++)
- {
- get_dynamic(&db_conn->handler_open_array, (uchar *) &tmp_link_for_hash,
- roop_count);
- if (tmp_link_for_hash == &link_for_hash[link_idx])
- {
- delete_dynamic_element(&db_conn->handler_open_array, roop_count);
- break;
- }
- }
- DBUG_ASSERT(roop_count < elements);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::sync_from_clone_source(
- spider_db_handler *dbton_hdl
-) {
- DBUG_ENTER("spider_oracle_handler::sync_from_clone_source");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(0);
-}
-
-bool spider_oracle_handler::support_use_handler(
- int use_handler
-) {
- DBUG_ENTER("spider_oracle_handler::support_use_handler");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(FALSE);
-}
-
-void spider_oracle_handler::minimum_select_bitmap_create()
-{
- TABLE *table = spider->get_table();
- Field **field_p;
- DBUG_ENTER("spider_oracle_handler::minimum_select_bitmap_create");
- memset(minimum_select_bitmap, 0, no_bytes_in_map(table->read_set));
- if (
- spider->use_index_merge ||
-#ifdef HA_CAN_BULK_ACCESS
- (spider->is_clone && !spider->is_bulk_access_clone)
-#else
- spider->is_clone
-#endif
- ) {
- /* need preparing for cmp_ref */
- TABLE_SHARE *table_share = table->s;
- if (
- table_share->primary_key == MAX_KEY
- ) {
- /* need all columns */
- memset(minimum_select_bitmap, 0xFF, no_bytes_in_map(table->read_set));
- DBUG_VOID_RETURN;
- } else {
- /* need primary key columns */
- uint roop_count;
- KEY *key_info;
- KEY_PART_INFO *key_part;
- Field *field;
- key_info = &table_share->key_info[table_share->primary_key];
- key_part = key_info->key_part;
- for (roop_count = 0;
- roop_count < spider_user_defined_key_parts(key_info);
- roop_count++)
- {
- field = key_part[roop_count].field;
- spider_set_bit(minimum_select_bitmap, field->field_index);
- }
- }
- }
- for (field_p = table->field; *field_p; field_p++)
- {
- uint field_index = (*field_p)->field_index;
- if (
- spider_bit_is_set(spider->searched_bitmap, field_index) ||
- bitmap_is_set(table->read_set, field_index) ||
- bitmap_is_set(table->write_set, field_index)
- ) {
- spider_set_bit(minimum_select_bitmap, field_index);
- }
- }
- DBUG_VOID_RETURN;
-}
-
-bool spider_oracle_handler::minimum_select_bit_is_set(
- uint field_index
-) {
- DBUG_ENTER("spider_oracle_handler::minimum_select_bit_is_set");
- DBUG_PRINT("info",("spider field_index=%u", field_index));
- DBUG_PRINT("info",("spider minimum_select_bitmap=%s",
- spider_bit_is_set(minimum_select_bitmap, field_index) ?
- "TRUE" : "FALSE"));
- DBUG_RETURN(spider_bit_is_set(minimum_select_bitmap, field_index));
-}
-
-void spider_oracle_handler::copy_minimum_select_bitmap(
- uchar *bitmap
-) {
- int roop_count;
- TABLE *table = spider->get_table();
- DBUG_ENTER("spider_oracle_handler::copy_minimum_select_bitmap");
- for (roop_count = 0;
- roop_count < (int) ((table->s->fields + 7) / 8);
- roop_count++)
- {
- bitmap[roop_count] =
- minimum_select_bitmap[roop_count];
- DBUG_PRINT("info",("spider roop_count=%d", roop_count));
- DBUG_PRINT("info",("spider bitmap=%d",
- bitmap[roop_count]));
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_handler::init_union_table_name_pos()
-{
- DBUG_ENTER("spider_oracle_handler::init_union_table_name_pos");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!union_table_name_pos_first)
- {
- if (!spider_bulk_malloc(spider_current_trx, 238, MYF(MY_WME),
- &union_table_name_pos_first, (uint) (sizeof(SPIDER_INT_HLD)),
- NullS)
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- union_table_name_pos_first->next = NULL;
- }
- union_table_name_pos_current = union_table_name_pos_first;
- union_table_name_pos_current->tgt_num = 0;
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::set_union_table_name_pos()
-{
- DBUG_ENTER("spider_oracle_handler::set_union_table_name_pos");
- DBUG_PRINT("info",("spider this=%p", this));
- if (union_table_name_pos_current->tgt_num >= SPIDER_INT_HLD_TGT_SIZE)
- {
- if (!union_table_name_pos_current->next)
- {
- if (!spider_bulk_malloc(spider_current_trx, 239, MYF(MY_WME),
- &union_table_name_pos_current->next, (uint) (sizeof(SPIDER_INT_HLD)),
- NullS)
- ) {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- union_table_name_pos_current->next->next = NULL;
- }
- union_table_name_pos_current = union_table_name_pos_current->next;
- union_table_name_pos_current->tgt_num = 0;
- }
- union_table_name_pos_current->tgt[union_table_name_pos_current->tgt_num] =
- table_name_pos;
- ++union_table_name_pos_current->tgt_num;
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::reset_union_table_name(
- spider_string *str,
- int link_idx,
- ulong sql_type
-) {
- DBUG_ENTER("spider_oracle_handler::reset_union_table_name");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!union_table_name_pos_current)
- DBUG_RETURN(0);
-
- SPIDER_INT_HLD *tmp_pos = union_table_name_pos_first;
- uint cur_num, pos_backup = str->length();
- while(TRUE)
- {
- for (cur_num = 0; cur_num < tmp_pos->tgt_num; ++cur_num)
- {
- str->length(tmp_pos->tgt[cur_num]);
- append_table_name_with_adjusting(str, link_idx, sql_type);
- }
- if (tmp_pos == union_table_name_pos_current)
- break;
- tmp_pos = tmp_pos->next;
- }
- str->length(pos_backup);
- DBUG_RETURN(0);
-}
-
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
-int spider_oracle_handler::append_from_and_tables_part(
- spider_fields *fields,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- SPIDER_TABLE_HOLDER *table_holder;
- TABLE_LIST *table_list;
- DBUG_ENTER("spider_oracle_handler::append_from_and_tables_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- fields->set_pos_to_first_table_holder();
- table_holder = fields->get_next_table_holder();
- table_list = table_holder->table->pos_in_table_list;
- error_num = spider_db_oracle_utility.append_from_and_tables(fields, str,
- table_list);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::reappend_tables_part(
- spider_fields *fields,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::reappend_tables_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = spider_db_oracle_utility.reappend_tables(fields,
- link_idx_chain, str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_where_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_where_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = spider_db_oracle_utility.append_where(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_having_part(
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_having_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = spider_db_oracle_utility.append_having(str);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_item_type_part(
- Item *item,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_item_type_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, spider_dbton_oracle.dbton_id, use_fields, fields);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_list_item_select_part(
- List<Item> *select,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_list_item_select_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_list_item_select(select, str, alias, alias_length,
- use_fields, fields);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_list_item_select(
- List<Item> *select,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
-) {
- int error_num;
- uint dbton_id = spider_dbton_oracle.dbton_id, length;
- uint32 begin;
- List_iterator_fast<Item> it(*select);
- Item *item;
- Field *field;
- const char *item_name;
- DBUG_ENTER("spider_oracle_handler::append_list_item_select");
- DBUG_PRINT("info",("spider this=%p", this));
- begin = str->length();
- while ((item = it++))
- {
- if (item->const_item())
- {
- DBUG_PRINT("info",("spider const item"));
- continue;
- }
- if ((error_num = spider_db_print_item_type(item, NULL, spider, str,
- alias, alias_length, dbton_id, use_fields, fields)))
- {
- DBUG_RETURN(error_num);
- }
- field = *(fields->get_next_field_ptr());
- if (field)
- {
- item_name = SPIDER_field_name_str(field);
- length = SPIDER_field_name_length(field);
- } else {
- item_name = SPIDER_item_name_str(item);
- length = SPIDER_item_name_length(item);
- }
- if (str->reserve(
- SPIDER_SQL_COMMA_LEN + /* SPIDER_SQL_NAME_QUOTE_LEN */ 2 +
- SPIDER_SQL_SPACE_LEN + length
- ))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_SPACE_STR, SPIDER_SQL_SPACE_LEN);
- if ((error_num = spider_db_oracle_utility.append_escaped_name(str,
- item_name, length)))
- {
- DBUG_RETURN(error_num);
- }
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- if (begin == str->length())
- {
- /* no columns */
- if (str->reserve(SPIDER_SQL_ONE_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- str->q_append(SPIDER_SQL_ONE_STR, SPIDER_SQL_ONE_LEN);
- } else {
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_group_by_part(
- ORDER *order,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_group_by_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_group_by(order, str, alias, alias_length,
- use_fields, fields);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_group_by(
- ORDER *order,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
-) {
- int error_num;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_handler::append_group_by");
- DBUG_PRINT("info",("spider this=%p", this));
- if (order)
- {
- if (str->reserve(SPIDER_SQL_GROUP_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_GROUP_STR, SPIDER_SQL_GROUP_LEN);
- for (; order; order = order->next)
- {
- if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
- {
- DBUG_RETURN(error_num);
- }
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_handler::append_order_by_part(
- ORDER *order,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
-) {
- int error_num;
- spider_string *str;
- DBUG_ENTER("spider_oracle_handler::append_order_by_part");
- DBUG_PRINT("info",("spider this=%p", this));
- switch (sql_type)
- {
- case SPIDER_SQL_TYPE_SELECT_SQL:
- str = &sql;
- break;
- default:
- DBUG_RETURN(0);
- }
- error_num = append_order_by(order, str, alias, alias_length,
- use_fields, fields);
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_handler::append_order_by(
- ORDER *order,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
-) {
- int error_num;
- uint dbton_id = spider_dbton_oracle.dbton_id;
- DBUG_ENTER("spider_oracle_handler::append_order_by");
- DBUG_PRINT("info",("spider this=%p", this));
- if (order)
- {
- if (str->reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- for (; order; order = order->next)
- {
- if ((error_num = spider_db_print_item_type((*order->item), NULL, spider,
- str, alias, alias_length, dbton_id, use_fields, fields)))
- {
- DBUG_RETURN(error_num);
- }
-#ifdef SPIDER_ORDER_HAS_ENUM_ORDER
- if (order->direction == ORDER::ORDER_DESC)
-#else
- if (!order->asc)
-#endif
- {
- if (str->reserve(SPIDER_SQL_COMMA_LEN + SPIDER_SQL_DESC_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- str->length(str->length() - SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-#endif
-
-spider_oracle_copy_table::spider_oracle_copy_table(
- spider_oracle_share *db_share
-) : spider_db_copy_table(
- db_share
-),
- oracle_share(db_share),
- pos(0),
- table_name_pos(0),
- pos_diff(0),
- table_lock_mode(0),
- select_rownum_appended(FALSE),
- first_str(NULL),
- current_str(NULL)
-{
- DBUG_ENTER("spider_oracle_copy_table::spider_oracle_copy_table");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_VOID_RETURN;
-}
-
-spider_oracle_copy_table::~spider_oracle_copy_table()
-{
- DBUG_ENTER("spider_oracle_copy_table::~spider_oracle_copy_table");
- DBUG_PRINT("info",("spider this=%p", this));
- while (first_str)
- {
- current_str = first_str;
- first_str = first_str->next;
- delete [] current_str;
- }
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_copy_table::init()
-{
- DBUG_ENTER("spider_oracle_copy_table::init");
- DBUG_PRINT("info",("spider this=%p", this));
- sql.init_calc_mem(213);
- sql_part.init_calc_mem(215);
- DBUG_RETURN(0);
-}
-
-void spider_oracle_copy_table::set_sql_charset(
- CHARSET_INFO *cs
-) {
- DBUG_ENTER("spider_oracle_copy_table::set_sql_charset");
- DBUG_PRINT("info",("spider this=%p", this));
- sql.set_charset(cs);
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_copy_table::append_select_str()
-{
- DBUG_ENTER("spider_oracle_copy_table::append_select_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_SELECT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_SELECT_STR, SPIDER_SQL_SELECT_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_insert_str(
- int insert_flg
-) {
- DBUG_ENTER("spider_oracle_copy_table::append_insert_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_INSERT_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_INSERT_STR, SPIDER_SQL_INSERT_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_table_columns(
- TABLE_SHARE *table_share
-) {
- int error_num;
- Field **field;
- DBUG_ENTER("spider_oracle_copy_table::append_table_columns");
- DBUG_PRINT("info",("spider this=%p", this));
- for (field = table_share->field; *field; field++)
- {
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str(&sql,
- (*field)->field_name, spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- sql.length(sql.length() - SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_from_str()
-{
- DBUG_ENTER("spider_oracle_copy_table::append_from_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_FROM_STR, SPIDER_SQL_FROM_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_table_name(
- int link_idx
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_copy_table::append_table_name");
- DBUG_PRINT("info",("spider this=%p", this));
- table_name_pos = sql.length();
- error_num = oracle_share->append_table_name(&sql, link_idx);
- store_link_idx = link_idx;
- DBUG_RETURN(error_num);
-}
-
-void spider_oracle_copy_table::set_sql_pos()
-{
- DBUG_ENTER("spider_oracle_copy_table::set_sql_pos");
- DBUG_PRINT("info",("spider this=%p", this));
- pos = sql.length();
- DBUG_VOID_RETURN;
-}
-
-void spider_oracle_copy_table::set_sql_to_pos()
-{
- DBUG_ENTER("spider_oracle_copy_table::set_sql_to_pos");
- DBUG_PRINT("info",("spider this=%p", this));
- sql.length(pos);
- DBUG_VOID_RETURN;
-}
-
-int spider_oracle_copy_table::append_copy_where(
- spider_db_copy_table *source_ct,
- KEY *key_info,
- ulong *last_row_pos,
- ulong *last_lengths
-) {
- int error_num, roop_count, roop_count2;
- DBUG_ENTER("spider_oracle_copy_table::append_copy_where");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_WHERE_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- sql.q_append(SPIDER_SQL_WHERE_STR, SPIDER_SQL_WHERE_LEN);
- sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- Field *field;
- KEY_PART_INFO *key_part = key_info->key_part;
- for (roop_count = spider_user_defined_key_parts(key_info) - 1;
- roop_count >= 0; roop_count--)
- {
- for (roop_count2 = 0; roop_count2 < roop_count; roop_count2++)
- {
- field = key_part[roop_count2].field;
- if ((error_num = copy_key_row(source_ct,
- field, &last_row_pos[field->field_index],
- &last_lengths[field->field_index],
- SPIDER_SQL_EQUAL_STR, SPIDER_SQL_EQUAL_LEN)))
- {
- DBUG_RETURN(error_num);
- }
- }
- field = key_part[roop_count2].field;
- if ((error_num = copy_key_row(source_ct,
- field, &last_row_pos[field->field_index],
- &last_lengths[field->field_index],
- SPIDER_SQL_GT_STR, SPIDER_SQL_GT_LEN)))
- {
- DBUG_RETURN(error_num);
- }
- sql.length(sql.length() - SPIDER_SQL_AND_LEN);
- if (sql.reserve(SPIDER_SQL_CLOSE_PAREN_LEN +
- SPIDER_SQL_OR_LEN + SPIDER_SQL_OPEN_PAREN_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- sql.q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- sql.q_append(SPIDER_SQL_OR_STR, SPIDER_SQL_OR_LEN);
- sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- }
- sql.length(sql.length() - SPIDER_SQL_OR_LEN - SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_key_order_str(
- KEY *key_info,
- int start_pos,
- bool desc_flg
-) {
- int length, error_num;
- KEY_PART_INFO *key_part;
- Field *field;
- DBUG_ENTER("spider_oracle_copy_table::append_key_order_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (select_rownum_appended)
- {
- if (sql.reserve(SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
- DBUG_RETURN(0);
- }
- sql_part.length(0);
- if (sql_part.reserve(sql.length() + SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN +
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_HEAD_STR,
- SPIDER_SQL_SELECT_WRAPPER_HEAD_LEN);
- sql_part.q_append(sql.ptr(), table_name_pos - SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_HEAD_STR,
- SPIDER_SQL_ROW_NUMBER_HEAD_LEN);
- if ((int) spider_user_defined_key_parts(key_info) > start_pos)
- {
- if (desc_flg == TRUE)
- {
- for (
- key_part = key_info->key_part + start_pos,
- length = 0;
- length + start_pos < (int) spider_user_defined_key_parts(key_info);
- key_part++,
- length++
- ) {
- field = key_part->field;
- if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str(&sql_part,
- field->field_name, spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN +
- SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- } else {
- for (
- key_part = key_info->key_part + start_pos,
- length = 0;
- length + start_pos < (int) spider_user_defined_key_parts(key_info);
- key_part++,
- length++
- ) {
- field = key_part->field;
- if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str(&sql_part,
- field->field_name, spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN +
- SPIDER_SQL_DESC_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql_part.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_NAME_QUOTE_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql_part.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- }
- }
- if (desc_flg == TRUE)
- {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + sql.length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_DESC_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_DESC_TAIL_LEN);
- } else {
- if (sql_part.reserve(SPIDER_SQL_ROW_NUMBER_TAIL_LEN +
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN + sql.length() - table_name_pos +
- SPIDER_SQL_FROM_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_ROW_NUMBER_TAIL_STR,
- SPIDER_SQL_ROW_NUMBER_TAIL_LEN);
- }
- pos_diff = sql_part.length() + SPIDER_SQL_FROM_LEN - table_name_pos;
- sql_part.q_append(sql.ptr() + table_name_pos - SPIDER_SQL_FROM_LEN,
- sql.length() - table_name_pos + SPIDER_SQL_FROM_LEN);
- sql_part.q_append(SPIDER_SQL_SELECT_WRAPPER_TAIL_STR,
- SPIDER_SQL_SELECT_WRAPPER_TAIL_LEN);
-
- if ((int) spider_user_defined_key_parts(key_info) > start_pos)
- {
- if (sql.reserve(SPIDER_SQL_ORDER_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_ORDER_STR, SPIDER_SQL_ORDER_LEN);
- if (desc_flg == TRUE)
- {
- for (
- key_part = key_info->key_part + start_pos,
- length = 0;
- length + start_pos < (int) spider_user_defined_key_parts(key_info);
- key_part++,
- length++
- ) {
- field = key_part->field;
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str(&sql,
- field->field_name, spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_DESC_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- } else {
- for (
- key_part = key_info->key_part + start_pos,
- length = 0;
- length + start_pos < (int) spider_user_defined_key_parts(key_info);
- key_part++,
- length++
- ) {
- field = key_part->field;
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str(&sql,
- field->field_name, spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (key_part->key_part_flag & HA_REVERSE_SORT)
- {
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_DESC_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql.q_append(SPIDER_SQL_DESC_STR, SPIDER_SQL_DESC_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- } else {
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR,
- SPIDER_SQL_NAME_QUOTE_LEN);
- sql.q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- }
- }
- }
- sql.length(sql.length() - SPIDER_SQL_COMMA_LEN);
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_limit(
- longlong offset,
- longlong limit
-) {
- char buf[SPIDER_LONGLONG_LEN + 1];
- uint32 length;
- DBUG_ENTER("spider_oracle_copy_table::append_limit");
- DBUG_PRINT("info",("spider this=%p", this));
- if (offset || limit < 9223372036854775807LL)
- {
- if (!select_rownum_appended)
- {
- select_rownum_appended = TRUE;
- table_name_pos = table_name_pos + pos_diff;
- if (sql.copy(sql_part))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- pos = pos + pos_diff;
- }
- if (offset)
- {
- if (sql.reserve(SPIDER_SQL_BETWEEN_LEN + SPIDER_SQL_AND_LEN +
- ((SPIDER_LONGLONG_LEN) * 2)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_BETWEEN_STR, SPIDER_SQL_BETWEEN_LEN);
- length = (uint32) (my_charset_bin.longlong10_to_str)(
- buf, SPIDER_LONGLONG_LEN + 1, -10, offset);
- sql.q_append(buf, length);
- sql.q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- length = (uint32) (my_charset_bin.longlong10_to_str)(
- buf, SPIDER_LONGLONG_LEN + 1, -10, limit);
- sql.q_append(buf, length);
- } else {
- if (sql.reserve(SPIDER_SQL_HS_LTEQUAL_LEN +
- (SPIDER_LONGLONG_LEN)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_HS_LTEQUAL_STR, SPIDER_SQL_HS_LTEQUAL_LEN);
- length = (uint32) (my_charset_bin.longlong10_to_str)(
- buf, SPIDER_LONGLONG_LEN + 1, -10, limit);
- sql.q_append(buf, length);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_into_str()
-{
- DBUG_ENTER("spider_oracle_copy_table::append_into_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_INTO_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_INTO_STR, SPIDER_SQL_INTO_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_open_paren_str()
-{
- DBUG_ENTER("spider_oracle_copy_table::append_open_paren_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_values_str()
-{
- DBUG_ENTER("spider_oracle_copy_table::append_values_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_CLOSE_PAREN_LEN + SPIDER_SQL_VALUES_LEN +
- SPIDER_SQL_OPEN_PAREN_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_CLOSE_PAREN_STR, SPIDER_SQL_CLOSE_PAREN_LEN);
- sql.q_append(SPIDER_SQL_VALUES_STR, SPIDER_SQL_VALUES_LEN);
- sql.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_select_lock_str(
- int lock_mode
-) {
- DBUG_ENTER("spider_oracle_copy_table::append_select_lock_str");
- DBUG_PRINT("info",("spider this=%p", this));
- if (select_rownum_appended)
- {
- int error_num;
- table_lock_mode = lock_mode;
- sql_part.length(0);
- if (sql_part.reserve(SPIDER_SQL_LOCK_TABLE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_LOCK_TABLE_STR, SPIDER_SQL_LOCK_TABLE_LEN);
- if ((error_num = oracle_share->append_table_name(&sql_part,
- store_link_idx)))
- DBUG_RETURN(error_num);
- if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE)
- {
- if (sql_part.reserve(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_STR,
- SPIDER_SQL_LOCK_TABLE_EXCLUSIVE_MODE_LEN);
- } else if (lock_mode == SPIDER_LOCK_MODE_SHARED)
- {
- if (sql_part.reserve(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql_part.q_append(SPIDER_SQL_LOCK_TABLE_SHARE_MODE_STR,
- SPIDER_SQL_LOCK_TABLE_SHARE_MODE_LEN);
- }
- } else {
- if (lock_mode == SPIDER_LOCK_MODE_EXCLUSIVE)
- {
- if (sql.reserve(SPIDER_SQL_FOR_UPDATE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN);
- } else if (lock_mode == SPIDER_LOCK_MODE_SHARED)
- {
- if (sql.reserve(SPIDER_SQL_FOR_UPDATE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_FOR_UPDATE_STR, SPIDER_SQL_FOR_UPDATE_LEN);
- }
- }
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::exec_query(
- SPIDER_CONN *conn,
- int quick_mode,
- int *need_mon
-) {
- int error_num = 0;
- DBUG_ENTER("spider_oracle_copy_table::exec_query");
- DBUG_PRINT("info",("spider this=%p", this));
- if (current_str)
- {
- spider_string *tmp_str = first_str;
- while (tmp_str && tmp_str != current_str)
- {
- if (
- (error_num = spider_db_query(conn, tmp_str->ptr(), tmp_str->length(),
- quick_mode, need_mon)) &&
- error_num != HA_ERR_FOUND_DUPP_KEY
- ) {
- break;
- }
- tmp_str = tmp_str->next;
- }
- if (tmp_str == current_str)
- {
- error_num = spider_db_query(conn, tmp_str->ptr(), tmp_str->length(),
- quick_mode, need_mon);
- }
- if (error_num == HA_ERR_FOUND_DUPP_KEY)
- error_num = 0;
- current_str = NULL;
- } else {
- if (table_lock_mode)
- {
- DBUG_PRINT("info",("spider table_lock_mode=%d", table_lock_mode));
- spider_db_oracle *db_conn = (spider_db_oracle *) conn->db_conn;
- db_conn->table_lock_mode = table_lock_mode;
- db_conn->exec_lock_sql = &sql_part;
- table_lock_mode = 0;
- }
- error_num = spider_db_query(conn, sql.ptr(), sql.length(), quick_mode,
- need_mon);
- }
- DBUG_RETURN(error_num);
-}
-
-int spider_oracle_copy_table::copy_key_row(
- spider_db_copy_table *source_ct,
- Field *field,
- ulong *row_pos,
- ulong *length,
- const char *joint_str,
- const int joint_length
-) {
- int error_num;
- spider_string *source_str = &((spider_oracle_copy_table *) source_ct)->sql;
- DBUG_ENTER("spider_oracle_copy_table::copy_key_row");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- if ((error_num = spider_db_append_name_with_quote_str(&sql,
- field->field_name, spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (sql.reserve(SPIDER_SQL_NAME_QUOTE_LEN + joint_length + *length +
- SPIDER_SQL_AND_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- sql.q_append(SPIDER_SQL_NAME_QUOTE_STR, SPIDER_SQL_NAME_QUOTE_LEN);
- sql.q_append(joint_str, joint_length);
- sql.q_append(source_str->ptr() + *row_pos, *length);
- sql.q_append(SPIDER_SQL_AND_STR, SPIDER_SQL_AND_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::copy_row(
- Field *field,
- SPIDER_DB_ROW *row
-) {
- int error_num;
- DBUG_ENTER("spider_oracle_copy_table::copy_row");
- DBUG_PRINT("info",("spider this=%p", this));
- if (row->is_null())
- {
- DBUG_PRINT("info",("spider column is null"));
- if (current_str->reserve(SPIDER_SQL_NULL_LEN + SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->q_append(SPIDER_SQL_NULL_STR, SPIDER_SQL_NULL_LEN);
- } else if (field->str_needs_quotes())
- {
- DBUG_PRINT("info",("spider str_needs_quotes"));
- if (current_str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->q_append(SPIDER_SQL_VALUE_QUOTE_STR,
- SPIDER_SQL_VALUE_QUOTE_LEN);
- if ((error_num = row->append_escaped_to_str(current_str,
- spider_dbton_oracle.dbton_id)))
- DBUG_RETURN(error_num);
- if (current_str->reserve(SPIDER_SQL_VALUE_QUOTE_LEN +
- SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->q_append(SPIDER_SQL_VALUE_QUOTE_STR,
- SPIDER_SQL_VALUE_QUOTE_LEN);
- } else {
- DBUG_PRINT("info",("spider without_quotes"));
- if ((error_num = row->append_to_str(current_str)))
- DBUG_RETURN(error_num);
- if (current_str->reserve(SPIDER_SQL_COMMA_LEN))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- current_str->q_append(SPIDER_SQL_COMMA_STR, SPIDER_SQL_COMMA_LEN);
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::copy_rows(
- TABLE *table,
- SPIDER_DB_ROW *row,
- ulong **last_row_pos,
- ulong **last_lengths
-) {
- int error_num;
- Field **field;
- ulong *lengths2, *row_pos2;
- DBUG_ENTER("spider_oracle_copy_table::copy_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!current_str)
- {
- if (!first_str)
- {
- if (!(first_str = new spider_string[1]))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- first_str->init_calc_mem(216);
- first_str->set_charset(sql.charset());
- if (first_str->reserve(sql.length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- first_str->q_append(sql.ptr(), sql.length());
- } else {
- first_str->length(sql.length());
- }
- current_str = first_str;
- } else {
- if (!current_str->next)
- {
- if (!(current_str->next = new spider_string[1]))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->next->init_calc_mem(217);
- current_str->next->set_charset(sql.charset());
- if (current_str->next->reserve(sql.length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->next->q_append(sql.ptr(), sql.length());
- } else {
- current_str->next->length(sql.length());
- }
- current_str = current_str->next;
- }
- row_pos2 = *last_row_pos;
- lengths2 = *last_lengths;
-
- for (
- field = table->field;
- *field;
- field++,
- lengths2++
- ) {
- *row_pos2 = current_str->length();
- if ((error_num =
- copy_row(*field, row)))
- DBUG_RETURN(error_num);
- *lengths2 = current_str->length() - *row_pos2 - SPIDER_SQL_COMMA_LEN;
- row->next();
- row_pos2++;
- }
- current_str->length(current_str->length() - SPIDER_SQL_COMMA_LEN);
- if (current_str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- current_str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- DBUG_PRINT("info",("spider current_str=%s", current_str->c_ptr_safe()));
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::copy_rows(
- TABLE *table,
- SPIDER_DB_ROW *row
-) {
- int error_num;
- Field **field;
- DBUG_ENTER("spider_oracle_copy_table::copy_rows");
- DBUG_PRINT("info",("spider this=%p", this));
- if (!current_str)
- {
- if (!first_str)
- {
- if (!(first_str = new spider_string[1]))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- first_str->init_calc_mem(218);
- first_str->set_charset(sql.charset());
- if (first_str->reserve(sql.length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- first_str->q_append(sql.ptr(), sql.length());
- } else {
- first_str->length(sql.length());
- }
- current_str = first_str;
- } else {
- if (!current_str->next)
- {
- if (!(current_str->next = new spider_string[1]))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->next->init_calc_mem(219);
- current_str->next->set_charset(sql.charset());
- if (current_str->next->reserve(sql.length()))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- current_str->next->q_append(sql.ptr(), sql.length());
- } else {
- current_str->next->length(sql.length());
- }
- current_str = current_str->next;
- }
-
- for (
- field = table->field;
- *field;
- field++
- ) {
- if ((error_num =
- copy_row(*field, row)))
- DBUG_RETURN(error_num);
- row->next();
- }
- current_str->length(current_str->length() - SPIDER_SQL_COMMA_LEN);
- if (current_str->reserve(SPIDER_SQL_CLOSE_PAREN_LEN))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- current_str->q_append(SPIDER_SQL_CLOSE_PAREN_STR,
- SPIDER_SQL_CLOSE_PAREN_LEN);
- DBUG_PRINT("info",("spider current_str=%s", current_str->c_ptr_safe()));
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::append_insert_terminator()
-{
- DBUG_ENTER("spider_oracle_copy_table::append_insert_terminator");
- DBUG_PRINT("info",("spider this=%p", this));
- DBUG_RETURN(0);
-}
-
-int spider_oracle_copy_table::copy_insert_values(
- spider_db_copy_table *source_ct
-) {
- spider_oracle_copy_table *tmp_ct = (spider_oracle_copy_table *) source_ct;
- spider_string *source_str = &tmp_ct->sql;
- int values_length = source_str->length() - tmp_ct->pos;
- const char *values_ptr = source_str->ptr() + tmp_ct->pos;
- DBUG_ENTER("spider_oracle_copy_table::copy_insert_values");
- DBUG_PRINT("info",("spider this=%p", this));
- if (sql.reserve(values_length))
- {
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- }
- sql.q_append(values_ptr, values_length);
- DBUG_RETURN(0);
-}
-#endif
diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h
deleted file mode 100644
index 357fee35c67..00000000000
--- a/storage/spider/spd_db_oracle.h
+++ /dev/null
@@ -1,1559 +0,0 @@
-/* Copyright (C) 2012-2018 Kentoku Shiba
-
- 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 */
-
-class spider_db_oracle;
-class spider_db_oracle_result;
-
-class spider_db_oracle_util: public spider_db_util
-{
-public:
- spider_db_oracle_util();
- ~spider_db_oracle_util();
- int append_name(
- spider_string *str,
- const char *name,
- uint name_length
- );
- int append_name_with_charset(
- spider_string *str,
- const char *name,
- uint name_length,
- CHARSET_INFO *name_charset
- );
- int append_escaped_name(
- spider_string *str,
- const char *name,
- uint name_length
- );
- int append_escaped_name_with_charset(
- spider_string *str,
- const char *name,
- uint name_length,
- CHARSET_INFO *name_charset
- );
- bool is_name_quote(
- const char head_code
- );
- int append_escaped_name_quote(
- spider_string *str
- );
- int append_column_value(
- ha_spider *spider,
- spider_string *str,
- Field *field,
- const uchar *new_ptr,
- CHARSET_INFO *access_charset
- );
- int append_from_with_alias(
- spider_string *str,
- const char **table_names,
- uint *table_name_lengths,
- const char **table_aliases,
- uint *table_alias_lengths,
- uint table_count,
- int *table_name_pos,
- bool over_write
- );
- int append_trx_isolation(
- spider_string *str,
- int trx_isolation
- );
- int append_autocommit(
- spider_string *str,
- bool autocommit
- );
- int append_sql_log_off(
- spider_string *str,
- bool sql_log_off
- );
- int append_wait_timeout(
- spider_string *str,
- int wait_timeout
- );
- int append_sql_mode(
- spider_string *str,
- sql_mode_t sql_mode
- );
- int append_time_zone(
- spider_string *str,
- Time_zone *time_zone
- );
- int append_start_transaction(
- spider_string *str
- );
- int append_xa_start(
- spider_string *str,
- XID *xid
- );
- int append_lock_table_head(
- spider_string *str
- );
- int append_lock_table_body(
- spider_string *str,
- const char *db_name,
- uint db_name_length,
- CHARSET_INFO *db_name_charset,
- const char *table_name,
- uint table_name_length,
- CHARSET_INFO *table_name_charset,
- int lock_type
- );
- int append_lock_table_tail(
- spider_string *str
- );
- int append_unlock_table(
- spider_string *str
- );
- int open_item_func(
- Item_func *item_func,
- ha_spider *spider,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
- );
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- int open_item_sum_func(
- Item_sum *item_sum,
- ha_spider *spider,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
- );
-#endif
- size_t escape_string(
- char *to,
- const char *from,
- size_t from_length,
- CHARSET_INFO *access_charset
- );
- int append_escaped_util(
- spider_string *to,
- String *from
- );
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
- int append_from_and_tables(
- ha_spider *spider,
- spider_fields *fields,
- spider_string *str,
- TABLE_LIST *table_list,
- uint table_count
- );
- int reappend_tables(
- spider_fields *fields,
- SPIDER_LINK_IDX_CHAIN *link_idx_chain,
- spider_string *str
- );
- int append_where(
- spider_string *str
- );
- int append_having(
- spider_string *str
- );
-#endif
-};
-
-class spider_db_oracle_row: public spider_db_row
-{
-public:
- spider_db_oracle *db_conn;
- spider_db_oracle_result *result;
- sb2 *ind;
- char **val;
- ub2 *rlen;
- sb2 *ind_first;
- char **val_first;
- ub2 *rlen_first;
- spider_string *val_str;
- spider_string *val_str_first;
- OCIDefine **defnp;
- OCILobLocator **lobhp;
- OCIParam **colhp;
- ub2 *coltp;
- ub2 *colsz;
- uint field_count;
- uint record_size;
- ulong *row_size;
- ulong *row_size_first;
- CHARSET_INFO *access_charset;
- bool cloned;
- spider_db_oracle_util util;
-
- spider_db_oracle_row();
- ~spider_db_oracle_row();
- int store_to_field(
- Field *field,
- CHARSET_INFO *access_charset
- );
- int append_to_str(
- spider_string *str
- );
- int append_escaped_to_str(
- spider_string *str,
- uint dbton_id
- );
- void first();
- void next();
- bool is_null();
- int val_int();
- double val_real();
- my_decimal *val_decimal(
- my_decimal *decimal_value,
- CHARSET_INFO *access_charset
- );
- SPIDER_DB_ROW *clone();
- int store_to_tmp_table(
- TABLE *tmp_table,
- spider_string *str
- );
- uint get_byte_size();
- /* for oracle */
- int init();
- void deinit();
- int define();
- int fetch();
-};
-
-class spider_db_oracle_result: public spider_db_result
-{
-public:
- spider_db_oracle *db_conn;
- OCIStmt *stmtp;
- uint field_count;
- CHARSET_INFO *access_charset;
- bool fetched;
- spider_db_oracle_row row;
- int store_error_num;
-
- spider_db_oracle_result(SPIDER_DB_CONN *in_db_conn);
- ~spider_db_oracle_result();
- bool has_result();
- void free_result();
- SPIDER_DB_ROW *current_row();
- SPIDER_DB_ROW *fetch_row();
- SPIDER_DB_ROW *fetch_row_from_result_buffer(
- spider_db_result_buffer *spider_res_buf
- );
- SPIDER_DB_ROW *fetch_row_from_tmp_table(
- TABLE *tmp_table
- );
- int fetch_table_status(
- int mode,
- ha_statistics &stat
- );
- int fetch_table_records(
- int mode,
- ha_rows &records
- );
- int fetch_table_cardinality(
- int mode,
- TABLE *table,
- longlong *cardinality,
- uchar *cardinality_upd,
- int bitmap_size
- );
- int fetch_table_mon_status(
- int &status
- );
- longlong num_rows();
- uint num_fields();
- void move_to_pos(
- longlong pos
- );
- int get_errno();
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
- int fetch_columns_for_discover_table_structure(
- spider_string *str,
- CHARSET_INFO *access_charset
- );
- int fetch_index_for_discover_table_structure(
- spider_string *str,
- CHARSET_INFO *access_charset
- );
- int fetch_table_for_discover_table_structure(
- spider_string *str,
- SPIDER_SHARE *spider_share,
- CHARSET_INFO *access_charset
- );
-#endif
- /* for oracle */
- int set_column_info();
-};
-
-class spider_db_oracle: public spider_db_conn
-{
-public:
- OCIEnv *envhp;
- OCIError *errhp;
- OCIServer *srvhp;
- OCISvcCtx *svchp;
- OCISession *usrhp;
- OCIStmt *stmtp;
- OCITrans *txnhp;
- spider_db_oracle_result *result;
- int stored_error_num;
- const char *stored_error;
- uint update_rows;
- int table_lock_mode;
- spider_string *exec_lock_sql;
- spider_db_oracle_util util;
- ulonglong stored_last_insert_id;
- HASH lock_table_hash;
- bool lock_table_hash_inited;
- uint lock_table_hash_id;
- const char *lock_table_hash_func_name;
- const char *lock_table_hash_file_name;
- ulong lock_table_hash_line_no;
- DYNAMIC_ARRAY handler_open_array;
- bool handler_open_array_inited;
- uint handler_open_array_id;
- const char *handler_open_array_func_name;
- const char *handler_open_array_file_name;
- ulong handler_open_array_line_no;
-
- /* for bg_connect */
- char stored_error_msg[MYSQL_ERRMSG_SIZE];
- char *tgt_host;
- char *tgt_username;
- char *tgt_password;
- long tgt_port;
- char *tgt_socket;
- char *server_name;
- int connect_retry_count;
- longlong connect_retry_interval;
-
- spider_db_oracle(
- SPIDER_CONN *conn
- );
- ~spider_db_oracle();
- int init();
- bool is_connected();
- void bg_connect();
- int connect(
- char *tgt_host,
- char *tgt_username,
- char *tgt_password,
- long tgt_port,
- char *tgt_socket,
- char *server_name,
- int connect_retry_count,
- longlong connect_retry_interval
- );
- int ping();
- void bg_disconnect();
- void disconnect();
- int set_net_timeout();
- int exec_query(
- const char *query,
- uint length,
- int quick_mode
- );
- int get_errno();
- const char *get_error();
- bool is_server_gone_error(
- int error_num
- );
- bool is_dup_entry_error(
- int error_num
- );
- bool is_xa_nota_error(
- int error_num
- );
- spider_db_result *store_result(
- spider_db_result_buffer **spider_res_buf,
- st_spider_db_request_key *request_key,
- int *error_num
- );
- spider_db_result *use_result(
- ha_spider *spider,
- st_spider_db_request_key *request_key,
- int *error_num
- );
- int next_result();
- uint affected_rows();
- uint matched_rows();
- bool inserted_info(
- spider_db_handler *handler,
- ha_copy_info *copy_info
- );
- ulonglong last_insert_id();
- int set_character_set(
- const char *csname
- );
- int select_db(
- const char *dbname
- );
- int consistent_snapshot(
- int *need_mon
- );
- bool trx_start_in_bulk_sql();
- int start_transaction(
- int *need_mon
- );
- int commit(
- int *need_mon
- );
- int rollback(
- int *need_mon
- );
- bool xa_start_in_bulk_sql();
- int xa_start(
- XID *xid,
- int *need_mon
- );
- int xa_end(
- XID *xid,
- int *need_mon
- );
- int xa_prepare(
- XID *xid,
- int *need_mon
- );
- int xa_commit(
- XID *xid,
- int *need_mon
- );
- int xa_rollback(
- XID *xid,
- int *need_mon
- );
- bool set_trx_isolation_in_bulk_sql();
- int set_trx_isolation(
- int trx_isolation,
- int *need_mon
- );
- bool set_autocommit_in_bulk_sql();
- int set_autocommit(
- bool autocommit,
- int *need_mon
- );
- bool set_sql_log_off_in_bulk_sql();
- int set_sql_log_off(
- bool sql_log_off,
- int *need_mon
- );
- bool set_wait_timeout_in_bulk_sql();
- int set_wait_timeout(
- int wait_timeout,
- int *need_mon
- );
- bool set_sql_mode_in_bulk_sql();
- int set_sql_mode(
- sql_mode_t sql_mode,
- int *need_mon
- );
- bool set_time_zone_in_bulk_sql();
- int set_time_zone(
- Time_zone *time_zone,
- int *need_mon
- );
- int show_master_status(
- SPIDER_TRX *trx,
- SPIDER_SHARE *share,
- int all_link_idx,
- int *need_mon,
- TABLE *table,
- spider_string *str,
- int mode,
- SPIDER_DB_RESULT **res1,
- SPIDER_DB_RESULT **res2
- );
- size_t escape_string(
- char *to,
- const char *from,
- size_t from_length
- );
- bool have_lock_table_list();
- int append_lock_tables(
- spider_string *str
- );
- int append_unlock_tables(
- spider_string *str
- );
- uint get_lock_table_hash_count();
- void reset_lock_table_hash();
- uint get_opened_handler_count();
- void reset_opened_handler();
- void set_dup_key_idx(
- ha_spider *spider,
- int link_idx
- );
- bool cmp_request_key_to_snd(
- st_spider_db_request_key *request_key
- );
-private:
- int set_error(
- sword res,
- dvoid *hndlp,
- int error_num,
- const char *error1,
- const char *error2
- );
-};
-
-class spider_oracle_share: public spider_db_share
-{
-public:
- spider_string *table_select;
- int table_select_pos;
- spider_string *key_select;
- int *key_select_pos;
- spider_string *key_hint;
- spider_string *show_table_status;
- spider_string *show_records;
- spider_string *show_autoinc;
- spider_string *show_last_insert_id;
- spider_string *show_index;
- spider_string *table_names_str;
- spider_string *db_names_str;
- spider_string *db_table_str;
- spider_string *nextval_str;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- my_hash_value_type *db_table_str_hash_value;
-#endif
- uint table_nm_max_length;
- uint db_nm_max_length;
- uint nextval_max_length;
- spider_string *column_name_str;
- bool same_db_table_name;
- int first_all_link_idx;
-
- spider_oracle_share(
- st_spider_share *share
- );
- ~spider_oracle_share();
- int init();
- uint get_column_name_length(
- uint field_index
- );
- int append_column_name(
- spider_string *str,
- uint field_index
- );
- int append_column_name_with_alias(
- spider_string *str,
- uint field_index,
- const char *alias,
- uint alias_length
- );
- int append_table_name(
- spider_string *str,
- int all_link_idx
- );
- int append_table_name_with_adjusting(
- spider_string *str,
- int all_link_idx
- );
- int append_from_with_adjusted_table_name(
- spider_string *str,
- int *table_name_pos
- );
- bool need_change_db_table_name();
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
- int discover_table_structure(
- SPIDER_TRX *trx,
- SPIDER_SHARE *spider_share,
- spider_string *str
- );
-#endif
-private:
- int create_table_names_str();
- void free_table_names_str();
- int create_column_name_str();
- void free_column_name_str();
- int convert_key_hint_str();
- int append_show_table_status();
- void free_show_table_status();
- int append_show_records();
- void free_show_records();
- int append_show_autoinc();
- void free_show_autoinc();
- int append_show_last_insert_id();
- void free_show_last_insert_id();
- int append_show_index();
- void free_show_index();
- int append_table_select();
- int append_key_select(
- uint idx
- );
-};
-
-class spider_oracle_handler: public spider_db_handler
-{
- spider_string sql;
- spider_string sql_part;
- spider_string sql_part2;
- spider_string ha_sql;
- int where_pos;
- int order_pos;
- int limit_pos;
-public:
- int table_name_pos;
-private:
- int update_set_pos;
- int ha_read_pos;
- int ha_next_pos;
- int ha_where_pos;
- int ha_limit_pos;
- int ha_table_name_pos;
- uint ha_sql_handler_id;
- spider_string insert_sql;
- int insert_pos;
- int insert_table_name_pos;
- int nextval_pos;
- spider_string update_sql;
- TABLE *upd_tmp_tbl;
- TMP_TABLE_PARAM upd_tmp_tbl_prm;
- spider_string tmp_sql;
- int tmp_sql_pos1; /* drop db nm pos at tmp_table_join */
- int tmp_sql_pos2; /* create db nm pos at tmp_table_join */
- int tmp_sql_pos3; /* insert db nm pos at tmp_table_join */
- int tmp_sql_pos4; /* insert val pos at tmp_table_join */
- int tmp_sql_pos5; /* end of drop tbl at tmp_table_join */
- spider_string dup_update_sql;
- spider_string *exec_sql;
- spider_string *exec_insert_sql;
- spider_string *exec_update_sql;
- spider_string *exec_tmp_sql;
- spider_string *exec_ha_sql;
- spider_string *exec_lock_sql;
- int table_lock_mode;
- bool reading_from_bulk_tmp_table;
- bool filled_up;
- bool select_rownum_appended;
- bool update_rownum_appended;
- SPIDER_INT_HLD *union_table_name_pos_first;
- SPIDER_INT_HLD *union_table_name_pos_current;
-public:
- spider_oracle_share *oracle_share;
- SPIDER_LINK_FOR_HASH *link_for_hash;
- uchar *minimum_select_bitmap;
- spider_oracle_handler(
- ha_spider *spider,
- spider_oracle_share *share
- );
- ~spider_oracle_handler();
- int init();
- int spider_oracle_handler::append_index_hint(
- spider_string *str,
- int link_idx,
- ulong sql_type
- );
- int append_table_name_with_adjusting(
- spider_string *str,
- int link_idx,
- ulong sql_type
- );
- int append_key_column_types(
- const key_range *start_key,
- spider_string *str
- );
- int append_key_join_columns_for_bka(
- const key_range *start_key,
- spider_string *str,
- const char **table_aliases,
- uint *table_alias_lengths
- );
- int append_tmp_table_and_sql_for_bka(
- const key_range *start_key
- );
- int reuse_tmp_table_and_sql_for_bka();
- void create_tmp_bka_table_name(
- char *tmp_table_name,
- int *tmp_table_name_length,
- int link_idx
- );
- int append_create_tmp_bka_table(
- const key_range *start_key,
- spider_string *str,
- char *tmp_table_name,
- int tmp_table_name_length,
- int *db_name_pos,
- CHARSET_INFO *table_charset
- );
- int append_drop_tmp_bka_table(
- spider_string *str,
- char *tmp_table_name,
- int tmp_table_name_length,
- int *db_name_pos,
- int *drop_table_end_pos,
- bool with_semicolon
- );
- int append_insert_tmp_bka_table(
- const key_range *start_key,
- spider_string *str,
- char *tmp_table_name,
- int tmp_table_name_length,
- int *db_name_pos
- );
- int append_union_table_and_sql_for_bka(
- const key_range *start_key
- );
- int reuse_union_table_and_sql_for_bka();
- int append_insert_for_recovery(
- ulong sql_type,
- int link_idx
- );
- int append_update(
- const TABLE *table,
- my_ptrdiff_t ptr_diff
- );
- int append_update(
- const TABLE *table,
- my_ptrdiff_t ptr_diff,
- int link_idx
- );
- int append_delete(
- const TABLE *table,
- my_ptrdiff_t ptr_diff
- );
- int append_delete(
- const TABLE *table,
- my_ptrdiff_t ptr_diff,
- int link_idx
- );
- int append_insert_part();
- int append_insert(
- spider_string *str,
- int link_idx
- );
- int append_update_part();
- int append_update(
- spider_string *str,
- int link_idx
- );
- int append_delete_part();
- int append_delete(
- spider_string *str
- );
- int append_update_set_part();
- int append_update_set(
- spider_string *str
- );
- #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
- int append_direct_update_set_part();
- int append_direct_update_set(
- spider_string *str
- );
- int append_dup_update_pushdown_part(
- const char *alias,
- uint alias_length
- );
- int append_update_columns_part(
- const char *alias,
- uint alias_length
- );
- int check_update_columns_part();
- int append_update_columns(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- #endif
- int append_select_part(
- ulong sql_type
- );
- int append_select(
- spider_string *str,
- ulong sql_type
- );
- int append_table_select_part(
- ulong sql_type
- );
- int append_table_select(
- spider_string *str
- );
- int append_key_select_part(
- ulong sql_type,
- uint idx
- );
- int append_key_select(
- spider_string *str,
- uint idx
- );
- int append_minimum_select_part(
- ulong sql_type
- );
- int append_minimum_select(
- spider_string *str,
- ulong sql_type
- );
- int append_table_select_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_key_select_with_alias(
- spider_string *str,
- const KEY *key_info,
- const char *alias,
- uint alias_length
- );
- int append_minimum_select_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_select_columns_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_hint_after_table_part(
- ulong sql_type
- );
- int append_hint_after_table(
- spider_string *str
- );
- void set_where_pos(
- ulong sql_type
- );
- void set_where_to_pos(
- ulong sql_type
- );
- int check_item_type(
- Item *item
- );
- int append_values_connector_part(
- ulong sql_type
- );
- int append_values_connector(
- spider_string *str
- );
- int append_values_terminator_part(
- ulong sql_type
- );
- int append_values_terminator(
- spider_string *str
- );
- int append_union_table_connector_part(
- ulong sql_type
- );
- int append_union_table_connector(
- spider_string *str
- );
- int append_union_table_terminator_part(
- ulong sql_type
- );
- int append_union_table_terminator(
- spider_string *str
- );
- int append_key_column_values_part(
- const key_range *start_key,
- ulong sql_type
- );
- int append_key_column_values(
- spider_string *str,
- const key_range *start_key
- );
- int append_key_column_values_with_name_part(
- const key_range *start_key,
- ulong sql_type
- );
- int append_key_column_values_with_name(
- spider_string *str,
- const key_range *start_key
- );
- int append_key_where_part(
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type
- );
- int append_key_where(
- spider_string *str,
- spider_string *str_part,
- spider_string *str_part2,
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type,
- bool set_order
- );
- int append_is_null_part(
- ulong sql_type,
- KEY_PART_INFO *key_part,
- const key_range *key,
- const uchar **ptr,
- bool key_eq,
- bool tgt_final
- );
- int append_is_null(
- ulong sql_type,
- spider_string *str,
- spider_string *str_part,
- spider_string *str_part2,
- KEY_PART_INFO *key_part,
- const key_range *key,
- const uchar **ptr,
- bool key_eq,
- bool tgt_final
- );
- int append_where_terminator_part(
- ulong sql_type,
- bool set_order,
- int key_count
- );
- int append_where_terminator(
- ulong sql_type,
- spider_string *str,
- spider_string *str_part,
- spider_string *str_part2,
- bool set_order,
- int key_count
- );
- int append_match_where_part(
- ulong sql_type
- );
- int append_match_where(
- spider_string *str
- );
- int append_update_where(
- spider_string *str,
- const TABLE *table,
- my_ptrdiff_t ptr_diff
- );
- int append_condition_part(
- const char *alias,
- uint alias_length,
- ulong sql_type,
- bool test_flg
- );
- int append_condition(
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool start_where,
- ulong sql_type
- );
- int append_match_against_part(
- ulong sql_type,
- st_spider_ft_info *ft_info,
- const char *alias,
- uint alias_length
- );
- int append_match_against(
- spider_string *str,
- st_spider_ft_info *ft_info,
- const char *alias,
- uint alias_length
- );
- int append_match_select_part(
- ulong sql_type,
- const char *alias,
- uint alias_length
- );
- int append_match_select(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- int append_sum_select_part(
- ulong sql_type,
- const char *alias,
- uint alias_length
- );
- int append_sum_select(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
-#endif
- void set_order_pos(
- ulong sql_type
- );
- void set_order_to_pos(
- ulong sql_type
- );
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
- int append_group_by_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
- );
- int append_group_by(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
-#endif
- int append_key_order_for_merge_with_alias_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
- );
- int append_key_order_for_merge_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_key_order_for_direct_order_limit_with_alias_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
- );
- int append_key_order_for_direct_order_limit_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_key_order_with_alias_part(
- const char *alias,
- uint alias_length,
- ulong sql_type
- );
- int append_key_order_for_handler(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_key_order_with_alias(
- spider_string *str,
- const char *alias,
- uint alias_length
- );
- int append_limit_part(
- longlong offset,
- longlong limit,
- ulong sql_type
- );
- int reappend_limit_part(
- longlong offset,
- longlong limit,
- ulong sql_type
- );
- int append_limit(
- spider_string *str,
- longlong offset,
- longlong limit
- );
- int append_select_lock_part(
- ulong sql_type
- );
- int append_select_lock(
- spider_string *str
- );
- int append_union_all_start_part(
- ulong sql_type
- );
- int append_union_all_start(
- spider_string *str
- );
- int append_union_all_part(
- ulong sql_type
- );
- int append_union_all(
- spider_string *str
- );
- int append_union_all_end_part(
- ulong sql_type
- );
- int append_union_all_end(
- spider_string *str
- );
- int append_multi_range_cnt_part(
- ulong sql_type,
- uint multi_range_cnt,
- bool with_comma
- );
- int append_multi_range_cnt(
- spider_string *str,
- uint multi_range_cnt,
- bool with_comma
- );
- int append_multi_range_cnt_with_name_part(
- ulong sql_type,
- uint multi_range_cnt
- );
- int append_multi_range_cnt_with_name(
- spider_string *str,
- uint multi_range_cnt
- );
- int append_open_handler_part(
- ulong sql_type,
- uint handler_id,
- SPIDER_CONN *conn,
- int link_idx
- );
- int append_open_handler(
- spider_string *str,
- uint handler_id,
- SPIDER_CONN *conn,
- int link_idx
- );
- int append_close_handler_part(
- ulong sql_type,
- int link_idx
- );
- int append_close_handler(
- spider_string *str,
- int link_idx
- );
- int append_insert_terminator_part(
- ulong sql_type
- );
- int append_insert_terminator(
- spider_string *str
- );
- int append_insert_values_part(
- ulong sql_type
- );
- int append_insert_values(
- spider_string *str
- );
- int append_into_part(
- ulong sql_type
- );
- int append_into(
- spider_string *str
- );
- void set_insert_to_pos(
- ulong sql_type
- );
- int append_from_part(
- ulong sql_type,
- int link_idx
- );
- int append_from(
- spider_string *str,
- ulong sql_type,
- int link_idx
- );
- int append_flush_tables_part(
- ulong sql_type,
- int link_idx,
- bool lock
- );
- int append_flush_tables(
- spider_string *str,
- int link_idx,
- bool lock
- );
- int append_optimize_table_part(
- ulong sql_type,
- int link_idx
- );
- int append_optimize_table(
- spider_string *str,
- int link_idx
- );
- int append_analyze_table_part(
- ulong sql_type,
- int link_idx
- );
- int append_analyze_table(
- spider_string *str,
- int link_idx
- );
- int append_repair_table_part(
- ulong sql_type,
- int link_idx,
- HA_CHECK_OPT* check_opt
- );
- int append_repair_table(
- spider_string *str,
- int link_idx,
- HA_CHECK_OPT* check_opt
- );
- int append_check_table_part(
- ulong sql_type,
- int link_idx,
- HA_CHECK_OPT* check_opt
- );
- int append_check_table(
- spider_string *str,
- int link_idx,
- HA_CHECK_OPT* check_opt
- );
- int append_enable_keys_part(
- ulong sql_type,
- int link_idx
- );
- int append_enable_keys(
- spider_string *str,
- int link_idx
- );
- int append_disable_keys_part(
- ulong sql_type,
- int link_idx
- );
- int append_disable_keys(
- spider_string *str,
- int link_idx
- );
- int append_delete_all_rows_part(
- ulong sql_type
- );
- int append_delete_all_rows(
- spider_string *str,
- ulong sql_type
- );
- int append_truncate(
- spider_string *str,
- ulong sql_type,
- int link_idx
- );
- int append_explain_select_part(
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type,
- int link_idx
- );
- int append_explain_select(
- spider_string *str,
- const key_range *start_key,
- const key_range *end_key,
- ulong sql_type,
- int link_idx
- );
- bool is_sole_projection_field(
- uint16 field_index
- );
- bool is_bulk_insert_exec_period(
- bool bulk_end
- );
- bool sql_is_filled_up(
- ulong sql_type
- );
- bool sql_is_empty(
- ulong sql_type
- );
- bool support_multi_split_read();
- bool support_bulk_update();
- int bulk_tmp_table_insert();
- int bulk_tmp_table_insert(
- int link_idx
- );
- int bulk_tmp_table_end_bulk_insert();
- int bulk_tmp_table_rnd_init();
- int bulk_tmp_table_rnd_next();
- int bulk_tmp_table_rnd_end();
- bool need_copy_for_update(
- int link_idx
- );
- bool bulk_tmp_table_created();
- int mk_bulk_tmp_table_and_bulk_start();
- void rm_bulk_tmp_table();
- int store_sql_to_bulk_tmp_table(
- spider_string *str,
- TABLE *tmp_table
- );
- int restore_sql_from_bulk_tmp_table(
- spider_string *str,
- TABLE *tmp_table
- );
- int insert_lock_tables_list(
- SPIDER_CONN *conn,
- int link_idx
- );
- int append_lock_tables_list(
- SPIDER_CONN *conn,
- int link_idx,
- int *appended
- );
- int realloc_sql(
- ulong *realloced
- );
- int reset_sql(
- ulong sql_type
- );
- bool need_lock_before_set_sql_for_exec(
- ulong sql_type
- );
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
- int set_sql_for_exec(
- ulong sql_type,
- int link_idx,
- SPIDER_LINK_IDX_CHAIN *link_idx_chain
- );
-#endif
- int set_sql_for_exec(
- ulong sql_type,
- int link_idx
- );
- int set_sql_for_exec(
- spider_db_copy_table *tgt_ct,
- ulong sql_type
- );
- int execute_sql(
- ulong sql_type,
- SPIDER_CONN *conn,
- int quick_mode,
- int *need_mon
- );
- int reset();
- int sts_mode_exchange(
- int sts_mode
- );
- int show_table_status(
- int link_idx,
- int sts_mode,
- uint flag
- );
- int crd_mode_exchange(
- int crd_mode
- );
- int show_index(
- int link_idx,
- int crd_mode
- );
- int show_records(
- int link_idx
- );
- int show_autoinc(
- int link_idx
- );
- int show_last_insert_id(
- int link_idx,
- ulonglong &last_insert_id
- );
- ha_rows explain_select(
- const key_range *start_key,
- const key_range *end_key,
- int link_idx
- );
- int lock_tables(
- int link_idx
- );
- int unlock_tables(
- int link_idx
- );
- int disable_keys(
- SPIDER_CONN *conn,
- int link_idx
- );
- int enable_keys(
- SPIDER_CONN *conn,
- int link_idx
- );
- int check_table(
- SPIDER_CONN *conn,
- int link_idx,
- HA_CHECK_OPT* check_opt
- );
- int repair_table(
- SPIDER_CONN *conn,
- int link_idx,
- HA_CHECK_OPT* check_opt
- );
- int analyze_table(
- SPIDER_CONN *conn,
- int link_idx
- );
- int optimize_table(
- SPIDER_CONN *conn,
- int link_idx
- );
- int flush_tables(
- SPIDER_CONN *conn,
- int link_idx,
- bool lock
- );
- int flush_logs(
- SPIDER_CONN *conn,
- int link_idx
- );
- int insert_opened_handler(
- SPIDER_CONN *conn,
- int link_idx
- );
- int delete_opened_handler(
- SPIDER_CONN *conn,
- int link_idx
- );
- int sync_from_clone_source(
- spider_db_handler *dbton_hdl
- );
- bool support_use_handler(
- int use_handler
- );
- void minimum_select_bitmap_create();
- bool minimum_select_bit_is_set(
- uint field_index
- );
- void copy_minimum_select_bitmap(
- uchar *bitmap
- );
- int init_union_table_name_pos();
- int set_union_table_name_pos();
- int reset_union_table_name(
- spider_string *str,
- int link_idx,
- ulong sql_type
- );
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
- int append_from_and_tables_part(
- spider_fields *fields,
- ulong sql_type
- );
- int reappend_tables_part(
- spider_fields *fields,
- ulong sql_type
- );
- int append_where_part(
- ulong sql_type
- );
- int append_having_part(
- ulong sql_type
- );
- int append_item_type_part(
- Item *item,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
- );
- int append_list_item_select_part(
- List<Item> *select,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
- );
- int append_list_item_select(
- List<Item> *select,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
- );
- int append_group_by_part(
- ORDER *order,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
- );
- int append_group_by(
- ORDER *order,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
- );
- int append_order_by_part(
- ORDER *order,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields,
- ulong sql_type
- );
- int append_order_by(
- ORDER *order,
- spider_string *str,
- const char *alias,
- uint alias_length,
- bool use_fields,
- spider_fields *fields
- );
-#endif
-};
-
-class spider_oracle_copy_table: public spider_db_copy_table
-{
-public:
- spider_oracle_share *oracle_share;
- spider_string sql;
- spider_string sql_part;
- uint pos;
- uint table_name_pos;
- uint pos_diff;
- int table_lock_mode;
- int store_link_idx;
- bool select_rownum_appended;
- spider_string *first_str;
- spider_string *current_str;
- spider_oracle_copy_table(
- spider_oracle_share *db_share
- );
- ~spider_oracle_copy_table();
- int init();
- void set_sql_charset(
- CHARSET_INFO *cs
- );
- int append_select_str();
- int append_insert_str(
- int insert_flg
- );
- int append_table_columns(
- TABLE_SHARE *table_share
- );
- int append_from_str();
- int append_table_name(
- int link_idx
- );
- void set_sql_pos();
- void set_sql_to_pos();
- int append_copy_where(
- spider_db_copy_table *source_ct,
- KEY *key_info,
- ulong *last_row_pos,
- ulong *last_lengths
- );
- int append_key_order_str(
- KEY *key_info,
- int start_pos,
- bool desc_flg
- );
- int append_limit(
- longlong offset,
- longlong limit
- );
- int append_into_str();
- int append_open_paren_str();
- int append_values_str();
- int append_select_lock_str(
- int lock_mode
- );
- int exec_query(
- SPIDER_CONN *conn,
- int quick_mode,
- int *need_mon
- );
- int copy_key_row(
- spider_db_copy_table *source_ct,
- Field *field,
- ulong *row_pos,
- ulong *length,
- const char *joint_str,
- const int joint_length
- );
- int copy_row(
- Field *field,
- SPIDER_DB_ROW *row
- );
- int copy_rows(
- TABLE *table,
- SPIDER_DB_ROW *row,
- ulong **last_row_pos,
- ulong **last_lengths
- );
- int copy_rows(
- TABLE *table,
- SPIDER_DB_ROW *row
- );
- int append_insert_terminator();
- int copy_insert_values(
- spider_db_copy_table *source_ct
- );
-};
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index 85d16c1f347..be26009e6f5 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -18,10 +18,6 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
@@ -29,7 +25,6 @@
#include "sql_base.h"
#include "sql_servers.h"
#include "tztime.h"
-#endif
#include "spd_err.h"
#include "spd_param.h"
#include "spd_db_include.h"
@@ -44,9 +39,7 @@
#include "spd_udf.h"
#include "spd_malloc.h"
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
-#endif
extern const char **spd_defaults_extra_file;
extern const char **spd_defaults_file;
@@ -115,21 +108,6 @@ int spider_udf_direct_sql_create_table_list(
} else
break;
}
-#if MYSQL_VERSION_ID < 50500
- if (!(direct_sql->db_names = (char**)
- spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL),
- &direct_sql->db_names, (uint) (sizeof(char*) * table_count),
- &direct_sql->table_names, (uint) (sizeof(char*) * table_count),
- &direct_sql->tables, (uint) (sizeof(TABLE*) * table_count),
- &tmp_name_ptr, (uint) (sizeof(char) * (
- table_name_list_length +
- thd->db_length * table_count +
- 2 * table_count
- )),
- &direct_sql->iop, (uint) (sizeof(int) * table_count),
- NullS))
- )
-#else
if (!(direct_sql->db_names = (char**)
spider_bulk_malloc(spider_current_trx, 31, MYF(MY_WME | MY_ZEROFILL),
&direct_sql->db_names, (uint) (sizeof(char*) * table_count),
@@ -146,7 +124,6 @@ int spider_udf_direct_sql_create_table_list(
(uint) (sizeof(uchar) * ((table_count + 7) / 8)),
NullS))
)
-#endif
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
tmp_ptr = table_name_list;
@@ -382,10 +359,8 @@ int spider_udf_direct_sql_create_conn_key(
tmp_name = strmov(tmp_name + 1, direct_sql->tgt_driver);
} else
tmp_name++;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
direct_sql->conn_key_hash_value = my_calc_hash(&spider_open_connections,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length);
-#endif
DBUG_RETURN(0);
}
@@ -578,12 +553,8 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
conn->semi_trx_chk = FALSE;
conn->conn_kind = SPIDER_CONN_KIND_MYSQL;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&conn->mta_conn_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mta_conn, &conn->mta_conn_mutex,
MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_mta_conn_mutex_init;
@@ -604,14 +575,9 @@ SPIDER_CONN *spider_udf_direct_sql_create_conn(
pthread_mutex_unlock(&spider_conn_id_mutex);
pthread_mutex_lock(&spider_ipport_conn_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search_using_hash_value(
&spider_ipport_conns, conn->conn_key_hash_value,
(uchar*)conn->conn_key, conn->conn_key_length)))
-#else
- if ((ip_port_conn = (SPIDER_IP_PORT_CONN*) my_hash_search(
- &spider_ipport_conns, (uchar*)conn->conn_key, conn->conn_key_length)))
-#endif
{ /* exists, +1 */
pthread_mutex_unlock(&spider_ipport_conn_mutex);
pthread_mutex_lock(&ip_port_conn->mutex);
@@ -668,18 +634,11 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
SPIDER_CONN *conn = NULL;
DBUG_ENTER("spider_udf_direct_sql_get_conn");
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (
!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
&trx->trx_conn_hash, direct_sql->conn_key_hash_value,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length))
)
-#else
- if (
- !(conn = (SPIDER_CONN*) my_hash_search(&trx->trx_conn_hash,
- (uchar*) direct_sql->conn_key, direct_sql->conn_key_length))
- )
-#endif
{
if (
(
@@ -688,14 +647,9 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
)
) {
pthread_mutex_lock(&spider_conn_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(conn = (SPIDER_CONN*) my_hash_search_using_hash_value(
&spider_open_connections, direct_sql->conn_key_hash_value,
(uchar*) direct_sql->conn_key, direct_sql->conn_key_length)))
-#else
- if (!(conn = (SPIDER_CONN*) my_hash_search(&spider_open_connections,
- (uchar*) direct_sql->conn_key, direct_sql->conn_key_length)))
-#endif
{
pthread_mutex_unlock(&spider_conn_mutex);
DBUG_PRINT("info",("spider create new conn"));
@@ -703,12 +657,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
error_num)))
goto error;
} else {
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_open_connections,
- conn->conn_key_hash_value, (uchar*) conn);
-#else
my_hash_delete(&spider_open_connections, (uchar*) conn);
-#endif
pthread_mutex_unlock(&spider_conn_mutex);
DBUG_PRINT("info",("spider get global conn"));
}
@@ -722,12 +671,7 @@ SPIDER_CONN *spider_udf_direct_sql_get_conn(
conn->priority = direct_sql->priority;
uint old_elements = trx->trx_conn_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&trx->trx_conn_hash,
- direct_sql->conn_key_hash_value, (uchar*) conn))
-#else
if (my_hash_insert(&trx->trx_conn_hash, (uchar*) conn))
-#endif
{
spider_free_conn(conn);
*error_num = HA_ERR_OUT_OF_MEM;
@@ -1025,10 +969,7 @@ int spider_udf_parse_direct_sql_param(
direct_sql->net_write_timeout = -1;
direct_sql->bulk_insert_rows = -1;
direct_sql->connection_channel = -1;
-#if MYSQL_VERSION_ID < 50500
-#else
direct_sql->use_real_table = -1;
-#endif
direct_sql->error_rw_mode = -1;
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
direct_sql->iop[roop_count] = -1;
@@ -1102,10 +1043,7 @@ int spider_udf_parse_direct_sql_param(
SPIDER_PARAM_STR("srv", server_name);
SPIDER_PARAM_INT_WITH_MAX("svc", tgt_ssl_vsc, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("tlm", table_loop_mode, 0, 2);
-#if MYSQL_VERSION_ID < 50500
-#else
SPIDER_PARAM_INT_WITH_MAX("urt", use_real_table, 0, 1);
-#endif
SPIDER_PARAM_INT("wto", net_write_timeout, 0);
error_num = param_string_parse.print_param_error();
goto error;
@@ -1155,10 +1093,7 @@ int spider_udf_parse_direct_sql_param(
error_num = param_string_parse.print_param_error();
goto error;
case 14:
-#if MYSQL_VERSION_ID < 50500
-#else
SPIDER_PARAM_INT_WITH_MAX("use_real_table", use_real_table, 0, 1);
-#endif
error_num = param_string_parse.print_param_error();
goto error;
case 15:
@@ -1445,11 +1380,8 @@ int spider_udf_set_direct_sql_param_default(
direct_sql->bulk_insert_rows = 3000;
if (direct_sql->connection_channel == -1)
direct_sql->connection_channel = 0;
-#if MYSQL_VERSION_ID < 50500
-#else
if (direct_sql->use_real_table == -1)
direct_sql->use_real_table = 0;
-#endif
if (direct_sql->error_rw_mode == -1)
direct_sql->error_rw_mode = 0;
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
@@ -1466,7 +1398,6 @@ void spider_udf_free_direct_sql_alloc(
) {
SPIDER_BG_DIRECT_SQL *bg_direct_sql;
DBUG_ENTER("spider_udf_free_direct_sql_alloc");
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (bg)
{
pthread_mutex_lock(direct_sql->bg_mutex);
@@ -1480,15 +1411,11 @@ void spider_udf_free_direct_sql_alloc(
pthread_cond_signal(direct_sql->bg_cond);
pthread_mutex_unlock(direct_sql->bg_mutex);
}
-#endif
-#if MYSQL_VERSION_ID < 50500
-#else
if (direct_sql->real_table_used && direct_sql->open_tables_thd)
{
spider_sys_close_table(direct_sql->open_tables_thd,
&direct_sql->open_tables_backup);
}
-#endif
if (direct_sql->server_name)
{
spider_free(spider_current_trx, direct_sql->server_name, MYF(0));
@@ -1584,11 +1511,8 @@ long long spider_direct_sql_body(
char *sql;
TABLE_LIST table_list;
SPIDER_BG_DIRECT_SQL *bg_direct_sql;
-#if MYSQL_VERSION_ID < 50500
-#else
TABLE_LIST *real_table_list_last = NULL;
uint use_real_table = 0;
-#endif
DBUG_ENTER("spider_direct_sql_body");
SPIDER_BACKUP_DASTATUS;
if (!(direct_sql = (SPIDER_DIRECT_SQL *)
@@ -1601,7 +1525,6 @@ long long spider_direct_sql_body(
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
goto error;
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (bg)
{
bg_direct_sql = (SPIDER_BG_DIRECT_SQL *) initid->ptr;
@@ -1619,7 +1542,6 @@ long long spider_direct_sql_body(
direct_sql->parent = bg_direct_sql;
bg_direct_sql->called_cnt++;
}
-#endif
if (!(trx = spider_get_trx(thd, TRUE, &error_num)))
{
if (error_num == HA_ERR_OUT_OF_MEM)
@@ -1672,11 +1594,8 @@ long long spider_direct_sql_body(
}
trx->updated_in_this_trx = TRUE;
DBUG_PRINT("info",("spider trx->updated_in_this_trx=TRUE"));
-#if MYSQL_VERSION_ID < 50500
-#else
use_real_table = spider_param_udf_ds_use_real_table(thd,
direct_sql->use_real_table);
-#endif
for (roop_count = 0; roop_count < direct_sql->table_count; roop_count++)
{
#ifdef SPIDER_NEED_INIT_ONE_TABLE_FOR_FIND_TEMPORARY_TABLE
@@ -1707,19 +1626,14 @@ long long spider_direct_sql_body(
if (!(direct_sql->tables[roop_count] =
spider_find_temporary_table(thd, &table_list)))
{
-#if MYSQL_VERSION_ID < 50500
-#else
if (!use_real_table)
{
-#endif
error_num = ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM;
my_printf_error(ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_NUM,
ER_SPIDER_UDF_TMP_TABLE_NOT_FOUND_STR,
MYF(0), SPIDER_TABLE_LIST_db_str(&table_list),
SPIDER_TABLE_LIST_table_name_str(&table_list));
goto error;
-#if MYSQL_VERSION_ID < 50500
-#else
}
TABLE_LIST *tables = &direct_sql->table_list[roop_count];
MDL_REQUEST_INIT(&tables->mdl_request, MDL_key::TABLE,
@@ -1735,7 +1649,6 @@ long long spider_direct_sql_body(
real_table_list_last = tables;
spider_set_bit(direct_sql->real_table_bitmap, roop_count);
direct_sql->real_table_used = TRUE;
-#endif
}
}
if ((error_num = spider_udf_direct_sql_create_conn_key(direct_sql)))
@@ -1766,7 +1679,6 @@ long long spider_direct_sql_body(
direct_sql->sql_length = 0;
direct_sql->sql = sql;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (bg)
{
if ((error_num = spider_udf_bg_direct_sql(direct_sql)))
@@ -1776,7 +1688,6 @@ long long spider_direct_sql_body(
goto error;
}
} else {
-#endif
if (conn->bg_init)
pthread_mutex_lock(&conn->bg_conn_mutex);
if ((error_num = spider_db_udf_direct_sql(direct_sql)))
@@ -1793,15 +1704,11 @@ long long spider_direct_sql_body(
pthread_mutex_unlock(&conn->bg_conn_mutex);
if (direct_sql->modified_non_trans_table)
thd->transaction->stmt.modified_non_trans_table = TRUE;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
if (!bg)
{
-#endif
spider_udf_free_direct_sql_alloc(direct_sql, FALSE);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
DBUG_RETURN(1);
error:
@@ -1842,7 +1749,6 @@ my_bool spider_direct_sql_init_body(
strcpy(message, "spider_(bg)_direct_sql() requires string arguments");
goto error;
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (bg)
{
if (!(bg_direct_sql = (SPIDER_BG_DIRECT_SQL *)
@@ -1852,37 +1758,26 @@ my_bool spider_direct_sql_init_body(
strcpy(message, "spider_bg_direct_sql() out of memory");
goto error;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&bg_direct_sql->bg_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_direct_sql,
&bg_direct_sql->bg_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
strcpy(message, "spider_bg_direct_sql() out of memory");
goto error_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&bg_direct_sql->bg_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_direct_sql,
&bg_direct_sql->bg_cond, NULL))
-#endif
{
strcpy(message, "spider_bg_direct_sql() out of memory");
goto error_cond_init;
}
initid->ptr = (char *) bg_direct_sql;
}
-#endif
DBUG_RETURN(FALSE);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
error_cond_init:
pthread_mutex_destroy(&bg_direct_sql->bg_mutex);
error_mutex_init:
spider_free(spider_current_trx, bg_direct_sql, MYF(0));
-#endif
error:
DBUG_RETURN(TRUE);
}
@@ -1910,7 +1805,6 @@ void spider_direct_sql_deinit_body(
DBUG_VOID_RETURN;
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
void spider_direct_sql_bg_start(
UDF_INIT *initid
) {
@@ -1999,4 +1893,3 @@ int spider_udf_bg_direct_sql(
}
DBUG_RETURN(0);
}
-#endif
diff --git a/storage/spider/spd_direct_sql.h b/storage/spider/spd_direct_sql.h
index bf3e24caa13..fa5f00f2431 100644
--- a/storage/spider/spd_direct_sql.h
+++ b/storage/spider/spd_direct_sql.h
@@ -60,8 +60,6 @@ void spider_udf_free_direct_sql_alloc(
my_bool bg
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_udf_bg_direct_sql(
SPIDER_DIRECT_SQL *direct_sql
);
-#endif
diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h
index 320b0edeb30..0caf23af64c 100644
--- a/storage/spider/spd_environ.h
+++ b/storage/spider/spd_environ.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
Define functionality offered by MySQL or MariaDB
@@ -20,42 +20,13 @@
#ifndef SPD_ENVIRON_INCLUDED
-#if (defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000)
-#define SPIDER_HANDLER_START_BULK_INSERT_HAS_FLAGS
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100
-#define SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
#define SPIDER_NET_HAS_THD
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100211
#define HANDLER_HAS_TOP_TABLE_FIELDS
-#define HANDLER_HAS_DIRECT_UPDATE_ROWS
-#define HANDLER_HAS_DIRECT_AGGREGATE
-#define PARTITION_HAS_GET_CHILD_HANDLERS
#define PARTITION_HAS_GET_PART_SPEC
#define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
-#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100300
#define SPIDER_UPDATE_ROW_HAS_CONST_NEW_DATA
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100309
#define SPIDER_MDEV_16246
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
-#define SPIDER_USE_CONST_ITEM_FOR_STRING_INT_REAL_DECIMAL_DATE_ITEM
-#define SPIDER_SQL_CACHE_IS_IN_LEX
#define SPIDER_LIKE_FUNC_HAS_GET_NEGATED
-#define HA_HAS_CHECKSUM_EXTENDED
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500
#define SPIDER_I_S_USE_SHOW_FOR_COLUMN
-#endif
#endif /* SPD_ENVIRON_INCLUDED */
diff --git a/storage/spider/spd_group_by_handler.cc b/storage/spider/spd_group_by_handler.cc
index f2722c85ccc..ca174d42e39 100644
--- a/storage/spider/spd_group_by_handler.cc
+++ b/storage/spider/spd_group_by_handler.cc
@@ -12,22 +12,17 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_partition.h"
#include "ha_partition.h"
-#endif
#include "sql_common.h"
#include <errmsg.h>
#include "spd_err.h"
@@ -1169,7 +1164,6 @@ int spider_fields::ping_table_mon_from_table(
DBUG_RETURN(error_num);
}
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
spider_group_by_handler::spider_group_by_handler(
THD *thd_arg,
Query *query_arg,
@@ -1247,10 +1241,8 @@ int spider_group_by_handler::init_scan()
for (link_idx = 0; link_idx < (int) share->link_count; ++link_idx)
spider->sql_kind[link_idx] = SPIDER_SQL_KIND_SQL;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
spider->do_direct_update = FALSE;
spider->direct_update_kinds = 0;
-#endif
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
direct_order_limit = spider_param_direct_order_limit(thd,
share->direct_order_limit);
@@ -1262,9 +1254,7 @@ int spider_group_by_handler::init_scan()
) {
result_list->internal_limit = select_limit /* + offset_limit */;
result_list->split_read = select_limit /* + offset_limit */;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
result_list->bgs_split_read = select_limit /* + offset_limit */;
-#endif
result_list->split_read_base = 9223372036854775807LL;
result_list->semi_split_read = 0;
@@ -1275,10 +1265,8 @@ int spider_group_by_handler::init_scan()
}
result_list->semi_split_read_base = 0;
result_list->set_split_read = TRUE;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_set_conn_bg_param(spider)))
DBUG_RETURN(error_num);
-#endif
DBUG_PRINT("info",("spider result_list.finish_flg = FALSE"));
result_list->finish_flg = FALSE;
result_list->record_num = 0;
@@ -1386,7 +1374,6 @@ int spider_group_by_handler::init_scan()
link_idx = link_idx_holder->link_idx;
dbton_hdl = spider->dbton_handler[conn->dbton_id];
spider->link_idx_chain = link_idx_chain;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (result_list->bgs_phase > 0)
{
if ((error_num = spider_check_and_init_casual_read(trx->thd, spider,
@@ -1410,7 +1397,6 @@ int spider_group_by_handler::init_scan()
DBUG_RETURN(error_num);
}
} else {
-#endif
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
if (dbton_hdl->need_lock_before_set_sql_for_exec(
SPIDER_SQL_TYPE_SELECT_SQL))
@@ -1516,9 +1502,7 @@ int spider_group_by_handler::init_scan()
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
pthread_mutex_unlock(&conn->mta_conn_mutex);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
}
-#endif
}
first = TRUE;
@@ -1557,7 +1541,6 @@ int spider_group_by_handler::next_row()
table->status = STATUS_NOT_FOUND;
DBUG_RETURN(spider->store_error_num);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (spider->result_list.bgs_phase > 0)
{
fields->set_pos_to_first_link_idx_chain();
@@ -1586,7 +1569,6 @@ int spider_group_by_handler::next_row()
}
}
}
-#endif
spider->use_pre_call = FALSE;
}
} else if (offset_limit)
@@ -1646,7 +1628,6 @@ group_by_handler *spider_create_group_by_handler(
break;
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
from = query->from;
do {
DBUG_PRINT("info",("spider from=%p", from));
@@ -1655,23 +1636,16 @@ group_by_handler *spider_create_group_by_handler(
if (from->table->part_info)
{
DBUG_PRINT("info",("spider partition handler"));
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
partition_info *part_info = from->table->part_info;
uint bits = bitmap_bits_set(&part_info->read_partitions);
DBUG_PRINT("info",("spider bits=%u", bits));
if (bits != 1)
{
DBUG_PRINT("info",("spider using multiple partitions is not supported by this feature yet"));
-#else
- DBUG_PRINT("info",("spider partition is not supported by this feature yet"));
-#endif
DBUG_RETURN(NULL);
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
}
-#endif
}
} while ((from = from->next_local));
-#endif
table_idx = 0;
from = query->from;
@@ -1684,7 +1658,6 @@ group_by_handler *spider_create_group_by_handler(
/* all tables are const_table */
DBUG_RETURN(NULL);
}
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
if (from->table->part_info)
{
partition_info *part_info = from->table->part_info;
@@ -1693,11 +1666,8 @@ group_by_handler *spider_create_group_by_handler(
handler **handlers = partition->get_child_handlers();
spider = (ha_spider *) handlers[part];
} else {
-#endif
spider = (ha_spider *) from->table->file;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
}
-#endif
share = spider->share;
spider->idx_for_direct_join = table_idx;
++table_idx;
@@ -1716,7 +1686,6 @@ group_by_handler *spider_create_group_by_handler(
{
if (from->table->const_table)
continue;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
if (from->table->part_info)
{
partition_info *part_info = from->table->part_info;
@@ -1725,11 +1694,8 @@ group_by_handler *spider_create_group_by_handler(
handler **handlers = partition->get_child_handlers();
spider = (ha_spider *) handlers[part];
} else {
-#endif
spider = (ha_spider *) from->table->file;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
}
-#endif
share = spider->share;
spider->idx_for_direct_join = table_idx;
++table_idx;
@@ -1755,7 +1721,6 @@ group_by_handler *spider_create_group_by_handler(
do {
if (from->table->const_table)
continue;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
if (from->table->part_info)
{
partition_info *part_info = from->table->part_info;
@@ -1764,11 +1729,8 @@ group_by_handler *spider_create_group_by_handler(
handler **handlers = partition->get_child_handlers();
spider = (ha_spider *) handlers[part];
} else {
-#endif
spider = (ha_spider *) from->table->file;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
}
-#endif
share = spider->share;
if (spider_param_skip_default_condition(thd,
share->skip_default_condition))
@@ -1911,7 +1873,6 @@ group_by_handler *spider_create_group_by_handler(
{
from = from->next_local;
}
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
if (from->table->part_info)
{
partition_info *part_info = from->table->part_info;
@@ -1920,11 +1881,8 @@ group_by_handler *spider_create_group_by_handler(
handler **handlers = partition->get_child_handlers();
spider = (ha_spider *) handlers[part];
} else {
-#endif
spider = (ha_spider *) from->table->file;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
}
-#endif
share = spider->share;
lock_mode = spider_conn_lock_mode(spider);
if (lock_mode)
@@ -2006,7 +1964,6 @@ group_by_handler *spider_create_group_by_handler(
continue;
fields->clear_conn_holder_from_conn();
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
if (from->table->part_info)
{
partition_info *part_info = from->table->part_info;
@@ -2015,11 +1972,8 @@ group_by_handler *spider_create_group_by_handler(
handler **handlers = partition->get_child_handlers();
spider = (ha_spider *) handlers[part];
} else {
-#endif
spider = (ha_spider *) from->table->file;
-#if defined(PARTITION_HAS_GET_CHILD_HANDLERS)
}
-#endif
share = spider->share;
if (!fields->add_table(spider))
{
@@ -2143,4 +2097,3 @@ group_by_handler *spider_create_group_by_handler(
query->order_by = NULL;
DBUG_RETURN(group_by_handler);
}
-#endif
diff --git a/storage/spider/spd_group_by_handler.h b/storage/spider/spd_group_by_handler.h
index 09f82168708..b8e85a3d417 100644
--- a/storage/spider/spd_group_by_handler.h
+++ b/storage/spider/spd_group_by_handler.h
@@ -11,9 +11,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
class spider_group_by_handler: public group_by_handler
{
Query query;
@@ -41,4 +40,3 @@ group_by_handler *spider_create_group_by_handler(
THD *thd,
Query *query
);
-#endif
diff --git a/storage/spider/spd_i_s.cc b/storage/spider/spd_i_s.cc
index 24000f3e6c1..22cd8eb0f15 100644
--- a/storage/spider/spd_i_s.cc
+++ b/storage/spider/spd_i_s.cc
@@ -18,16 +18,11 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_partition.h"
#include "sql_show.h"
-#endif
#include "spd_db_include.h"
#include "spd_include.h"
#include "spd_table.h"
@@ -162,12 +157,9 @@ struct st_mysql_plugin spider_i_s_alloc_mem =
NULL,
NULL,
NULL,
-#if MYSQL_VERSION_ID >= 50600
0,
-#endif
};
-#ifdef MARIADB_BASE_VERSION
struct st_maria_plugin spider_i_s_alloc_mem_maria =
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
@@ -184,7 +176,6 @@ struct st_maria_plugin spider_i_s_alloc_mem_maria =
"1.0",
MariaDB_PLUGIN_MATURITY_STABLE,
};
-#endif
extern SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
@@ -286,12 +277,9 @@ struct st_mysql_plugin spider_i_s_wrapper_protocols =
NULL,
NULL,
NULL,
-#if MYSQL_VERSION_ID >= 50600
0,
-#endif
};
-#ifdef MARIADB_BASE_VERSION
struct st_maria_plugin spider_i_s_wrapper_protocols_maria =
{
MYSQL_INFORMATION_SCHEMA_PLUGIN,
@@ -308,4 +296,3 @@ struct st_maria_plugin spider_i_s_wrapper_protocols_maria =
"1.0",
MariaDB_PLUGIN_MATURITY_STABLE,
};
-#endif
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index dde20098a4a..917b3bfe6ec 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -14,14 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
-#define SPIDER_DETAIL_VERSION "3.3.15"
-#define SPIDER_HEX_VERSION 0x0303
-
-#if MYSQL_VERSION_ID < 50500
-#define spider_my_free(A,B) my_free(A,B)
-#define pthread_mutex_assert_owner(A)
-#define pthread_mutex_assert_not_owner(A)
-#else
+#define SPIDER_DETAIL_VERSION PACKAGE_VERSION
+#define SPIDER_HEX_VERSION (MYSQL_VERSION_MAJOR << 8 | MYSQL_VERSION_MINOR)
+
#define spider_my_free(A,B) my_free(A)
#ifdef pthread_mutex_t
#undef pthread_mutex_t
@@ -70,129 +65,49 @@
#endif
#define pthread_cond_destroy mysql_cond_destroy
#define my_sprintf(A,B) sprintf B
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100004
#define spider_stmt_da_message(A) thd_get_error_message(A)
#define spider_stmt_da_sql_errno(A) thd_get_error_number(A)
#define spider_user_defined_key_parts(A) (A)->user_defined_key_parts
#define spider_join_table_count(A) (A)->table_count
#define SPIDER_CAN_BG_UPDATE (1LL << 39)
-#if MYSQL_VERSION_ID >= 100304
#define SPIDER_ALTER_PARTITION_ADD ALTER_PARTITION_ADD
#define SPIDER_ALTER_PARTITION_DROP ALTER_PARTITION_DROP
#define SPIDER_ALTER_PARTITION_COALESCE ALTER_PARTITION_COALESCE
#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_PARTITION_REORGANIZE
#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_PARTITION_TABLE_REORG
#define SPIDER_ALTER_PARTITION_REBUILD ALTER_PARTITION_REBUILD
-#else
-#define SPIDER_ALTER_PARTITION_ADD Alter_info::ALTER_ADD_PARTITION
-#define SPIDER_ALTER_PARTITION_DROP Alter_info::ALTER_DROP_PARTITION
-#define SPIDER_ALTER_PARTITION_COALESCE Alter_info::ALTER_COALESCE_PARTITION
-#define SPIDER_ALTER_PARTITION_REORGANIZE Alter_info::ALTER_REORGANIZE_PARTITION
-#define SPIDER_ALTER_PARTITION_TABLE_REORG Alter_info::ALTER_TABLE_REORG
-#define SPIDER_ALTER_PARTITION_REBUILD Alter_info::ALTER_REBUILD_PARTITION
-#endif
#define SPIDER_WARN_LEVEL_WARN Sql_condition::WARN_LEVEL_WARN
#define SPIDER_WARN_LEVEL_NOTE Sql_condition::WARN_LEVEL_NOTE
#define SPIDER_THD_KILL_CONNECTION KILL_CONNECTION
-#else
-#if MYSQL_VERSION_ID < 50500
-#define spider_stmt_da_message(A) (A)->main_da.message()
-#define spider_stmt_da_sql_errno(A) (A)->main_da.sql_errno()
-#else
-#if MYSQL_VERSION_ID < 50600
-#define spider_stmt_da_message(A) (A)->stmt_da->message()
-#define spider_stmt_da_sql_errno(A) (A)->stmt_da->sql_errno()
-#else
-#define spider_stmt_da_message(A) (A)->get_stmt_da()->message()
-#define spider_stmt_da_sql_errno(A) (A)->get_stmt_da()->sql_errno()
-#endif
-#endif
-#define spider_user_defined_key_parts(A) (A)->key_parts
-#define spider_join_table_count(A) (A)->tables
-#define SPIDER_ALTER_PARTITION_ADD ALTER_ADD_PARTITION
-#define SPIDER_ALTER_PARTITION_DROP ALTER_DROP_PARTITION
-#define SPIDER_ALTER_PARTITION_COALESCE ALTER_COALESCE_PARTITION
-#define SPIDER_ALTER_PARTITION_REORGANIZE ALTER_REORGANIZE_PARTITION
-#define SPIDER_ALTER_PARTITION_TABLE_REORG ALTER_TABLE_REORG
-#define SPIDER_ALTER_PARTITION_REBUILD ALTER_REBUILD_PARTITION
-#define SPIDER_WARN_LEVEL_WARN MYSQL_ERROR::WARN_LEVEL_WARN
-#define SPIDER_WARN_LEVEL_NOTE MYSQL_ERROR::WARN_LEVEL_NOTE
-#define SPIDER_THD_KILL_CONNECTION THD::KILL_CONNECTION
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100005
#define SPIDER_HAS_EXPLAIN_QUERY
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100009
#define SPIDER_TEST(A) MY_TEST(A)
-#else
-#define SPIDER_TEST(A) test(A)
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100100
#define SPIDER_FIELD_FIELDPTR_REQUIRES_THDPTR
#define SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#define SPIDER_XID_USES_xid_cache_iterate
-#else
-#define SPIDER_XID_STATE_HAS_in_thd
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
#define SPIDER_Item_args_arg_count_IS_PROTECTED
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100112
#define SPIDER_Item_func_conv_charset_conv_charset collation.collation
-#else
-#define SPIDER_Item_func_conv_charset_conv_charset conv_charset
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200
#define SPIDER_WITHOUT_HA_STATISTIC_INCREMENT
#define SPIDER_init_read_record(A,B,C,D,E,F,G,H) init_read_record(A,B,C,D,E,F,G,H)
#define SPIDER_HAS_NEXT_THREAD_ID
#define SPIDER_new_THD(A) (new THD(A))
#define SPIDER_order_direction_is_asc(A) (A->direction == ORDER::ORDER_ASC)
-#else
-#define SPIDER_init_read_record(A,B,C,D,E,F,G,H) init_read_record(A,B,C,D,F,G,H)
-#define SPIDER_new_THD(A) (new THD())
-#define SPIDER_order_direction_is_asc(A) (A->asc)
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100201
#define SPIDER_HAS_MY_CHARLEN
#define SPIDER_open_temporary_table
-#endif
-#if defined(MARIADB_BASE_VERSION)
-#if MYSQL_VERSION_ID >= 100209
#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(A,B,C,E,F,G)
-#elif MYSQL_VERSION_ID >= 100200
-#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(A,B,C,D,E,F,G,H)
-#elif MYSQL_VERSION_ID >= 100007
-#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(B,C,D,E,F,G,H)
-#else
-#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H) generate_partition_syntax(B,C,D,E,F,G)
-#endif
-#else
-#define SPIDER_generate_partition_syntax(A,B,C,D,E,F,G,H)
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100209
#define SPIDER_create_partition_name(A,B,C,D,E,F) create_partition_name(A,B,C,D,E,F)
#define SPIDER_create_subpartition_name(A,B,C,D,E,F) create_subpartition_name(A,B,C,D,E,F)
#define SPIDER_free_part_syntax(A,B)
-#else
-#define SPIDER_create_partition_name(A,B,C,D,E,F) create_partition_name(A,C,D,E,F)
-#define SPIDER_create_subpartition_name(A,B,C,D,E,F) create_subpartition_name(A,C,D,E,F)
-#define SPIDER_free_part_syntax(A,B) spider_my_free(A,B)
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100306
#define SPIDER_read_record_read_record(A) read_record()
#define SPIDER_has_Item_with_subquery
#define SPIDER_use_LEX_CSTRING_for_KEY_Field_name
@@ -211,46 +126,13 @@
#define SPIDER_item_name_str(A) (A)->name.str
#define SPIDER_item_name_length(A) (A)->name.length
const LEX_CSTRING SPIDER_empty_string = {"", 0};
-#else
-#define SPIDER_read_record_read_record(A) read_record(A)
-#define SPIDER_THD_db_str(A) (A)->db
-#define SPIDER_THD_db_length(A) (A)->db_length
-#define SPIDER_TABLE_LIST_db_str(A) (A)->db
-#define SPIDER_TABLE_LIST_db_length(A) (A)->db_length
-#define SPIDER_TABLE_LIST_table_name_str(A) (A)->table_name
-#define SPIDER_TABLE_LIST_table_name_length(A) (A)->table_name_length
-#define SPIDER_TABLE_LIST_alias_str(A) (A)->alias
-#define SPIDER_TABLE_LIST_alias_length(A) strlen((A)->alias)
-#define SPIDER_field_name_str(A) (A)->field_name
-#define SPIDER_field_name_length(A) strlen((A)->field_name)
-#define SPIDER_item_name_str(A) (A)->name
-#define SPIDER_item_name_length(A) strlen((A)->name)
-const char SPIDER_empty_string = "";
-#endif
-#if MYSQL_VERSION_ID >= 50500
-#define SPIDER_HAS_HASH_VALUE_TYPE
-#endif
-
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100400
#define SPIDER_date_mode_t(A) date_mode_t(A)
#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime_or_date(A,B,C,D,E)
#define SPIDER_get_linkage(A) A->get_linkage()
-#else
-#define SPIDER_date_mode_t(A) A
-#define SPIDER_str_to_datetime(A,B,C,D,E) str_to_datetime(A,B,C,D,E)
-#define SPIDER_get_linkage(A) A->linkage
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500
typedef start_new_trans *SPIDER_Open_tables_backup;
-#elif MYSQL_VERSION_ID < 50500
-typedef Open_tables_state SPIDER_Open_tables_backup;
-#else
-typedef Open_tables_backup SPIDER_Open_tables_backup;
-#endif
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100500
#define SPIDER_reset_n_backup_open_tables_state(A,B,C) do { \
if (!(*(B) = new start_new_trans(A))) \
{ \
@@ -262,12 +144,6 @@ typedef Open_tables_backup SPIDER_Open_tables_backup;
delete *(B); \
} while (0)
#define SPIDER_sys_close_thread_tables(A) (A)->commit_whole_transaction_and_close_tables()
-#else
-#define SPIDER_REQUIRE_DEFINE_FOR_SECONDARY_OPEN_TABLES_BACKUP
-#define SPIDER_reset_n_backup_open_tables_state(A,B,C) (A)->reset_n_backup_open_tables_state(B)
-#define SPIDER_restore_backup_open_tables_state(A,B) (A)->restore_backup_open_tables_state(B)
-#define SPIDER_sys_close_thread_tables(A) close_thread_tables(A)
-#endif
#define spider_bitmap_size(A) ((A + 7) / 8)
#define spider_set_bit(BITMAP, BIT) \
@@ -316,7 +192,6 @@ typedef struct st_spider_share SPIDER_SHARE;
typedef struct st_spider_table_mon_list SPIDER_TABLE_MON_LIST;
typedef struct st_spider_ip_port_conn SPIDER_IP_PORT_CONN;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
typedef struct st_spider_thread
{
uint thread_idx;
@@ -333,7 +208,6 @@ typedef struct st_spider_thread
volatile SPIDER_SHARE *queue_first;
volatile SPIDER_SHARE *queue_last;
} SPIDER_THREAD;
-#endif
typedef struct st_spider_file_pos
{
@@ -348,9 +222,7 @@ typedef struct st_spider_link_for_hash
ha_spider *spider;
int link_idx;
spider_string *db_table_str;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type db_table_str_hash_value;
-#endif
} SPIDER_LINK_FOR_HASH;
/* alter table */
@@ -360,9 +232,7 @@ typedef struct st_spider_alter_table
char *table_name;
uint table_name_length;
char *tmp_char;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_name_hash_value;
-#endif
longlong tmp_priority;
uint link_count;
uint all_link_count;
@@ -464,9 +334,7 @@ typedef struct st_spider_conn
uint conn_kind;
char *conn_key;
uint conn_key_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type conn_key_hash_value;
-#endif
int link_idx;
spider_db_conn *db_conn;
uint opened_handlers;
@@ -552,11 +420,8 @@ typedef struct st_spider_conn
uint tgt_driver_length;
uint dbton_id;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
void *quick_target;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile bool bg_init;
volatile bool bg_break;
volatile bool bg_kill;
@@ -587,10 +452,7 @@ typedef struct st_spider_conn
const char *bg_job_stack_file_name;
ulong bg_job_stack_line_no;
uint bg_job_stack_cur_pos;
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile
-#endif
int *need_mon;
int *conn_need_mon;
@@ -622,12 +484,6 @@ typedef struct st_spider_conn
Time_zone *queued_time_zone_val;
XID *queued_xa_start_xid;
-#ifdef HA_CAN_BULK_ACCESS
- uint bulk_access_requests;
- uint bulk_access_sended;
- int bulk_access_error_num;
- st_spider_conn *bulk_access_next;
-#endif
bool disable_connect_retry; /* TRUE if it is unnecessary to
retry to connect after a
@@ -639,10 +495,8 @@ typedef struct st_spider_conn
query_id_t connect_error_query_id;
time_t connect_error_time;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
SPIDER_CONN_HOLDER *conn_holder_for_direct_join;
SPIDER_LINK_IDX_CHAIN *link_idx_chain;
-#endif
SPIDER_IP_PORT_CONN *ip_port_conn;
pthread_mutex_t loop_check_mutex;
@@ -666,16 +520,13 @@ typedef struct st_spider_lgtm_tblhnd_share
{
char *table_name;
uint table_name_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_path_hash_value;
-#endif
pthread_mutex_t auto_increment_mutex;
volatile bool auto_increment_init;
volatile ulonglong auto_increment_lclval;
ulonglong auto_increment_value;
} SPIDER_LGTM_TBLHND_SHARE;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
typedef struct st_spider_patition_handler
{
bool clone_bitmap_init;
@@ -685,15 +536,12 @@ typedef struct st_spider_patition_handler
ha_spider *owner;
ha_spider **handlers;
} SPIDER_PARTITION_HANDLER;
-#endif
typedef struct st_spider_wide_share
{
char *table_name;
uint table_name_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_path_hash_value;
-#endif
uint use_count;
THR_LOCK lock;
pthread_mutex_t sts_mutex;
@@ -736,13 +584,9 @@ typedef struct st_spider_wide_handler
uchar *rnd_write_bitmap;
SPIDER_CONDITION *condition;
void *owner;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER *partition_handler;
-#endif
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
List<Item> *direct_update_fields;
List<Item> *direct_update_values;
-#endif
TABLE_SHARE *top_share;
enum thr_lock_type lock_type;
uchar lock_table_type;
@@ -751,14 +595,9 @@ typedef struct st_spider_wide_handler
int cond_check_error;
uint sql_command;
uint top_table_fields;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef INFO_KIND_FORCE_LIMIT_BEGIN
longlong info_limit;
#endif
-#endif
-#ifdef HA_CAN_BULK_ACCESS
- ulonglong external_lock_cnt;
-#endif
bool between_flg;
bool idx_bitmap_is_set;
bool rnd_bitmap_is_set;
@@ -796,9 +635,6 @@ typedef struct st_spider_transaction
bool updated_in_this_trx;
THD *thd;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- my_hash_value_type thd_hash_value;
-#endif
XID xid;
HASH trx_conn_hash;
uint trx_conn_hash_id;
@@ -833,10 +669,6 @@ typedef struct st_spider_transaction
ulonglong direct_aggregate_count;
ulonglong parallel_search_count;
-#ifdef HA_CAN_BULK_ACCESS
- SPIDER_CONN *bulk_access_conn_first;
- SPIDER_CONN *bulk_access_conn_last;
-#endif
pthread_mutex_t *udf_table_mutexes;
CHARSET_INFO *udf_access_charset;
@@ -884,12 +716,8 @@ typedef struct st_spider_share
*/
TABLE_SHARE *table_share;
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_name_hash_value;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
my_hash_value_type table_path_hash_value;
-#endif
-#endif
volatile bool init;
volatile bool init_error;
@@ -898,13 +726,10 @@ typedef struct st_spider_share
uchar *table_mon_mutex_bitmap;
volatile bool sts_init;
volatile time_t sts_get_time;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile time_t bg_sts_try_time;
volatile double bg_sts_interval;
volatile int bg_sts_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
volatile int bg_sts_sync;
-#endif
volatile bool bg_sts_init;
volatile bool bg_sts_kill;
volatile bool bg_sts_thd_wait;
@@ -913,15 +738,11 @@ typedef struct st_spider_share
pthread_cond_t bg_sts_cond;
pthread_cond_t bg_sts_sync_cond;
volatile bool crd_init;
-#endif
volatile time_t crd_get_time;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile time_t bg_crd_try_time;
volatile double bg_crd_interval;
volatile int bg_crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
volatile int bg_crd_sync;
-#endif
volatile bool bg_crd_init;
volatile bool bg_crd_kill;
volatile bool bg_crd_thd_wait;
@@ -929,8 +750,6 @@ typedef struct st_spider_share
pthread_t bg_crd_thread;
pthread_cond_t bg_crd_cond;
pthread_cond_t bg_crd_sync_cond;
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
volatile bool bg_mon_init;
volatile bool bg_mon_kill;
THD **bg_mon_thds;
@@ -938,8 +757,6 @@ typedef struct st_spider_share
pthread_mutex_t *bg_mon_mutexes;
pthread_cond_t *bg_mon_conds;
pthread_cond_t *bg_mon_sleep_conds;
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
/* static bg thread for sts and crd */
TABLE table;
ha_spider *sts_spider;
@@ -956,7 +773,6 @@ typedef struct st_spider_share
volatile SPIDER_SHARE *sts_next;
volatile SPIDER_SHARE *crd_prev;
volatile SPIDER_SHARE *crd_next;
-#endif
MEM_ROOT mem_root;
@@ -978,24 +794,16 @@ typedef struct st_spider_share
longlong additional_table_flags;
bool have_recovery_link;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int sts_bg_mode;
-#endif
double sts_interval;
int sts_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int sts_sync;
-#endif
int store_last_sts;
int load_sts_at_startup;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int crd_bg_mode;
-#endif
double crd_interval;
int crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int crd_sync;
-#endif
int store_last_crd;
int load_crd_at_startup;
int crd_type;
@@ -1029,11 +837,9 @@ typedef struct st_spider_share
int low_mem_read;
int table_count_mode;
int select_column_mode;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int bgs_mode;
longlong bgs_first_read;
longlong bgs_second_read;
-#endif
longlong first_read;
longlong second_read;
int auto_increment_mode;
@@ -1047,9 +853,6 @@ typedef struct st_spider_share
int error_read_mode;
int error_write_mode;
int active_link_count;
-#ifdef HA_CAN_BULK_ACCESS
- int bulk_access_free;
-#endif
#ifdef HA_CAN_FORCE_BULK_UPDATE
int force_bulk_update;
#endif
@@ -1063,9 +866,7 @@ typedef struct st_spider_share
char *bka_engine;
int bka_engine_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type *conn_keys_hash_value;
-#endif
char **server_names;
char **tgt_table_names;
char **tgt_dbs;
@@ -1091,16 +892,12 @@ typedef struct st_spider_share
long *tgt_ports;
long *tgt_ssl_vscs;
long *link_statuses;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
long *monitoring_bg_flag;
long *monitoring_bg_kind;
-#endif
long *monitoring_binlog_pos_at_failing;
long *monitoring_flag;
long *monitoring_kind;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
longlong *monitoring_bg_interval;
-#endif
longlong *monitoring_limit;
longlong *monitoring_sid;
long *use_handlers;
@@ -1183,16 +980,12 @@ typedef struct st_spider_share
uint tgt_ports_length;
uint tgt_ssl_vscs_length;
uint link_statuses_length;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
uint monitoring_bg_flag_length;
uint monitoring_bg_kind_length;
-#endif
uint monitoring_binlog_pos_at_failing_length;
uint monitoring_flag_length;
uint monitoring_kind_length;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
uint monitoring_bg_interval_length;
-#endif
uint monitoring_limit_length;
uint monitoring_sid_length;
uint use_handlers_length;
@@ -1227,9 +1020,7 @@ typedef struct st_spider_init_error_table
{
char *table_name;
uint table_name_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type table_name_hash_value;
-#endif
bool init_error_with_message;
char init_error_msg[MYSQL_ERRMSG_SIZE];
volatile int init_error;
@@ -1244,8 +1035,6 @@ typedef struct st_spider_direct_sql
TABLE **tables;
int *iop;
-#if MYSQL_VERSION_ID < 50500
-#else
/* for using real table */
bool real_table_used;
TABLE_LIST *table_list_first;
@@ -1253,7 +1042,6 @@ typedef struct st_spider_direct_sql
uchar *real_table_bitmap;
SPIDER_Open_tables_backup open_tables_backup;
THD *open_tables_thd;
-#endif
char *sql;
ulong sql_length;
@@ -1270,10 +1058,7 @@ typedef struct st_spider_direct_sql
int net_write_timeout;
longlong bulk_insert_rows;
int connection_channel;
-#if MYSQL_VERSION_ID < 50500
-#else
int use_real_table;
-#endif
int error_rw_mode;
char *server_name;
@@ -1316,9 +1101,7 @@ typedef struct st_spider_direct_sql
uint tgt_driver_length;
uint conn_key_length;
uint dbton_id;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type conn_key_hash_value;
-#endif
pthread_mutex_t *bg_mutex;
pthread_cond_t *bg_cond;
@@ -1356,9 +1139,7 @@ typedef struct st_spider_table_mon_list
{
char *key;
uint key_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type key_hash_value;
-#endif
uint use_count;
uint mutex_hash;
@@ -1392,9 +1173,7 @@ typedef struct st_spider_copy_table_conn
spider_db_copy_table *copy_table;
ha_spider *spider;
int need_mon;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int bg_error_num;
-#endif
st_spider_copy_table_conn *next;
} SPIDER_COPY_TABLE_CONN;
@@ -1419,9 +1198,7 @@ typedef struct st_spider_copy_tables
longlong bulk_insert_rows;
int use_table_charset;
int use_transaction;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int bg_mode;
-#endif
char *database;
@@ -1447,17 +1224,6 @@ typedef struct st_spider_trx_ha
bool wait_for_reusing;
} SPIDER_TRX_HA;
-#ifdef HA_CAN_BULK_ACCESS
-typedef struct st_spider_bulk_access_link
-{
- ha_spider *spider;
- uint sequence_num;
- bool used;
- bool called;
- MEM_ROOT mem_root;
- st_spider_bulk_access_link *next;
-} SPIDER_BULK_ACCESS_LINK;
-#endif
#define SPIDER_INT_HLD_TGT_SIZE 100
typedef struct st_spider_int_hld
@@ -1487,9 +1253,7 @@ char *spider_create_string(
typedef struct st_spider_ip_port_conn {
char *key;
size_t key_len;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type key_hash_value;
-#endif
char *remote_ip_str;
long remote_port;
ulong ip_port_count;
diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h
index 1cf987134f6..e66e94d8373 100644
--- a/storage/spider/spd_init_query.h
+++ b/storage/spider/spd_init_query.h
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/*
This SQL script creates system tables for SPIDER
diff --git a/storage/spider/spd_malloc.cc b/storage/spider/spd_malloc.cc
index 8a99e648afc..56f8218853b 100644
--- a/storage/spider/spd_malloc.cc
+++ b/storage/spider/spd_malloc.cc
@@ -18,15 +18,10 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_analyse.h"
-#endif
#include "spd_db_include.h"
#include "spd_include.h"
#include "spd_malloc.h"
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index b14c19fc2c2..c1b84ed4452 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -17,15 +17,10 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_partition.h"
-#endif
#include <my_getopt.h>
#include "spd_err.h"
#include "spd_db_include.h"
@@ -36,15 +31,12 @@
extern struct st_mysql_plugin spider_i_s_alloc_mem;
extern struct st_mysql_plugin spider_i_s_wrapper_protocols;
-#ifdef MARIADB_BASE_VERSION
extern struct st_maria_plugin spider_i_s_alloc_mem_maria;
extern struct st_maria_plugin spider_i_s_wrapper_protocols_maria;
-#endif
extern volatile ulonglong spider_mon_table_cache_version;
extern volatile ulonglong spider_mon_table_cache_version_req;
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
static int spider_direct_update(THD *thd, SHOW_VAR *var, char *buff)
{
int error_num = 0;
@@ -66,7 +58,6 @@ static int spider_direct_delete(THD *thd, SHOW_VAR *var, char *buff)
var->value = (char *) &trx->direct_delete_count;
DBUG_RETURN(error_num);
}
-#endif
static int spider_direct_order_limit(THD *thd, SHOW_VAR *var, char *buff)
{
@@ -107,7 +98,6 @@ struct st_mysql_show_var spider_status_variables[] =
(char *) &spider_mon_table_cache_version, SHOW_LONGLONG},
{"Spider_mon_table_cache_version_req",
(char *) &spider_mon_table_cache_version_req, SHOW_LONGLONG},
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
#ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC
{"Spider_direct_update", (char *) &spider_direct_update, SHOW_SIMPLE_FUNC},
{"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_SIMPLE_FUNC},
@@ -115,7 +105,6 @@ struct st_mysql_show_var spider_status_variables[] =
{"Spider_direct_update", (char *) &spider_direct_update, SHOW_FUNC},
{"Spider_direct_delete", (char *) &spider_direct_delete, SHOW_FUNC},
#endif
-#endif
#ifdef SPIDER_HAS_SHOW_SIMPLE_FUNC
{"Spider_direct_order_limit",
(char *) &spider_direct_order_limit, SHOW_SIMPLE_FUNC},
@@ -135,13 +124,8 @@ struct st_mysql_show_var spider_status_variables[] =
};
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int);
-#if MYSQL_VERSION_ID < 50500
-extern bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
- const char *name, long long val);
-#else
extern bool throw_bounds_warning(THD *thd, const char *name, bool fixed,
bool is_unsignd, longlong v);
-#endif
static my_bool spider_support_xa;
static MYSQL_SYSVAR_BOOL(
@@ -742,14 +726,9 @@ static int spider_param_semi_table_lock_check(
(long) ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->blk_sz;
options.arg_type = REQUIRED_ARG;
*((int *) save) = (int) getopt_ll_limit_value(tmp, &options, &fixed);
-#if MYSQL_VERSION_ID < 50500
- DBUG_RETURN(throw_bounds_warning(thd, fixed, FALSE,
- ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, (long long) tmp));
-#else
DBUG_RETURN(throw_bounds_warning(thd,
((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, fixed, FALSE,
(longlong) tmp));
-#endif
}
/*
@@ -806,14 +785,9 @@ static int spider_param_semi_table_lock_connection_check(
(long) ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->blk_sz;
options.arg_type = REQUIRED_ARG;
*((int *) save) = (int) getopt_ll_limit_value(tmp, &options, &fixed);
-#if MYSQL_VERSION_ID < 50500
- DBUG_RETURN(throw_bounds_warning(thd, fixed, FALSE,
- ((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, (long long) tmp));
-#else
DBUG_RETURN(throw_bounds_warning(thd,
((MYSQL_SYSVAR_NAME(thdvar_int_t) *) var)->name, fixed, FALSE,
(longlong) tmp));
-#endif
}
/*
@@ -1448,7 +1422,6 @@ int spider_param_select_column_mode(
select_column_mode : THDVAR(thd, select_column_mode));
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
/*
-1 :use table parameter
0 :background search is disabled
@@ -1528,7 +1501,6 @@ longlong spider_param_bgs_second_read(
DBUG_RETURN(THDVAR(thd, bgs_second_read) < 0 ?
bgs_second_read : THDVAR(thd, bgs_second_read));
}
-#endif
/*
-1 :use table parameter
@@ -1636,7 +1608,6 @@ int spider_param_crd_mode(
crd_mode : THDVAR(thd, crd_mode));
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
-1 :use table parameter
0 :No synchronization.
@@ -1664,7 +1635,6 @@ int spider_param_crd_sync(
DBUG_RETURN(THDVAR(thd, crd_sync) == -1 ?
crd_sync : THDVAR(thd, crd_sync));
}
-#endif
/*
-1 :use table parameter
@@ -1718,7 +1688,6 @@ double spider_param_crd_weight(
crd_weight : THDVAR(thd, crd_weight));
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
/*
-1 :use table parameter
0 :Background confirmation is disabled
@@ -1745,7 +1714,6 @@ int spider_param_crd_bg_mode(
DBUG_RETURN(THDVAR(thd, crd_bg_mode) == -1 ?
crd_bg_mode : THDVAR(thd, crd_bg_mode));
}
-#endif
/*
-1 :use table parameter
@@ -1800,7 +1768,6 @@ int spider_param_sts_mode(
sts_mode : THDVAR(thd, sts_mode));
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
-1 :use table parameter
0 :No synchronization.
@@ -1828,9 +1795,7 @@ int spider_param_sts_sync(
DBUG_RETURN(THDVAR(thd, sts_sync) == -1 ?
sts_sync : THDVAR(thd, sts_sync));
}
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
/*
-1 :use table parameter
0 :Background confirmation is disabled
@@ -1857,7 +1822,6 @@ int spider_param_sts_bg_mode(
DBUG_RETURN(THDVAR(thd, sts_bg_mode) == -1 ?
sts_bg_mode : THDVAR(thd, sts_bg_mode));
}
-#endif
/*
0 :always ping
@@ -2102,19 +2066,6 @@ int spider_param_udf_ds_table_loop_mode(
static char *spider_remote_access_charset;
/*
*/
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-static MYSQL_SYSVAR_STR(
- remote_access_charset,
- spider_remote_access_charset,
- PLUGIN_VAR_MEMALLOC |
- PLUGIN_VAR_RQCMDARG,
- "Set remote access charset at connecting for improvement performance of connection if you know",
- NULL,
- NULL,
- NULL
-);
-#else
-#ifdef PLUGIN_VAR_CAN_MEMALLOC
static MYSQL_SYSVAR_STR(
remote_access_charset,
spider_remote_access_charset,
@@ -2125,18 +2076,6 @@ static MYSQL_SYSVAR_STR(
NULL,
NULL
);
-#else
-static MYSQL_SYSVAR_STR(
- remote_access_charset,
- spider_remote_access_charset,
- PLUGIN_VAR_RQCMDARG,
- "Set remote access charset at connecting for improvement performance of connection if you know",
- NULL,
- NULL,
- NULL
-);
-#endif
-#endif
char *spider_param_remote_access_charset()
{
@@ -2172,19 +2111,6 @@ int spider_param_remote_autocommit()
static char *spider_remote_time_zone;
/*
*/
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-static MYSQL_SYSVAR_STR(
- remote_time_zone,
- spider_remote_time_zone,
- PLUGIN_VAR_MEMALLOC |
- PLUGIN_VAR_RQCMDARG,
- "Set remote time_zone at connecting for improvement performance of connection if you know",
- NULL,
- NULL,
- NULL
-);
-#else
-#ifdef PLUGIN_VAR_CAN_MEMALLOC
static MYSQL_SYSVAR_STR(
remote_time_zone,
spider_remote_time_zone,
@@ -2195,18 +2121,6 @@ static MYSQL_SYSVAR_STR(
NULL,
NULL
);
-#else
-static MYSQL_SYSVAR_STR(
- remote_time_zone,
- spider_remote_time_zone,
- PLUGIN_VAR_RQCMDARG,
- "Set remote time_zone at connecting for improvement performance of connection if you know",
- NULL,
- NULL,
- NULL
-);
-#endif
-#endif
char *spider_param_remote_time_zone()
{
@@ -2269,7 +2183,6 @@ int spider_param_remote_trx_isolation()
static char *spider_remote_default_database;
/*
*/
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
static MYSQL_SYSVAR_STR(
remote_default_database,
spider_remote_default_database,
@@ -2280,30 +2193,6 @@ static MYSQL_SYSVAR_STR(
NULL,
NULL
);
-#else
-#ifdef PLUGIN_VAR_CAN_MEMALLOC
-static MYSQL_SYSVAR_STR(
- remote_default_database,
- spider_remote_default_database,
- PLUGIN_VAR_MEMALLOC |
- PLUGIN_VAR_RQCMDARG,
- "Set remote database at connecting for improvement performance of connection if you know",
- NULL,
- NULL,
- NULL
-);
-#else
-static MYSQL_SYSVAR_STR(
- remote_default_database,
- spider_remote_default_database,
- PLUGIN_VAR_RQCMDARG,
- "Set remote database at connecting for improvement performance of connection if you know",
- NULL,
- NULL,
- NULL
-);
-#endif
-#endif
char *spider_param_remote_default_database()
{
@@ -2361,7 +2250,6 @@ int spider_param_connect_retry_count(
/*
*/
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
static MYSQL_THDVAR_STR(
bka_engine, /* name */
PLUGIN_VAR_MEMALLOC |
@@ -2371,28 +2259,6 @@ static MYSQL_THDVAR_STR(
NULL, /* update */
NULL /* def */
);
-#else
-#ifdef PLUGIN_VAR_CAN_MEMALLOC
-static MYSQL_THDVAR_STR(
- bka_engine, /* name */
- PLUGIN_VAR_MEMALLOC |
- PLUGIN_VAR_RQCMDARG,
- "Temporary table's engine for BKA", /* comment */
- NULL, /* check */
- NULL, /* update */
- NULL /* def */
-);
-#else
-static MYSQL_THDVAR_STR(
- bka_engine, /* name */
- PLUGIN_VAR_RQCMDARG,
- "Temporary table's engine for BKA", /* comment */
- NULL, /* check */
- NULL, /* update */
- NULL /* def */
-);
-#endif
-#endif
char *spider_param_bka_engine(
THD *thd,
@@ -2665,37 +2531,7 @@ int spider_param_read_only_mode(
read_only_mode : THDVAR(thd, read_only_mode));
}
-#ifdef HA_CAN_BULK_ACCESS
-static int spider_bulk_access_free;
-/*
- -1 :use table parameter
- 0 :in reset
- 1 :in close
- */
-static MYSQL_SYSVAR_INT(
- bulk_access_free,
- spider_bulk_access_free,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Free mode of bulk access resources",
- NULL,
- NULL,
- -1,
- -1,
- 1,
- 0
-);
-int spider_param_bulk_access_free(
- int bulk_access_free
-) {
- DBUG_ENTER("spider_param_bulk_access_free");
- DBUG_RETURN(spider_bulk_access_free == -1 ?
- bulk_access_free : spider_bulk_access_free);
-}
-#endif
-
-#if MYSQL_VERSION_ID < 50500
-#else
/*
-1 :use UDF parameter
0 :can not use
@@ -2721,7 +2557,6 @@ int spider_param_udf_ds_use_real_table(
DBUG_RETURN(THDVAR(thd, udf_ds_use_real_table) == -1 ?
udf_ds_use_real_table : THDVAR(thd, udf_ds_use_real_table));
}
-#endif
static my_bool spider_general_log;
static MYSQL_SYSVAR_BOOL(
@@ -2853,17 +2688,6 @@ uint spider_param_log_result_error_with_sql()
DBUG_RETURN(spider_log_result_error_with_sql);
}
-static char *spider_version = (char *) SPIDER_DETAIL_VERSION;
-static MYSQL_SYSVAR_STR(
- version,
- spider_version,
- PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
- "The version of Spider",
- NULL,
- NULL,
- SPIDER_DETAIL_VERSION
-);
-
/*
0: server_id + thread_id
1: server_id + thread_id + query_id
@@ -3115,7 +2939,6 @@ int spider_param_load_crd_at_startup(
load_crd_at_startup : spider_load_crd_at_startup);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
static uint spider_table_sts_thread_count;
/*
1-: thread count
@@ -3161,7 +2984,6 @@ uint spider_param_table_crd_thread_count()
DBUG_ENTER("spider_param_table_crd_thread_count");
DBUG_RETURN(spider_table_crd_thread_count);
}
-#endif
static int spider_slave_trx_isolation;
/*
@@ -3338,35 +3160,25 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(quick_page_byte),
MYSQL_SYSVAR(low_mem_read),
MYSQL_SYSVAR(select_column_mode),
-#ifndef WITHOUT_SPIDER_BG_SEARCH
MYSQL_SYSVAR(bgs_mode),
MYSQL_SYSVAR(bgs_first_read),
MYSQL_SYSVAR(bgs_second_read),
-#endif
MYSQL_SYSVAR(first_read),
MYSQL_SYSVAR(second_read),
MYSQL_SYSVAR(crd_interval),
MYSQL_SYSVAR(crd_mode),
-#ifdef WITH_PARTITION_STORAGE_ENGINE
MYSQL_SYSVAR(crd_sync),
-#endif
MYSQL_SYSVAR(store_last_crd),
MYSQL_SYSVAR(load_crd_at_startup),
MYSQL_SYSVAR(crd_type),
MYSQL_SYSVAR(crd_weight),
-#ifndef WITHOUT_SPIDER_BG_SEARCH
MYSQL_SYSVAR(crd_bg_mode),
-#endif
MYSQL_SYSVAR(sts_interval),
MYSQL_SYSVAR(sts_mode),
-#ifdef WITH_PARTITION_STORAGE_ENGINE
MYSQL_SYSVAR(sts_sync),
-#endif
MYSQL_SYSVAR(store_last_sts),
MYSQL_SYSVAR(load_sts_at_startup),
-#ifndef WITHOUT_SPIDER_BG_SEARCH
MYSQL_SYSVAR(sts_bg_mode),
-#endif
MYSQL_SYSVAR(ping_interval_at_trx_start),
MYSQL_SYSVAR(auto_increment_mode),
MYSQL_SYSVAR(same_server_link),
@@ -3397,20 +3209,13 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(skip_parallel_search),
MYSQL_SYSVAR(direct_order_limit),
MYSQL_SYSVAR(read_only_mode),
-#ifdef HA_CAN_BULK_ACCESS
- MYSQL_SYSVAR(bulk_access_free),
-#endif
-#if MYSQL_VERSION_ID < 50500
-#else
MYSQL_SYSVAR(udf_ds_use_real_table),
-#endif
MYSQL_SYSVAR(general_log),
MYSQL_SYSVAR(index_hint_pushdown),
MYSQL_SYSVAR(max_connections),
MYSQL_SYSVAR(conn_wait_timeout),
MYSQL_SYSVAR(log_result_errors),
MYSQL_SYSVAR(log_result_error_with_sql),
- MYSQL_SYSVAR(version),
MYSQL_SYSVAR(internal_xa_id_type),
MYSQL_SYSVAR(casual_read),
MYSQL_SYSVAR(dry_access),
@@ -3418,10 +3223,8 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR(bka_table_name_type),
MYSQL_SYSVAR(use_cond_other_than_pk_for_update),
MYSQL_SYSVAR(connect_error_interval),
-#ifndef WITHOUT_SPIDER_BG_SEARCH
MYSQL_SYSVAR(table_sts_thread_count),
MYSQL_SYSVAR(table_crd_thread_count),
-#endif
MYSQL_SYSVAR(slave_trx_isolation),
MYSQL_SYSVAR(remote_wait_timeout),
MYSQL_SYSVAR(wait_timeout),
@@ -3444,15 +3247,12 @@ mysql_declare_plugin(spider)
spider_status_variables,
spider_system_variables,
NULL,
-#if MYSQL_VERSION_ID >= 50600
0,
-#endif
},
spider_i_s_alloc_mem,
spider_i_s_wrapper_protocols
mysql_declare_plugin_end;
-#ifdef MARIADB_BASE_VERSION
maria_declare_plugin(spider)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -3472,4 +3272,3 @@ maria_declare_plugin(spider)
spider_i_s_alloc_mem_maria,
spider_i_s_wrapper_protocols_maria
maria_declare_plugin_end;
-#endif
diff --git a/storage/spider/spd_param.h b/storage/spider/spd_param.h
index a6a9dd80026..0c5392e302a 100644
--- a/storage/spider/spd_param.h
+++ b/storage/spider/spd_param.h
@@ -182,7 +182,6 @@ int spider_param_select_column_mode(
THD *thd,
int select_column_mode
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_param_bgs_mode(
THD *thd,
int bgs_mode
@@ -195,7 +194,6 @@ longlong spider_param_bgs_second_read(
THD *thd,
longlong bgs_second_read
);
-#endif
longlong spider_param_first_read(
THD *thd,
longlong first_read
@@ -212,12 +210,10 @@ int spider_param_crd_mode(
THD *thd,
int crd_mode
);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int spider_param_crd_sync(
THD *thd,
int crd_sync
);
-#endif
int spider_param_crd_type(
THD *thd,
int crd_type
@@ -226,12 +222,10 @@ double spider_param_crd_weight(
THD *thd,
double crd_weight
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_param_crd_bg_mode(
THD *thd,
int crd_bg_mode
);
-#endif
double spider_param_sts_interval(
THD *thd,
double sts_interval
@@ -240,18 +234,14 @@ int spider_param_sts_mode(
THD *thd,
int sts_mode
);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int spider_param_sts_sync(
THD *thd,
int sts_sync
);
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_param_sts_bg_mode(
THD *thd,
int sts_bg_mode
);
-#endif
double spider_param_ping_interval_at_trx_start(
THD *thd
);
@@ -337,18 +327,10 @@ int spider_param_read_only_mode(
THD *thd,
int read_only_mode
);
-#ifdef HA_CAN_BULK_ACCESS
-int spider_param_bulk_access_free(
- int bulk_access_free
-);
-#endif
-#if MYSQL_VERSION_ID < 50500
-#else
int spider_param_udf_ds_use_real_table(
THD *thd,
int udf_ds_use_real_table
);
-#endif
my_bool spider_param_general_log();
my_bool spider_param_index_hint_pushdown(
THD *thd
@@ -389,10 +371,8 @@ int spider_param_load_sts_at_startup(
int spider_param_load_crd_at_startup(
int load_crd_at_startup
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
uint spider_param_table_sts_thread_count();
uint spider_param_table_crd_thread_count();
-#endif
int spider_param_slave_trx_isolation();
int spider_param_remote_wait_timeout(
THD *thd
diff --git a/storage/spider/spd_ping_table.cc b/storage/spider/spd_ping_table.cc
index 8c2c8d2ce9e..fc550f05392 100644
--- a/storage/spider/spd_ping_table.cc
+++ b/storage/spider/spd_ping_table.cc
@@ -18,16 +18,11 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_partition.h"
#include "sql_acl.h"
-#endif
#include "spd_err.h"
#include "spd_param.h"
#include "spd_db_include.h"
@@ -88,9 +83,7 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
SPIDER_TABLE_MON_LIST *table_mon_list;
MEM_ROOT mem_root;
ulonglong mon_table_cache_version;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value;
-#endif
DBUG_ENTER("spider_get_ping_table_mon_list");
if (spider_mon_table_cache_version != spider_mon_table_cache_version_req)
{
@@ -108,27 +101,17 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
spider_param_udf_table_mon_mutex_count());
DBUG_PRINT("info",("spider hash key=%s", str->c_ptr()));
DBUG_PRINT("info",("spider hash key length=%u", str->length()));
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value = my_calc_hash(
&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) str->c_ptr(), str->length());
-#endif
pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]);
mon_table_cache_version = (ulonglong) spider_mon_table_cache_version;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *)
my_hash_search_using_hash_value(
&spider_udf_table_mon_list_hash[mutex_hash], hash_value,
(uchar*) str->c_ptr(), str->length())) ||
table_mon_list->mon_table_cache_version != mon_table_cache_version
)
-#else
- if (!(table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search(
- &spider_udf_table_mon_list_hash[mutex_hash],
- (uchar*) str->c_ptr(), str->length())) ||
- table_mon_list->mon_table_cache_version != mon_table_cache_version
- )
-#endif
{
if (
table_mon_list &&
@@ -147,17 +130,9 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list(
table_mon_list->mon_table_cache_version = mon_table_cache_version;
uint old_elements =
spider_udf_table_mon_list_hash[mutex_hash].array.max_element;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
table_mon_list->key_hash_value = hash_value;
-#endif
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(
- &spider_udf_table_mon_list_hash[mutex_hash],
- hash_value, (uchar*) table_mon_list))
-#else
if (my_hash_insert(&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) table_mon_list))
-#endif
{
spider_ping_table_free_mon_list(table_mon_list);
*error_num = HA_ERR_OUT_OF_MEM;
@@ -206,13 +181,8 @@ void spider_release_ping_table_mon_list_loop(
SPIDER_TABLE_MON_LIST *table_mon_list
) {
DBUG_ENTER("spider_release_ping_table_mon_list_loop");
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_udf_table_mon_list_hash[mutex_hash],
- table_mon_list->key_hash_value, (uchar*) table_mon_list);
-#else
my_hash_delete(&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) table_mon_list);
-#endif
while (TRUE)
{
if (table_mon_list->use_count)
@@ -256,22 +226,14 @@ int spider_release_ping_table_mon_list(
mutex_hash = spider_udf_calc_hash(conv_name_str.c_ptr_safe(),
spider_param_udf_table_mon_mutex_count());
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(
&spider_udf_table_mon_list_hash[mutex_hash],
(uchar*) conv_name_str.c_ptr(), conv_name_str.length());
-#endif
pthread_mutex_lock(&spider_udf_table_mon_mutexes[mutex_hash]);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((table_mon_list = (SPIDER_TABLE_MON_LIST *)
my_hash_search_using_hash_value(
&spider_udf_table_mon_list_hash[mutex_hash], hash_value,
(uchar*) conv_name_str.c_ptr(), conv_name_str.length())))
-#else
- if ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_search(
- &spider_udf_table_mon_list_hash[mutex_hash],
- (uchar*) conv_name_str.c_ptr(), conv_name_str.length())))
-#endif
spider_release_ping_table_mon_list_loop(mutex_hash, table_mon_list);
pthread_mutex_unlock(&spider_udf_table_mon_mutexes[mutex_hash]);
my_afree(buf);
@@ -403,10 +365,8 @@ create_table_mon:
if (
(error_num = spider_set_connect_info_default(
tmp_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
NULL,
-#endif
NULL
)) ||
(error_num = spider_set_connect_info_default_dbtable(
@@ -559,10 +519,8 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
if (
(*error_num = spider_set_connect_info_default(
tmp_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
NULL,
-#endif
NULL
)) ||
(*error_num = spider_set_connect_info_default_dbtable(
@@ -581,43 +539,26 @@ SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt(
if (tmp_share->link_statuses[0] == SPIDER_LINK_STATUS_NG)
table_mon_list->mon_status = SPIDER_LINK_MON_NG;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&table_mon_list->caller_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mon_list_caller,
&table_mon_list->caller_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_caller_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&table_mon_list->receptor_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mon_list_receptor,
&table_mon_list->receptor_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_receptor_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&table_mon_list->monitor_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mon_list_monitor,
&table_mon_list->monitor_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_monitor_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&table_mon_list->update_status_mutex,
- MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mon_list_update_status,
&table_mon_list->update_status_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_update_status_mutex_init;
@@ -1086,23 +1027,14 @@ long long spider_ping_table_body(
conv_name.init_calc_mem(135);
tmp_str.init_calc_mem(247);
conv_name.length(0);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
server_id = global_system_variables.server_id;
-#else
- server_id = thd->server_id;
-#endif
if (
thd->open_tables != 0 ||
thd->handler_tables_hash.records != 0 ||
thd->derived_tables != 0 ||
thd->lock != 0 ||
-#if MYSQL_VERSION_ID < 50500
- thd->locked_tables != 0 ||
- thd->prelocked_mode != NON_PRELOCKED
-#else
thd->locked_tables_list.locked_tables() ||
thd->locked_tables_mode != LTM_NONE
-#endif
) {
if (thd->open_tables != 0)
{
@@ -1125,18 +1057,6 @@ long long spider_ping_table_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
"thd->lock", thd->lock);
-#if MYSQL_VERSION_ID < 50500
- } else if (thd->locked_tables != 0)
- {
- my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
- ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
- "thd->locked_tables", thd->locked_tables);
- } else if (thd->prelocked_mode != NON_PRELOCKED)
- {
- my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
- ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
- "thd->prelocked_mode", (longlong) thd->prelocked_mode);
-#else
} else if (thd->locked_tables_list.locked_tables())
{
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
@@ -1148,7 +1068,6 @@ long long spider_ping_table_body(
my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
"thd->locked_tables_mode", (longlong) thd->locked_tables_mode);
-#endif
}
goto error;
}
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index 4bd30573b1c..a0cf104d46e 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -17,17 +17,12 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "key.h"
#include "sql_base.h"
#include "tztime.h"
-#endif
#include "sql_select.h"
#include "spd_err.h"
#include "spd_param.h"
@@ -245,22 +240,9 @@ TABLE *spider_open_sys_table(
) {
TABLE *table;
TABLE_LIST tables;
-#if MYSQL_VERSION_ID < 50500
- TABLE_SHARE *table_share;
- char table_key[MAX_DBKEY_LENGTH];
- uint table_key_length;
-#endif
DBUG_ENTER("spider_open_sys_table");
-#if MYSQL_VERSION_ID < 50500
- memset(&tables, 0, sizeof(TABLE_LIST));
- SPIDER_TABLE_LIST_db_str(&tables) = (char*)"mysql";
- SPIDER_TABLE_LIST_db_length(&tables) = sizeof("mysql") - 1;
- SPIDER_TABLE_LIST_alias_str(&tables) =
- SPIDER_TABLE_LIST_table_name_str(&tables) = (char *) table_name;
- SPIDER_TABLE_LIST_table_name_length(&tables) = table_name_length;
- tables.lock_type = (write ? TL_WRITE : TL_READ);
-#else
+
#ifdef SPIDER_use_LEX_CSTRING_for_database_tablename_alias
LEX_CSTRING db_name =
{
@@ -278,18 +260,7 @@ TABLE *spider_open_sys_table(
"mysql", sizeof("mysql") - 1, table_name, table_name_length, table_name,
(write ? TL_WRITE : TL_READ));
#endif
-#endif
-
-#if MYSQL_VERSION_ID < 50500
- if (need_lock)
- {
-#endif
-#if MYSQL_VERSION_ID < 50500
- if (!(table = open_performance_schema_table(thd, &tables,
- open_tables_backup)))
-#else
if (!(table = spider_sys_open_table(thd, &tables, open_tables_backup)))
-#endif
{
my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM,
ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0),
@@ -297,38 +268,6 @@ TABLE *spider_open_sys_table(
*error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM;
DBUG_RETURN(NULL);
}
-#if MYSQL_VERSION_ID < 50500
- } else {
- SPIDER_reset_n_backup_open_tables_state(thd, open_tables_backup, NULL);
-
- if (!(table = (TABLE*) spider_malloc(spider_current_trx, 12,
- sizeof(*table), MYF(MY_WME))))
- {
- *error_num = HA_ERR_OUT_OF_MEM;
- goto error_malloc;
- }
-
- table_key_length =
- create_table_def_key(thd, table_key, &tables, FALSE);
-
- if (!(table_share = get_table_share(thd,
- &tables, table_key, table_key_length, 0, error_num)))
- goto error;
- if (open_table_from_share(thd, table_share, tables.alias,
- (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX),
- READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
- (uint) HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_FROM_SQL_LAYER,
- table, FALSE)
- ) {
- release_table_share(table_share, RELEASE_NORMAL);
- my_printf_error(ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM,
- ER_SPIDER_CANT_OPEN_SYS_TABLE_STR, MYF(0),
- "mysql", table_name);
- *error_num = ER_SPIDER_CANT_OPEN_SYS_TABLE_NUM;
- goto error;
- }
- }
-#endif
switch (table_name_length)
{
case 9:
@@ -589,13 +528,6 @@ TABLE *spider_open_sys_table(
break;
}
DBUG_RETURN(table);
-
-#if MYSQL_VERSION_ID < 50500
-error:
- spider_free(spider_current_trx, table, MYF(0));
-error_malloc:
- SPIDER_restore_backup_open_tables_state(thd, open_tables_backup);
-#endif
error_col_num_chk:
DBUG_RETURN(NULL);
}
@@ -607,24 +539,10 @@ void spider_close_sys_table(
bool need_lock
) {
DBUG_ENTER("spider_close_sys_table");
-#if MYSQL_VERSION_ID < 50500
- if (need_lock)
- {
- close_performance_schema_table(thd, open_tables_backup);
- } else {
- table->file->ha_reset();
- closefrm(table, TRUE);
- spider_free(spider_current_trx, table, MYF(0));
- SPIDER_restore_backup_open_tables_state(thd, open_tables_backup);
- }
-#else
spider_sys_close_table(thd, open_tables_backup);
-#endif
DBUG_VOID_RETURN;
}
-#if MYSQL_VERSION_ID < 50500
-#else
bool spider_sys_open_and_lock_tables(
THD *thd,
TABLE_LIST **tables,
@@ -692,7 +610,6 @@ void spider_sys_close_table(
}
DBUG_VOID_RETURN;
}
-#endif
int spider_sys_index_init(
TABLE *table,
@@ -737,15 +654,9 @@ int spider_check_sys_table(
table->key_info,
table->key_info->key_length);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_read_idx_map(
table->record[0], 0, (uchar *) table_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT));
-#else
- DBUG_RETURN(table->file->index_read_idx_map(
- table->record[0], 0, (uchar *) table_key,
- HA_WHOLE_KEY, HA_READ_KEY_EXACT));
-#endif
}
int spider_check_sys_table_with_find_flag(
@@ -761,15 +672,9 @@ int spider_check_sys_table_with_find_flag(
table->key_info,
table->key_info->key_length);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_read_idx_map(
table->record[0], 0, (uchar *) table_key,
HA_WHOLE_KEY, find_flag));
-#else
- DBUG_RETURN(table->file->index_read_idx_map(
- table->record[0], 0, (uchar *) table_key,
- HA_WHOLE_KEY, find_flag));
-#endif
}
int spider_check_sys_table_for_update_all_columns(
@@ -784,15 +689,9 @@ int spider_check_sys_table_for_update_all_columns(
table->key_info,
table->key_info->key_length);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_read_idx_map(
table->record[1], 0, (uchar *) table_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT));
-#else
- DBUG_RETURN(table->file->index_read_idx_map(
- table->record[1], 0, (uchar *) table_key,
- HA_WHOLE_KEY, HA_READ_KEY_EXACT));
-#endif
}
int spider_get_sys_table_by_idx(
@@ -827,26 +726,9 @@ int spider_get_sys_table_by_idx(
key_length);
if (
-/*
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
- (error_num = table->file->ha_index_read_idx_map(
- table->record[0], idx, (uchar *) table_key,
- make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
-#else
- (error_num = table->file->index_read_idx_map(
- table->record[0], idx, (uchar *) table_key,
- make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
-#endif
-*/
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_read_map(
table->record[0], (uchar *) table_key,
make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
-#else
- (error_num = table->file->index_read_map(
- table->record[0], (uchar *) table_key,
- make_prev_keypart_map(col_count), HA_READ_KEY_EXACT))
-#endif
) {
spider_sys_index_end(table);
DBUG_RETURN(error_num);
@@ -859,17 +741,10 @@ int spider_sys_index_next_same(
char *table_key
) {
DBUG_ENTER("spider_sys_index_next_same");
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_next_same(
table->record[0],
(const uchar*) table_key,
table->key_info->key_length));
-#else
- DBUG_RETURN(table->file->index_next_same(
- table->record[0],
- (const uchar*) table_key,
- table->key_info->key_length));
-#endif
}
int spider_sys_index_first(
@@ -882,11 +757,7 @@ int spider_sys_index_first(
DBUG_RETURN(error_num);
if (
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_first(table->record[0]))
-#else
- (error_num = table->file->index_first(table->record[0]))
-#endif
) {
spider_sys_index_end(table);
DBUG_RETURN(error_num);
@@ -904,11 +775,7 @@ int spider_sys_index_last(
DBUG_RETURN(error_num);
if (
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
(error_num = table->file->ha_index_last(table->record[0]))
-#else
- (error_num = table->file->index_last(table->record[0]))
-#endif
) {
spider_sys_index_end(table);
DBUG_RETURN(error_num);
@@ -920,11 +787,7 @@ int spider_sys_index_next(
TABLE *table
) {
DBUG_ENTER("spider_sys_index_next");
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
DBUG_RETURN(table->file->ha_index_next(table->record[0]));
-#else
- DBUG_RETURN(table->file->index_next(table->record[0]));
-#endif
}
void spider_store_xa_pk(
@@ -1832,12 +1695,6 @@ int spider_log_tables_link_failed(
table->use_all_columns();
spider_store_tables_name(table, name, name_length);
spider_store_tables_link_idx(table, link_idx);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-#else
- if (table->field[SPIDER_LINK_FAILED_LOG_FAILED_TIME_POS] ==
- table->timestamp_field)
- table->timestamp_field->set_time();
-#endif
if ((error_num = spider_write_sys_table_row(table)))
{
DBUG_RETURN(error_num);
@@ -1871,12 +1728,6 @@ int spider_log_xa_failed(
(uint) strlen(status),
system_charset_info);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
-#else
- if (table->field[SPIDER_XA_FAILED_LOG_FAILED_TIME_POS] ==
- table->timestamp_field)
- table->timestamp_field->set_time();
-#endif
if ((error_num = spider_write_sys_table_row(table)))
{
DBUG_RETURN(error_num);
@@ -2882,11 +2733,7 @@ void spider_get_sys_table_sts_info(
ha_statistics *stat
) {
MYSQL_TIME mysql_time;
-#ifdef MARIADB_BASE_VERSION
uint not_used_uint;
-#else
- my_bool not_used_my_bool;
-#endif
long not_used_long;
DBUG_ENTER("spider_get_sys_table_sts_info");
stat->data_file_length = (ulonglong) table->
@@ -2901,31 +2748,16 @@ void spider_get_sys_table_sts_info(
field[SPIDER_TABLE_STS_MEAN_REC_LENGTH_POS]->val_int();
table->field[SPIDER_TABLE_STS_CHECK_TIME_POS]->get_date(&mysql_time,
SPIDER_date_mode_t(0));
-#ifdef MARIADB_BASE_VERSION
stat->check_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat->check_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
table->field[SPIDER_TABLE_STS_CREATE_TIME_POS]->get_date(&mysql_time,
SPIDER_date_mode_t(0));
-#ifdef MARIADB_BASE_VERSION
stat->create_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat->create_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
table->field[SPIDER_TABLE_STS_UPDATE_TIME_POS]->get_date(&mysql_time,
SPIDER_date_mode_t(0));
-#ifdef MARIADB_BASE_VERSION
stat->update_time = (time_t) my_system_gmt_sec(&mysql_time,
&not_used_long, &not_used_uint);
-#else
- stat->update_time = (time_t) my_system_gmt_sec(&mysql_time,
- &not_used_long, &not_used_my_bool);
-#endif
if (table->field[SPIDER_TABLE_STS_CHECKSUM_POS]->is_null())
{
stat->checksum_null = TRUE;
@@ -3667,12 +3499,8 @@ int spider_sys_replace(
if (table->file->ha_table_flags() & HA_DUPLICATE_POS)
{
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
error_num = table->file->ha_rnd_pos(table->record[1],
table->file->dup_ref);
-#else
- error_num = table->file->rnd_pos(table->record[1], table->file->dup_ref);
-#endif
if (error_num)
{
if (error_num == HA_ERR_RECORD_DELETED)
@@ -3685,13 +3513,8 @@ int spider_sys_replace(
key_copy((uchar*)table_key, table->record[0],
table->key_info + key_num, 0);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50200
error_num = table->file->ha_index_read_idx_map(table->record[1], key_num,
(const uchar*)table_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT);
-#else
- error_num = table->file->index_read_idx_map(table->record[1], key_num,
- (const uchar*)table_key, HA_WHOLE_KEY, HA_READ_KEY_EXACT);
-#endif
if (error_num)
{
if (error_num == HA_ERR_RECORD_DELETED)
diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h
index 22f48b05dfb..36f72375f5a 100644
--- a/storage/spider/spd_sys_table.h
+++ b/storage/spider/spd_sys_table.h
@@ -103,8 +103,6 @@ void spider_close_sys_table(
bool need_lock
);
-#if MYSQL_VERSION_ID < 50500
-#else
bool spider_sys_open_and_lock_tables(
THD *thd,
TABLE_LIST **tables,
@@ -121,7 +119,6 @@ void spider_sys_close_table(
THD *thd,
SPIDER_Open_tables_backup *open_tables_backup
);
-#endif
int spider_sys_index_init(
TABLE *table,
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 735694f7d9c..2c39ad359f2 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -18,10 +18,6 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "my_getopt.h"
@@ -32,7 +28,6 @@
#include "tztime.h"
#include "sql_parse.h"
#include "create_options.h"
-#endif
#include "spd_err.h"
#include "spd_param.h"
#include "spd_db_include.h"
@@ -138,20 +133,13 @@ handlerton *spider_hton_ptr;
SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
extern SPIDER_DBTON spider_dbton_mysql;
extern SPIDER_DBTON spider_dbton_mariadb;
-#ifdef HAVE_ORACLE_OCI
-extern SPIDER_DBTON spider_dbton_oracle;
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_THREAD *spider_table_sts_threads;
SPIDER_THREAD *spider_table_crd_threads;
-#endif
#ifdef HAVE_PSI_INTERFACE
PSI_mutex_key spd_key_mutex_tbl;
PSI_mutex_key spd_key_mutex_init_error_tbl;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
PSI_mutex_key spd_key_mutex_wide_share;
-#endif
PSI_mutex_key spd_key_mutex_lgtm_tblhnd_share;
PSI_mutex_key spd_key_mutex_conn;
PSI_mutex_key spd_key_mutex_open_conn;
@@ -159,14 +147,12 @@ PSI_mutex_key spd_key_mutex_allocated_thds;
PSI_mutex_key spd_key_mutex_mon_table_cache;
PSI_mutex_key spd_key_mutex_udf_table_mon;
PSI_mutex_key spd_key_mutex_mta_conn;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
PSI_mutex_key spd_key_mutex_bg_conn_chain;
PSI_mutex_key spd_key_mutex_bg_conn_sync;
PSI_mutex_key spd_key_mutex_bg_conn;
PSI_mutex_key spd_key_mutex_bg_job_stack;
PSI_mutex_key spd_key_mutex_bg_mon;
PSI_mutex_key spd_key_mutex_bg_direct_sql;
-#endif
PSI_mutex_key spd_key_mutex_mon_list_caller;
PSI_mutex_key spd_key_mutex_mon_list_receptor;
PSI_mutex_key spd_key_mutex_mon_list_monitor;
@@ -175,29 +161,23 @@ PSI_mutex_key spd_key_mutex_share;
PSI_mutex_key spd_key_mutex_share_sts;
PSI_mutex_key spd_key_mutex_share_crd;
PSI_mutex_key spd_key_mutex_share_auto_increment;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
PSI_mutex_key spd_key_mutex_wide_share_sts;
PSI_mutex_key spd_key_mutex_wide_share_crd;
-#endif
PSI_mutex_key spd_key_mutex_udf_table;
PSI_mutex_key spd_key_mutex_mem_calc;
PSI_mutex_key spd_key_thread_id;
PSI_mutex_key spd_key_conn_id;
PSI_mutex_key spd_key_mutex_ipport_count;
PSI_mutex_key spd_key_mutex_conn_i;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
PSI_mutex_key spd_key_mutex_bg_stss;
PSI_mutex_key spd_key_mutex_bg_crds;
-#endif
PSI_mutex_key spd_key_mutex_conn_loop_check;
static PSI_mutex_info all_spider_mutexes[]=
{
{ &spd_key_mutex_tbl, "tbl", PSI_FLAG_GLOBAL},
{ &spd_key_mutex_init_error_tbl, "init_error_tbl", PSI_FLAG_GLOBAL},
-#ifdef WITH_PARTITION_STORAGE_ENGINE
{ &spd_key_mutex_wide_share, "wide_share", PSI_FLAG_GLOBAL},
-#endif
{ &spd_key_mutex_lgtm_tblhnd_share, "lgtm_tblhnd_share", PSI_FLAG_GLOBAL},
{ &spd_key_mutex_conn, "conn", PSI_FLAG_GLOBAL},
{ &spd_key_mutex_open_conn, "open_conn", PSI_FLAG_GLOBAL},
@@ -208,20 +188,16 @@ static PSI_mutex_info all_spider_mutexes[]=
{ &spd_key_thread_id, "thread_id", PSI_FLAG_GLOBAL},
{ &spd_key_conn_id, "conn_id", PSI_FLAG_GLOBAL},
{ &spd_key_mutex_ipport_count, "ipport_count", PSI_FLAG_GLOBAL},
-#ifndef WITHOUT_SPIDER_BG_SEARCH
{ &spd_key_mutex_bg_stss, "bg_stss", PSI_FLAG_GLOBAL},
{ &spd_key_mutex_bg_crds, "bg_crds", PSI_FLAG_GLOBAL},
-#endif
{ &spd_key_mutex_conn_i, "conn_i", 0},
{ &spd_key_mutex_mta_conn, "mta_conn", 0},
-#ifndef WITHOUT_SPIDER_BG_SEARCH
{ &spd_key_mutex_bg_conn_chain, "bg_conn_chain", 0},
{ &spd_key_mutex_bg_conn_sync, "bg_conn_sync", 0},
{ &spd_key_mutex_bg_conn, "bg_conn", 0},
{ &spd_key_mutex_bg_job_stack, "bg_job_stack", 0},
{ &spd_key_mutex_bg_mon, "bg_mon", 0},
{ &spd_key_mutex_bg_direct_sql, "bg_direct_sql", 0},
-#endif
{ &spd_key_mutex_mon_list_caller, "mon_list_caller", 0},
{ &spd_key_mutex_mon_list_receptor, "mon_list_receptor", 0},
{ &spd_key_mutex_mon_list_monitor, "mon_list_monitor", 0},
@@ -230,15 +206,12 @@ static PSI_mutex_info all_spider_mutexes[]=
{ &spd_key_mutex_share_sts, "share_sts", 0},
{ &spd_key_mutex_share_crd, "share_crd", 0},
{ &spd_key_mutex_share_auto_increment, "share_auto_increment", 0},
-#ifdef WITH_PARTITION_STORAGE_ENGINE
{ &spd_key_mutex_wide_share_sts, "wide_share_sts", 0},
{ &spd_key_mutex_wide_share_crd, "wide_share_crd", 0},
-#endif
{ &spd_key_mutex_udf_table, "udf_table", 0},
{ &spd_key_mutex_conn_loop_check, "conn_loop_check", 0},
};
-#ifndef WITHOUT_SPIDER_BG_SEARCH
PSI_cond_key spd_key_cond_bg_conn_sync;
PSI_cond_key spd_key_cond_bg_conn;
PSI_cond_key spd_key_cond_bg_sts;
@@ -248,18 +221,14 @@ PSI_cond_key spd_key_cond_bg_crd_sync;
PSI_cond_key spd_key_cond_bg_mon;
PSI_cond_key spd_key_cond_bg_mon_sleep;
PSI_cond_key spd_key_cond_bg_direct_sql;
-#endif
PSI_cond_key spd_key_cond_udf_table_mon;
PSI_cond_key spd_key_cond_conn_i;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
PSI_cond_key spd_key_cond_bg_stss;
PSI_cond_key spd_key_cond_bg_sts_syncs;
PSI_cond_key spd_key_cond_bg_crds;
PSI_cond_key spd_key_cond_bg_crd_syncs;
-#endif
static PSI_cond_info all_spider_conds[] = {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
{&spd_key_cond_bg_conn_sync, "bg_conn_sync", 0},
{&spd_key_cond_bg_conn, "bg_conn", 0},
{&spd_key_cond_bg_sts, "bg_sts", 0},
@@ -269,35 +238,28 @@ static PSI_cond_info all_spider_conds[] = {
{&spd_key_cond_bg_mon, "bg_mon", 0},
{&spd_key_cond_bg_mon_sleep, "bg_mon_sleep", 0},
{&spd_key_cond_bg_direct_sql, "bg_direct_sql", 0},
-#endif
{&spd_key_cond_udf_table_mon, "udf_table_mon", 0},
{&spd_key_cond_conn_i, "conn_i", 0},
-#ifndef WITHOUT_SPIDER_BG_SEARCH
{&spd_key_cond_bg_stss, "bg_stss", 0},
{&spd_key_cond_bg_sts_syncs, "bg_sts_syncs", 0},
{&spd_key_cond_bg_crds, "bg_crds", 0},
{&spd_key_cond_bg_crd_syncs, "bg_crd_syncs", 0},
-#endif
};
-#ifndef WITHOUT_SPIDER_BG_SEARCH
PSI_thread_key spd_key_thd_bg;
PSI_thread_key spd_key_thd_bg_sts;
PSI_thread_key spd_key_thd_bg_crd;
PSI_thread_key spd_key_thd_bg_mon;
PSI_thread_key spd_key_thd_bg_stss;
PSI_thread_key spd_key_thd_bg_crds;
-#endif
static PSI_thread_info all_spider_threads[] = {
-#ifndef WITHOUT_SPIDER_BG_SEARCH
{&spd_key_thd_bg, "bg", 0},
{&spd_key_thd_bg_sts, "bg_sts", 0},
{&spd_key_thd_bg_crd, "bg_crd", 0},
{&spd_key_thd_bg_mon, "bg_mon", 0},
{&spd_key_thd_bg_stss, "bg_stss", 0},
{&spd_key_thd_bg_crds, "bg_crds", 0},
-#endif
};
#endif
@@ -352,14 +314,12 @@ extern pthread_mutex_t spider_thread_id_mutex;
extern pthread_mutex_t spider_conn_id_mutex;
extern pthread_mutex_t spider_ipport_conn_mutex;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
HASH spider_open_wide_share;
uint spider_open_wide_share_id;
const char *spider_open_wide_share_func_name;
const char *spider_open_wide_share_file_name;
ulong spider_open_wide_share_line_no;
pthread_mutex_t spider_wide_share_mutex;
-#endif
HASH spider_lgtm_tblhnd_share_hash;
uint spider_lgtm_tblhnd_share_hash_id;
@@ -375,9 +335,7 @@ const char *spider_allocated_thds_file_name;
ulong spider_allocated_thds_line_no;
pthread_mutex_t spider_allocated_thds_mutex;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
pthread_attr_t spider_pt_attr;
-#endif
extern pthread_mutex_t spider_mem_calc_mutex;
@@ -849,12 +807,10 @@ int spider_free_share_alloc(
spider_free(spider_current_trx, share->tgt_ssl_vscs, MYF(0));
if (share->link_statuses)
spider_free(spider_current_trx, share->link_statuses, MYF(0));
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->monitoring_bg_flag)
spider_free(spider_current_trx, share->monitoring_bg_flag, MYF(0));
if (share->monitoring_bg_kind)
spider_free(spider_current_trx, share->monitoring_bg_kind, MYF(0));
-#endif
if (share->monitoring_binlog_pos_at_failing)
spider_free(spider_current_trx, share->monitoring_binlog_pos_at_failing, MYF(0));
if (share->monitoring_flag)
@@ -875,10 +831,8 @@ int spider_free_share_alloc(
spider_free(spider_current_trx, share->bka_table_name_types, MYF(0));
if (share->strict_group_bys)
spider_free(spider_current_trx, share->strict_group_bys, MYF(0));
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->monitoring_bg_interval)
spider_free(spider_current_trx, share->monitoring_bg_interval, MYF(0));
-#endif
if (share->monitoring_limit)
spider_free(spider_current_trx, share->monitoring_limit, MYF(0));
if (share->monitoring_sid)
@@ -2059,9 +2013,7 @@ int st_spider_param_string_parse::print_param_error()
int spider_parse_connect_info(
SPIDER_SHARE *share,
TABLE_SHARE *table_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info,
-#endif
uint create_table
) {
int error_num = 0;
@@ -2073,26 +2025,17 @@ int spider_parse_connect_info(
SPIDER_PARAM_STRING_PARSE connect_string_parse;
SPIDER_ALTER_TABLE *share_alter;
ha_table_option_struct *option_struct;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_element *part_elem;
partition_element *sub_elem;
-#endif
DBUG_ENTER("spider_parse_connect_info");
-#ifdef WITH_PARTITION_STORAGE_ENGINE
-#if MYSQL_VERSION_ID < 50500
- DBUG_PRINT("info",("spider partition_info=%s", table_share->partition_info));
-#else
DBUG_PRINT("info",("spider partition_info=%s",
table_share->partition_info_str));
-#endif
DBUG_PRINT("info",("spider part_info=%p", part_info));
-#endif
DBUG_PRINT("info",("spider s->db=%s", table_share->db.str));
DBUG_PRINT("info",("spider s->table_name=%s", table_share->table_name.str));
DBUG_PRINT("info",("spider s->path=%s", table_share->path.str));
DBUG_PRINT("info",
("spider s->normalized_path=%s", table_share->normalized_path.str));
-#ifdef WITH_PARTITION_STORAGE_ENGINE
spider_get_partition_info(share->table_name, share->table_name_length,
table_share, part_info, &part_elem, &sub_elem);
if (part_info)
@@ -2101,26 +2044,17 @@ int spider_parse_connect_info(
else
option_struct= part_elem->option_struct;
else
-#endif
option_struct= table_share->option_struct;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
share->sts_bg_mode = -1;
-#endif
share->sts_interval = -1;
share->sts_mode = -1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->sts_sync = -1;
-#endif
share->store_last_sts = -1;
share->load_sts_at_startup = -1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
share->crd_bg_mode = -1;
-#endif
share->crd_interval = -1;
share->crd_mode = -1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->crd_sync = -1;
-#endif
share->store_last_crd = -1;
share->load_crd_at_startup = -1;
share->crd_type = -1;
@@ -2154,11 +2088,9 @@ int spider_parse_connect_info(
share->low_mem_read = -1;
share->table_count_mode = -1;
share->select_column_mode = -1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
share->bgs_mode = -1;
share->bgs_first_read = -1;
share->bgs_second_read = -1;
-#endif
share->first_read = -1;
share->second_read = -1;
share->auto_increment_mode = -1;
@@ -2173,9 +2105,6 @@ int spider_parse_connect_info(
share->error_read_mode = -1;
share->error_write_mode = -1;
share->active_link_count = -1;
-#ifdef HA_CAN_BULK_ACCESS
- share->bulk_access_free = -1;
-#endif
#ifdef HA_CAN_FORCE_BULK_UPDATE
share->force_bulk_update = -1;
#endif
@@ -2191,11 +2120,7 @@ int spider_parse_connect_info(
share->static_key_cardinality[roop_count] = -1;
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
for (roop_count = 4; roop_count > 0; roop_count--)
-#else
- for (roop_count = 2; roop_count > 0; roop_count--)
-#endif
{
if (connect_string)
{
@@ -2204,7 +2129,6 @@ int spider_parse_connect_info(
}
switch (roop_count)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
case 4:
if (!sub_elem || !sub_elem->part_comment)
continue;
@@ -2233,7 +2157,6 @@ int spider_parse_connect_info(
}
DBUG_PRINT("info",("spider part comment string=%s", connect_string));
break;
-#endif
case 2:
if (table_share->comment.length == 0)
continue;
@@ -2305,16 +2228,11 @@ int spider_parse_connect_info(
2147483647);
SPIDER_PARAM_INT_WITH_MAX("aim", auto_increment_mode, 0, 3);
SPIDER_PARAM_INT("alc", active_link_count, 1);
-#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);
SPIDER_PARAM_INT("bmd", bgs_mode, 0);
SPIDER_PARAM_LONGLONG("bsr", bgs_second_read, 0);
-#endif
SPIDER_PARAM_STR("bke", bka_engine);
SPIDER_PARAM_INT_WITH_MAX("bkm", bka_mode, 0, 2);
SPIDER_PARAM_INT("bsz", bulk_size, 0);
@@ -2323,16 +2241,12 @@ int spider_parse_connect_info(
0, 1);
SPIDER_PARAM_INT_WITH_MAX("bum", bulk_update_mode, 0, 2);
SPIDER_PARAM_INT("bus", bulk_update_size, 0);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
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
SPIDER_PARAM_INT_WITH_MAX("csy", crd_sync, 0, 2);
-#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("cto", connect_timeouts, 0,
2147483647);
SPIDER_PARAM_DEPRECATED_WARNING("ctp");
@@ -2368,12 +2282,10 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("lcs", load_crd_at_startup, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("lss", load_sts_at_startup, 0, 1);
SPIDER_PARAM_LONG_LIST_WITH_MAX("lst", link_statuses, 0, 3);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONG_LIST_WITH_MAX("mbf", monitoring_bg_flag, 0, 1);
SPIDER_PARAM_LONGLONG_LIST_WITH_MAX(
"mbi", monitoring_bg_interval, 0, 4294967295LL);
SPIDER_PARAM_LONG_LIST_WITH_MAX("mbk", monitoring_bg_kind, 0, 3);
-#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("mbp", monitoring_binlog_pos_at_failing, 0, 2);
SPIDER_PARAM_LONG_LIST_WITH_MAX("mfg", monitoring_flag, 0, 1);
SPIDER_PARAM_LONG_LIST_WITH_MAX("mkd", monitoring_kind, 0, 3);
@@ -2397,9 +2309,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("rom", read_only_mode, 0, 1);
SPIDER_PARAM_DOUBLE("rrt", read_rate, 0);
SPIDER_PARAM_INT_WITH_MAX("rsa", reset_sql_alloc, 0, 1);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_INT_WITH_MAX("sbm", sts_bg_mode, 0, 2);
-#endif
SPIDER_PARAM_STR_LIST("sca", tgt_ssl_cas);
SPIDER_PARAM_STR_LIST("sch", tgt_ssl_ciphers);
SPIDER_PARAM_INT_WITH_MAX("scm", select_column_mode, 0, 1);
@@ -2426,9 +2336,7 @@ int spider_parse_connect_info(
option_struct->remote_server);
SPIDER_PARAM_DOUBLE("ssr", semi_split_read, 0);
SPIDER_PARAM_LONGLONG("ssl", semi_split_read_limit, 0);
-#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");
@@ -2484,20 +2392,14 @@ int spider_parse_connect_info(
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
SPIDER_PARAM_INT("bgs_mode", bgs_mode, 0);
-#endif
SPIDER_PARAM_STR_LIST("ssl_cert", tgt_ssl_certs);
SPIDER_PARAM_INT_WITH_MAX("bka_mode", bka_mode, 0, 2);
error_num = connect_string_parse.print_param_error();
@@ -2522,10 +2424,8 @@ int spider_parse_connect_info(
goto error;
case 11:
SPIDER_PARAM_INT_WITH_MAX("query_cache", query_cache, 0, 2);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_INT_WITH_MAX("crd_bg_mode", crd_bg_mode, 0, 2);
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);
@@ -2549,9 +2449,7 @@ int spider_parse_connect_info(
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);
-#endif
SPIDER_PARAM_INT_WITH_MAX("read_only_mode", read_only_mode, 0, 1);
SPIDER_PARAM_LONG_LIST_WITH_MAX("access_balance", access_balances, 0,
2147483647);
@@ -2568,9 +2466,7 @@ int spider_parse_connect_info(
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);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bgs_second_read", bgs_second_read, 0);
-#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("monitoring_flag", monitoring_flag, 0, 1);
SPIDER_PARAM_LONG_LIST_WITH_MAX("monitoring_kind", monitoring_kind, 0, 3);
SPIDER_PARAM_DOUBLE("semi_split_read", semi_split_read, 0);
@@ -2599,10 +2495,6 @@ int spider_parse_connect_info(
net_read_timeouts, 0, 2147483647);
SPIDER_PARAM_INT_WITH_MAX(
"error_write_mode", error_write_mode, 0, 1);
-#ifdef HA_CAN_BULK_ACCESS
- SPIDER_PARAM_INT_WITH_MAX(
- "bulk_access_free", bulk_access_free, 0, 1);
-#endif
SPIDER_PARAM_INT_WITH_MAX(
"query_cache_sync", query_cache_sync, 0, 3);
error_num = connect_string_parse.print_param_error();
@@ -2630,12 +2522,10 @@ int spider_parse_connect_info(
case 18:
SPIDER_PARAM_INT_WITH_MAX(
"select_column_mode", select_column_mode, 0, 1);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONG_LIST_WITH_MAX(
"monitoring_bg_flag", monitoring_bg_flag, 0, 1);
SPIDER_PARAM_LONG_LIST_WITH_MAX(
"monitoring_bg_kind", monitoring_bg_kind, 0, 3);
-#endif
SPIDER_PARAM_LONGLONG(
"direct_order_limit", direct_order_limit, 0);
error_num = connect_string_parse.print_param_error();
@@ -2671,10 +2561,8 @@ int spider_parse_connect_info(
case 22:
SPIDER_PARAM_LONG_LIST_WITH_MAX(
"ssl_verify_server_cert", tgt_ssl_vscs, 0, 1);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG_LIST_WITH_MAX(
"monitoring_bg_interval", monitoring_bg_interval, 0, 4294967295LL);
-#endif
SPIDER_PARAM_INT_WITH_MAX(
"skip_default_condition", skip_default_condition, 0, 1);
SPIDER_PARAM_LONGLONG(
@@ -2779,14 +2667,12 @@ int spider_parse_connect_info(
share->all_link_count = share->monitoring_limit_length;
if (share->all_link_count < share->monitoring_sid_length)
share->all_link_count = share->monitoring_sid_length;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->all_link_count < share->monitoring_bg_flag_length)
share->all_link_count = share->monitoring_bg_flag_length;
if (share->all_link_count < share->monitoring_bg_kind_length)
share->all_link_count = share->monitoring_bg_kind_length;
if (share->all_link_count < share->monitoring_bg_interval_length)
share->all_link_count = share->monitoring_bg_interval_length;
-#endif
if (share->all_link_count < share->use_handlers_length)
share->all_link_count = share->use_handlers_length;
if (share->all_link_count < share->connect_timeouts_length)
@@ -2963,7 +2849,6 @@ int spider_parse_connect_info(
&share->link_statuses_length,
share->all_link_count)))
goto error;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_increase_long_list(
&share->monitoring_bg_flag,
&share->monitoring_bg_flag_length,
@@ -2974,7 +2859,6 @@ int spider_parse_connect_info(
&share->monitoring_bg_kind_length,
share->all_link_count)))
goto error;
-#endif
if ((error_num = spider_increase_long_list(
&share->monitoring_binlog_pos_at_failing,
&share->monitoring_binlog_pos_at_failing_length,
@@ -2990,13 +2874,11 @@ int spider_parse_connect_info(
&share->monitoring_kind_length,
share->all_link_count)))
goto error;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if ((error_num = spider_increase_longlong_list(
&share->monitoring_bg_interval,
&share->monitoring_bg_interval_length,
share->all_link_count)))
goto error;
-#endif
if ((error_num = spider_increase_longlong_list(
&share->monitoring_limit,
&share->monitoring_limit_length,
@@ -3302,10 +3184,8 @@ int spider_parse_connect_info(
if ((error_num = spider_set_connect_info_default(
share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
part_elem,
sub_elem,
-#endif
table_share
)))
goto error;
@@ -3639,10 +3519,8 @@ error_alloc_conn_string:
int spider_set_connect_info_default(
SPIDER_SHARE *share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_element *part_elem,
partition_element *sub_elem,
-#endif
TABLE_SHARE *table_share
) {
bool check_socket;
@@ -3813,13 +3691,8 @@ int spider_set_connect_info_default(
if (
!(share->tgt_table_names[roop_count] = spider_create_table_name_string(
table_share->table_name.str,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
(part_elem ? part_elem->partition_name : NULL),
(sub_elem ? sub_elem->partition_name : NULL)
-#else
- NULL,
- NULL
-#endif
))
) {
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -3929,30 +3802,22 @@ int spider_set_connect_info_default(
if (share->link_statuses[roop_count] == -1)
share->link_statuses[roop_count] = SPIDER_LINK_STATUS_NO_CHANGE;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->monitoring_bg_flag[roop_count] == -1)
share->monitoring_bg_flag[roop_count] = 0;
if (share->monitoring_bg_kind[roop_count] == -1)
share->monitoring_bg_kind[roop_count] = 0;
-#endif
if (share->monitoring_binlog_pos_at_failing[roop_count] == -1)
share->monitoring_binlog_pos_at_failing[roop_count] = 0;
if (share->monitoring_flag[roop_count] == -1)
share->monitoring_flag[roop_count] = 0;
if (share->monitoring_kind[roop_count] == -1)
share->monitoring_kind[roop_count] = 0;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->monitoring_bg_interval[roop_count] == -1)
share->monitoring_bg_interval[roop_count] = 10000000;
-#endif
if (share->monitoring_limit[roop_count] == -1)
share->monitoring_limit[roop_count] = 1;
if (share->monitoring_sid[roop_count] == -1)
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
share->monitoring_sid[roop_count] = global_system_variables.server_id;
-#else
- share->monitoring_sid[roop_count] = current_thd->server_id;
-#endif
if (share->use_handlers[roop_count] == -1)
share->use_handlers[roop_count] = 0;
@@ -3970,34 +3835,26 @@ int spider_set_connect_info_default(
share->strict_group_bys[roop_count] = 1;
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->sts_bg_mode == -1)
share->sts_bg_mode = 2;
-#endif
if (share->sts_interval == -1)
share->sts_interval = 10;
if (share->sts_mode == -1)
share->sts_mode = 1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (share->sts_sync == -1)
share->sts_sync = 0;
-#endif
if (share->store_last_sts == -1)
share->store_last_sts = 1;
if (share->load_sts_at_startup == -1)
share->load_sts_at_startup = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->crd_bg_mode == -1)
share->crd_bg_mode = 2;
-#endif
if (share->crd_interval == -1)
share->crd_interval = 51;
if (share->crd_mode == -1)
share->crd_mode = 1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (share->crd_sync == -1)
share->crd_sync = 0;
-#endif
if (share->store_last_crd == -1)
share->store_last_crd = 1;
if (share->load_crd_at_startup == -1)
@@ -4064,14 +3921,12 @@ int spider_set_connect_info_default(
share->table_count_mode = 0;
if (share->select_column_mode == -1)
share->select_column_mode = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (share->bgs_mode == -1)
share->bgs_mode = 0;
if (share->bgs_first_read == -1)
share->bgs_first_read = 2;
if (share->bgs_second_read == -1)
share->bgs_second_read = 100;
-#endif
if (share->first_read == -1)
share->first_read = 0;
if (share->second_read == -1)
@@ -4098,10 +3953,6 @@ int spider_set_connect_info_default(
share->error_write_mode = 0;
if (share->active_link_count == -1)
share->active_link_count = share->all_link_count;
-#ifdef HA_CAN_BULK_ACCESS
- if (share->bulk_access_free == -1)
- share->bulk_access_free = 0;
-#endif
#ifdef HA_CAN_FORCE_BULK_UPDATE
if (share->force_bulk_update == -1)
share->force_bulk_update = 0;
@@ -4114,11 +3965,7 @@ int spider_set_connect_info_default(
share->casual_read = 0;
if (share->delete_all_rows_type == -1)
{
-#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
share->delete_all_rows_type = 1;
-#else
- share->delete_all_rows_type = 0;
-#endif
}
if (share->bka_mode == -1)
share->bka_mode = 1;
@@ -4354,10 +4201,8 @@ int spider_create_conn_keys(
__func__, __FILE__, __LINE__, MYF(MY_WME | MY_ZEROFILL),
&share->conn_keys, sizeof(char *) * share->all_link_count,
&share->conn_keys_lengths, length_base,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
&share->conn_keys_hash_value,
sizeof(my_hash_value_type) * share->all_link_count,
-#endif
&tmp_name, sizeof(char) * share->conn_keys_charlen,
&share->sql_dbton_ids, length_base,
NullS))
@@ -4505,11 +4350,9 @@ int spider_create_conn_keys(
tmp_name++;
tmp_name++;
tmp_name++;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
share->conn_keys_hash_value[roop_count] = my_calc_hash(
&spider_open_connections, (uchar*) share->conn_keys[roop_count],
share->conn_keys_lengths[roop_count]);
-#endif
}
for (roop_count2 = 0; roop_count2 < SPIDER_DBTON_SIZE; roop_count2++)
{
@@ -4529,12 +4372,8 @@ int spider_create_conn_keys(
SPIDER_SHARE *spider_create_share(
const char *table_name,
TABLE_SHARE *table_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info,
-#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value,
-#endif
int *error_num
) {
int bitmap_size, roop_count;
@@ -4546,9 +4385,7 @@ SPIDER_SHARE *spider_create_share(
uchar *tmp_cardinality_upd, *tmp_table_mon_mutex_bitmap;
char buf[MAX_FIELD_WIDTH], *buf_pos;
char link_idx_str[SPIDER_SQL_INT_LEN];
-#ifdef HA_HAS_CHECKSUM_EXTENDED
bool checksum_support = TRUE;
-#endif
DBUG_ENTER("spider_create_share");
length = (uint) strlen(table_name);
bitmap_size = spider_bitmap_size(table_share->fields);
@@ -4583,19 +4420,13 @@ SPIDER_SHARE *spider_create_share(
share->table_mon_mutex_bitmap = tmp_table_mon_mutex_bitmap;
share->bitmap_size = bitmap_size;
share->table_share = table_share;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
share->table_name_hash_value = hash_value;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
share->table_path_hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_share->path.str, table_share->path.length);
-#endif
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
share->table.s = table_share;
share->table.field = table_share->field;
share->table.key_info = table_share->key_info;
share->table.read_set = &table_share->all_set;
-#endif
if (table_share->keys > 0 &&
!(share->key_hint = new spider_string[table_share->keys])
@@ -4608,9 +4439,7 @@ SPIDER_SHARE *spider_create_share(
DBUG_PRINT("info",("spider share->key_hint=%p", share->key_hint));
if ((*error_num = spider_parse_connect_info(share, table_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
part_info,
-#endif
0)))
goto error_parse_connect_string;
@@ -4641,47 +4470,30 @@ SPIDER_SHARE *spider_create_share(
if (share->table_count_mode & 2)
share->additional_table_flags |= HA_HAS_RECORDS;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_share,
&share->mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_mutex;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&share->sts_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_share_sts,
&share->sts_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_sts_mutex;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&share->crd_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_share_crd,
&share->crd_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_crd_mutex;
}
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(share->lgtm_tblhnd_share =
spider_get_lgtm_tblhnd_share(tmp_name, length, hash_value, FALSE, TRUE,
error_num)))
-#else
- if (!(share->lgtm_tblhnd_share =
- spider_get_lgtm_tblhnd_share(tmp_name, length, FALSE, TRUE, error_num)))
-#endif
{
goto error_get_lgtm_tblhnd_share;
}
@@ -4704,24 +4516,20 @@ SPIDER_SHARE *spider_create_share(
{
goto error_init_dbton;
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
if (
spider_dbton[roop_count].db_access_type == SPIDER_DB_ACCESS_TYPE_SQL &&
!share->dbton_share[roop_count]->checksum_support()
) {
checksum_support = FALSE;
}
-#endif
}
}
-#ifdef HA_HAS_CHECKSUM_EXTENDED
if (checksum_support)
{
share->additional_table_flags |=
HA_HAS_OLD_CHECKSUM |
HA_HAS_NEW_CHECKSUM;
}
-#endif
DBUG_RETURN(share);
/*
@@ -4769,15 +4577,11 @@ SPIDER_SHARE *spider_get_share(
int roop_count;
double sts_interval;
int sts_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int sts_sync;
int auto_increment_mode;
-#endif
double crd_interval;
int crd_mode;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int crd_sync;
-#endif
char first_byte;
int semi_table_lock_conn;
int search_link_idx;
@@ -4796,10 +4600,8 @@ SPIDER_SHARE *spider_get_share(
DBUG_ENTER("spider_get_share");
top_share = spider->wide_handler->top_share;
length = (uint) strlen(table_name);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_name, length);
-#endif
if (top_share)
{
lex_str.length = top_share->path.length + SPIDER_SQL_LOP_CHK_PRM_PRF_LEN;
@@ -4844,34 +4646,20 @@ SPIDER_SHARE *spider_get_share(
my_afree(loop_check_buf);
}
pthread_mutex_lock(&spider_tbl_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(share = (SPIDER_SHARE*) my_hash_search_using_hash_value(
&spider_open_tables, hash_value, (uchar*) table_name, length)))
-#else
- if (!(share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables,
- (uchar*) table_name, length)))
-#endif
{
if (!(share = spider_create_share(
table_name, table_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
table->part_info,
-#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
-#endif
error_num
))) {
goto error_alloc_share;
}
uint old_elements = spider_open_tables.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&spider_open_tables, hash_value,
- (uchar*) share))
-#else
if (my_hash_insert(&spider_open_tables, (uchar*) share))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_hash_insert;
@@ -5008,7 +4796,6 @@ SPIDER_SHARE *spider_get_share(
}
spider->set_error_mode();
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (!share->sts_spider_init)
{
pthread_mutex_lock(&share->mutex);
@@ -5024,14 +4811,9 @@ SPIDER_SHARE *spider_get_share(
spider_free_share(share);
goto error_sts_spider_init;
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- share->sts_thread = &spider_table_sts_threads[
- hash_value % spider_param_table_sts_thread_count()];
-#else
share->sts_thread = &spider_table_sts_threads[
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
spider_param_table_sts_thread_count()];
-#endif
share->sts_spider_init = TRUE;
}
pthread_mutex_unlock(&share->mutex);
@@ -5052,21 +4834,14 @@ SPIDER_SHARE *spider_get_share(
spider_free_share(share);
goto error_crd_spider_init;
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- share->crd_thread = &spider_table_crd_threads[
- hash_value % spider_param_table_crd_thread_count()];
-#else
share->crd_thread = &spider_table_crd_threads[
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
spider_param_table_crd_thread_count()];
-#endif
share->crd_spider_init = TRUE;
}
pthread_mutex_unlock(&share->mutex);
}
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (
sql_command != SQLCOM_DROP_TABLE &&
sql_command != SQLCOM_ALTER_TABLE &&
@@ -5080,7 +4855,6 @@ SPIDER_SHARE *spider_get_share(
spider_free_share(share);
goto error_but_no_delete;
}
-#endif
if (!(spider->conn_keys = (char **)
spider_bulk_alloc_mem(spider_current_trx, 47,
@@ -5278,20 +5052,16 @@ SPIDER_SHARE *spider_get_share(
SPIDER_INIT_ERROR_TABLE *spider_init_error_table;
sts_interval = spider_param_sts_interval(thd, share->sts_interval);
sts_mode = spider_param_sts_mode(thd, share->sts_mode);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
sts_sync = spider_param_sts_sync(thd, share->sts_sync);
auto_increment_mode = spider_param_auto_increment_mode(thd,
share->auto_increment_mode);
if (auto_increment_mode == 1)
sts_sync = 0;
-#endif
crd_interval = spider_param_crd_interval(thd, share->crd_interval);
crd_mode = spider_param_crd_mode(thd, share->crd_mode);
if (crd_mode == 3)
crd_mode = 1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
crd_sync = spider_param_crd_sync(thd, share->crd_sync);
-#endif
time_t tmp_time = (time_t) time((time_t*) 0);
pthread_mutex_lock(&share->sts_mutex);
pthread_mutex_lock(&share->crd_mutex);
@@ -5323,9 +5093,7 @@ SPIDER_SHARE *spider_get_share(
) &&
(*error_num = spider_get_sts(share, spider->search_link_idx, tmp_time,
spider, sts_interval, sts_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
sts_sync,
-#endif
1, HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
) {
if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM)
@@ -5347,9 +5115,7 @@ SPIDER_SHARE *spider_get_share(
) &&
(*error_num = spider_get_crd(share, spider->search_link_idx, tmp_time,
spider, table, crd_interval, crd_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
crd_sync,
-#endif
1))
) {
if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM)
@@ -5503,7 +5269,6 @@ SPIDER_SHARE *spider_get_share(
}
spider->set_error_mode();
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (!share->sts_spider_init)
{
pthread_mutex_lock(&share->mutex);
@@ -5516,14 +5281,9 @@ SPIDER_SHARE *spider_get_share(
spider_free_share(share);
goto error_sts_spider_init;
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- share->sts_thread = &spider_table_sts_threads[
- hash_value % spider_param_table_sts_thread_count()];
-#else
share->sts_thread = &spider_table_sts_threads[
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
spider_param_table_sts_thread_count()];
-#endif
share->sts_spider_init = TRUE;
}
pthread_mutex_unlock(&share->mutex);
@@ -5541,21 +5301,14 @@ SPIDER_SHARE *spider_get_share(
spider_free_share(share);
goto error_crd_spider_init;
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- share->crd_thread = &spider_table_crd_threads[
- hash_value % spider_param_table_crd_thread_count()];
-#else
share->crd_thread = &spider_table_crd_threads[
my_calc_hash(&spider_open_tables, (uchar*) table_name, length) %
spider_param_table_crd_thread_count()];
-#endif
share->crd_spider_init = TRUE;
}
pthread_mutex_unlock(&share->mutex);
}
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (
sql_command != SQLCOM_DROP_TABLE &&
sql_command != SQLCOM_ALTER_TABLE &&
@@ -5566,7 +5319,6 @@ SPIDER_SHARE *spider_get_share(
spider_free_share(share);
goto error_but_no_delete;
}
-#endif
if (!(spider->conn_keys = (char **)
spider_bulk_alloc_mem(spider_current_trx, 49,
@@ -5752,20 +5504,16 @@ SPIDER_SHARE *spider_get_share(
SPIDER_INIT_ERROR_TABLE *spider_init_error_table;
sts_interval = spider_param_sts_interval(thd, share->sts_interval);
sts_mode = spider_param_sts_mode(thd, share->sts_mode);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
sts_sync = spider_param_sts_sync(thd, share->sts_sync);
auto_increment_mode = spider_param_auto_increment_mode(thd,
share->auto_increment_mode);
if (auto_increment_mode == 1)
sts_sync = 0;
-#endif
crd_interval = spider_param_crd_interval(thd, share->crd_interval);
crd_mode = spider_param_crd_mode(thd, share->crd_mode);
if (crd_mode == 3)
crd_mode = 1;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
crd_sync = spider_param_crd_sync(thd, share->crd_sync);
-#endif
time_t tmp_time = (time_t) time((time_t*) 0);
if ((spider_init_error_table =
spider_get_init_error_table(spider->wide_handler->trx, share,
@@ -5794,9 +5542,7 @@ SPIDER_SHARE *spider_get_share(
) &&
(*error_num = spider_get_sts(share, spider->search_link_idx,
tmp_time, spider, sts_interval, sts_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
sts_sync,
-#endif
1, HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
) {
if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM)
@@ -5815,9 +5561,7 @@ SPIDER_SHARE *spider_get_share(
) &&
(*error_num = spider_get_crd(share, spider->search_link_idx,
tmp_time, spider, table, crd_interval, crd_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
crd_sync,
-#endif
1))
) {
if (*error_num != ER_SPIDER_SYS_TABLE_VERSION_NUM)
@@ -5861,10 +5605,8 @@ error_hash_insert:
error_alloc_share:
pthread_mutex_unlock(&spider_tbl_mutex);
error_open_sys_table:
-#ifndef WITHOUT_SPIDER_BG_SEARCH
error_crd_spider_init:
error_sts_spider_init:
-#endif
if (init_mem_root)
{
free_root(&mem_root, MYF(0));
@@ -5895,7 +5637,6 @@ int spider_free_share(
THD *thd = current_thd;
if (!--share->use_count)
{
-#ifndef WITHOUT_SPIDER_BG_SEARCH
spider_free_sts_thread(share);
spider_free_crd_thread(share);
spider_free_mon_threads(share);
@@ -5909,7 +5650,6 @@ int spider_free_share(
spider_table_remove_share_from_crd_thread(share);
spider_free_spider_object_for_share(&share->crd_spider);
}
-#endif
if (
share->sts_init &&
share->table_share->tmp_table == NO_TMP_TABLE &&
@@ -5954,12 +5694,7 @@ int spider_free_share(
);
}
spider_free_share_alloc(share);
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_open_tables,
- share->table_name_hash_value, (uchar*) share);
-#else
my_hash_delete(&spider_open_tables, (uchar*) share);
-#endif
pthread_mutex_destroy(&share->crd_mutex);
pthread_mutex_destroy(&share->sts_mutex);
pthread_mutex_destroy(&share->mutex);
@@ -5981,19 +5716,12 @@ void spider_update_link_status_for_share(
SPIDER_SHARE *share;
DBUG_ENTER("spider_update_link_status_for_share");
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_name, table_name_length);
-#endif
pthread_mutex_lock(&spider_tbl_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((share = (SPIDER_SHARE*) my_hash_search_using_hash_value(
&spider_open_tables, hash_value, (uchar*) table_name,
table_name_length)))
-#else
- if ((share = (SPIDER_SHARE*) my_hash_search(&spider_open_tables,
- (uchar*) table_name, table_name_length)))
-#endif
{
DBUG_PRINT("info", ("spider share->link_status_init=%s",
share->link_status_init ? "TRUE" : "FALSE"));
@@ -6008,7 +5736,6 @@ void spider_update_link_status_for_share(
DBUG_VOID_RETURN;
}
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
const char *table_name,
uint table_name_length,
@@ -6017,15 +5744,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
bool need_to_create,
int *error_num
)
-#else
-SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
- const char *table_name,
- uint table_name_length,
- bool locked,
- bool need_to_create,
- int *error_num
-)
-#endif
{
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share;
char *tmp_name;
@@ -6033,16 +5751,10 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
if (!locked)
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*)
my_hash_search_using_hash_value(
&spider_lgtm_tblhnd_share_hash, hash_value,
(uchar*) table_name, table_name_length)))
-#else
- if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE*) my_hash_search(
- &spider_lgtm_tblhnd_share_hash,
- (uchar*) table_name, table_name_length)))
-#endif
{
DBUG_PRINT("info",("spider create new lgtm tblhnd share"));
if (!(lgtm_tblhnd_share = (SPIDER_LGTM_TBLHND_SHARE *)
@@ -6059,30 +5771,18 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
lgtm_tblhnd_share->table_name = tmp_name;
memcpy(lgtm_tblhnd_share->table_name, table_name,
lgtm_tblhnd_share->table_name_length);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
lgtm_tblhnd_share->table_path_hash_value = hash_value;
-#endif
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&lgtm_tblhnd_share->auto_increment_mutex,
- MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_share_auto_increment,
&lgtm_tblhnd_share->auto_increment_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_auto_increment_mutex;
}
uint old_elements = spider_lgtm_tblhnd_share_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&spider_lgtm_tblhnd_share_hash,
- hash_value, (uchar*) lgtm_tblhnd_share))
-#else
if (my_hash_insert(&spider_lgtm_tblhnd_share_hash,
(uchar*) lgtm_tblhnd_share))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_hash_insert;
@@ -6118,12 +5818,7 @@ void spider_free_lgtm_tblhnd_share_alloc(
DBUG_ENTER("spider_free_lgtm_tblhnd_share");
if (!locked)
pthread_mutex_lock(&spider_lgtm_tblhnd_share_mutex);
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_lgtm_tblhnd_share_hash,
- lgtm_tblhnd_share->table_path_hash_value, (uchar*) lgtm_tblhnd_share);
-#else
my_hash_delete(&spider_lgtm_tblhnd_share_hash, (uchar*) lgtm_tblhnd_share);
-#endif
pthread_mutex_destroy(&lgtm_tblhnd_share->auto_increment_mutex);
spider_free(spider_current_trx, lgtm_tblhnd_share, MYF(0));
if (!locked)
@@ -6142,16 +5837,10 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
DBUG_ENTER("spider_get_wide_share");
pthread_mutex_lock(&spider_wide_share_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(wide_share = (SPIDER_WIDE_SHARE*)
my_hash_search_using_hash_value(
&spider_open_wide_share, share->table_path_hash_value,
(uchar*) table_share->path.str, table_share->path.length)))
-#else
- if (!(wide_share = (SPIDER_WIDE_SHARE*) my_hash_search(
- &spider_open_wide_share,
- (uchar*) table_share->path.str, table_share->path.length)))
-#endif
{
DBUG_PRINT("info",("spider create new wide share"));
if (!(wide_share = (SPIDER_WIDE_SHARE *)
@@ -6171,31 +5860,21 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
wide_share->table_name = tmp_name;
memcpy(wide_share->table_name, table_share->path.str,
wide_share->table_name_length);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
wide_share->table_path_hash_value = share->table_path_hash_value;
-#endif
wide_share->cardinality = tmp_cardinality;
wide_share->crd_get_time = wide_share->sts_get_time =
share->crd_get_time;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&wide_share->sts_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_wide_share_sts,
&wide_share->sts_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_sts_mutex;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&wide_share->crd_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_wide_share_crd,
&wide_share->crd_mutex, MY_MUTEX_INIT_FAST))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_init_crd_mutex;
@@ -6204,13 +5883,7 @@ SPIDER_WIDE_SHARE *spider_get_wide_share(
thr_lock_init(&wide_share->lock);
uint old_elements = spider_open_wide_share.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&spider_open_wide_share,
- share->table_path_hash_value,
- (uchar*) wide_share))
-#else
if (my_hash_insert(&spider_open_wide_share, (uchar*) wide_share))
-#endif
{
*error_num = HA_ERR_OUT_OF_MEM;
goto error_hash_insert;
@@ -6248,12 +5921,7 @@ int spider_free_wide_share(
if (!--wide_share->use_count)
{
thr_lock_delete(&wide_share->lock);
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_open_wide_share,
- wide_share->table_path_hash_value, (uchar*) wide_share);
-#else
my_hash_delete(&spider_open_wide_share, (uchar*) wide_share);
-#endif
pthread_mutex_destroy(&wide_share->crd_mutex);
pthread_mutex_destroy(&wide_share->sts_mutex);
spider_free(spider_current_trx, wide_share, MYF(0));
@@ -6369,10 +6037,8 @@ int spider_open_all_tables(
table_tables, &tmp_share, 0, &mem_root)) ||
(error_num = spider_set_connect_info_default(
&tmp_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
NULL,
-#endif
NULL
))
) {
@@ -6620,7 +6286,6 @@ handler* spider_create_handler(
MEM_ROOT *mem_root
) {
DBUG_ENTER("spider_create_handler");
-#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_THREAD *thread = &spider_table_sts_threads[0];
if (unlikely(thread->init_command))
{
@@ -6643,7 +6308,6 @@ handler* spider_create_handler(
DBUG_RETURN(NULL);
}
}
-#endif
DBUG_RETURN(new (mem_root) ha_spider(hton, table));
}
@@ -6738,7 +6402,6 @@ int spider_db_done(
}
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
for (roop_count = spider_param_table_crd_thread_count() - 1;
roop_count >= 0; roop_count--)
{
@@ -6750,7 +6413,6 @@ int spider_db_done(
spider_free_sts_threads(&spider_table_sts_threads[roop_count]);
}
spider_free(NULL, spider_table_sts_threads, MYF(0));
-#endif
for (roop_count = spider_param_udf_table_mon_mutex_count() - 1;
roop_count >= 0; roop_count--)
@@ -6758,14 +6420,8 @@ int spider_db_done(
while ((table_mon_list = (SPIDER_TABLE_MON_LIST *) my_hash_element(
&spider_udf_table_mon_list_hash[roop_count], 0)))
{
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(
- &spider_udf_table_mon_list_hash[roop_count],
- table_mon_list->key_hash_value, (uchar*) table_mon_list);
-#else
my_hash_delete(&spider_udf_table_mon_list_hash[roop_count],
(uchar*) table_mon_list);
-#endif
spider_ping_table_free_mon_list(table_mon_list);
}
spider_free_mem_calc(spider_current_trx,
@@ -6801,12 +6457,7 @@ int spider_db_done(
pthread_mutex_lock(&spider_conn_mutex);
while ((conn = (SPIDER_CONN*) my_hash_element(&spider_open_connections, 0)))
{
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_open_connections,
- conn->conn_key_hash_value, (uchar*) conn);
-#else
my_hash_delete(&spider_open_connections, (uchar*) conn);
-#endif
spider_free_conn(conn);
}
pthread_mutex_unlock(&spider_conn_mutex);
@@ -6838,25 +6489,17 @@ int spider_db_done(
spider_lgtm_tblhnd_share_hash.array.max_element *
spider_lgtm_tblhnd_share_hash.array.size_of_element);
my_hash_free(&spider_lgtm_tblhnd_share_hash);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
spider_free_mem_calc(spider_current_trx,
spider_open_wide_share_id,
spider_open_wide_share.array.max_element *
spider_open_wide_share.array.size_of_element);
my_hash_free(&spider_open_wide_share);
-#endif
pthread_mutex_lock(&spider_init_error_tbl_mutex);
while ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE*)
my_hash_element(&spider_init_error_tables, 0)))
{
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_init_error_tables,
- spider_init_error_table->table_name_hash_value,
- (uchar*) spider_init_error_table);
-#else
my_hash_delete(&spider_init_error_tables,
(uchar*) spider_init_error_table);
-#endif
spider_free(NULL, spider_init_error_table, MYF(0));
}
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
@@ -6876,17 +6519,13 @@ int spider_db_done(
pthread_mutex_destroy(&spider_open_conn_mutex);
pthread_mutex_destroy(&spider_conn_mutex);
pthread_mutex_destroy(&spider_lgtm_tblhnd_share_mutex);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
pthread_mutex_destroy(&spider_wide_share_mutex);
-#endif
pthread_mutex_destroy(&spider_init_error_tbl_mutex);
pthread_mutex_destroy(&spider_conn_id_mutex);
pthread_mutex_destroy(&spider_ipport_conn_mutex);
pthread_mutex_destroy(&spider_thread_id_mutex);
pthread_mutex_destroy(&spider_tbl_mutex);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
pthread_attr_destroy(&spider_pt_attr);
-#endif
for (roop_count = 0; roop_count < SPIDER_MEM_CALC_LIST_NUM; roop_count++)
{
@@ -6952,9 +6591,7 @@ int spider_db_init(
spider_hton->flush_logs = spider_flush_logs;
spider_hton->commit = spider_commit;
spider_hton->rollback = spider_rollback;
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
spider_hton->discover_table_structure = spider_discover_table_structure;
-#endif
if (spider_param_support_xa())
{
spider_hton->prepare = spider_xa_prepare;
@@ -6965,9 +6602,7 @@ int spider_db_init(
spider_hton->create = spider_create_handler;
spider_hton->drop_database = spider_drop_database;
spider_hton->show_status = spider_show_status;
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
spider_hton->create_group_by = spider_create_group_by_handler;
-#endif
spider_hton->table_options= spider_table_option_list;
if (my_gethwaddr((uchar *) addr))
@@ -7018,108 +6653,59 @@ int spider_db_init(
init_spider_psi_keys();
#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (pthread_attr_init(&spider_pt_attr))
goto error_pt_attr_init;
/*
if (pthread_attr_setdetachstate(&spider_pt_attr, PTHREAD_CREATE_DETACHED))
goto error_pt_attr_setstate;
*/
-#endif
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_tbl_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_tbl,
&spider_tbl_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_tbl_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
-#else
+
if (mysql_mutex_init(spd_key_thread_id,
&spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_thread_id_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
-#else
+
if (mysql_mutex_init(spd_key_conn_id,
&spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_conn_id_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
-#else
+
if (mysql_mutex_init(spd_key_mutex_ipport_count,
&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_ipport_count_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_init_error_tbl,
&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_init_error_tbl_mutex_init;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_wide_share_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_wide_share,
&spider_wide_share_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_wide_share_mutex_init;
-#endif
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_lgtm_tblhnd_share,
&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_lgtm_tblhnd_share_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_conn_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_conn,
&spider_conn_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_conn_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_open_conn,
&spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_open_conn_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_allocated_thds,
&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_allocated_thds_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mon_table_cache,
&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_mon_table_cache_mutex_init;
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_mem_calc,
&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
-#endif
goto error_mem_calc_mutex_init;
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_open_tables, spd_charset_utf8mb3_bin, 32, 0, 0,
@@ -7140,7 +6726,6 @@ int spider_db_init(
spider_init_error_tables,
spider_init_error_tables.array.max_element *
spider_init_error_tables.array.size_of_element);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if(
my_hash_init(PSI_INSTRUMENT_ME, &spider_open_wide_share, spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_wide_share_get_key, 0, 0)
@@ -7152,7 +6737,6 @@ int spider_db_init(
spider_open_wide_share,
spider_open_wide_share.array.max_element *
spider_open_wide_share.array.size_of_element);
-#endif
if (my_hash_init(PSI_INSTRUMENT_ME, &spider_lgtm_tblhnd_share_hash,
spd_charset_utf8mb3_bin, 32, 0, 0,
(my_hash_get_key) spider_lgtm_tblhnd_share_hash_get_key, 0, 0))
@@ -7213,25 +6797,16 @@ int spider_db_init(
roop_count < (int) spider_param_udf_table_mon_mutex_count();
roop_count++)
{
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_udf_table_mon_mutexes[roop_count],
- MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_udf_table_mon,
&spider_udf_table_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST))
-#endif
goto error_init_udf_table_mon_mutex;
}
for (roop_count = 0;
roop_count < (int) spider_param_udf_table_mon_mutex_count();
roop_count++)
{
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&spider_udf_table_mon_conds[roop_count], NULL))
-#else
if (mysql_cond_init(spd_key_cond_udf_table_mon,
&spider_udf_table_mon_conds[roop_count], NULL))
-#endif
goto error_init_udf_table_mon_cond;
}
for (roop_count = 0;
@@ -7250,7 +6825,6 @@ int spider_db_init(
spider_udf_table_mon_list_hash[roop_count].array.size_of_element);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
if (!(spider_table_sts_threads = (SPIDER_THREAD *)
spider_bulk_malloc(NULL, 256, MYF(MY_WME | MY_ZEROFILL),
&spider_table_sts_threads, (uint) (sizeof(SPIDER_THREAD) *
@@ -7280,7 +6854,6 @@ int spider_db_init(
goto error_init_table_crd_threads;
}
}
-#endif
spider_dbton_mysql.dbton_id = dbton_id;
spider_dbton_mysql.db_util->dbton_id = dbton_id;
@@ -7290,12 +6863,6 @@ int spider_db_init(
spider_dbton_mariadb.db_util->dbton_id = dbton_id;
spider_dbton[dbton_id] = spider_dbton_mariadb;
++dbton_id;
-#ifdef HAVE_ORACLE_OCI
- spider_dbton_oracle.dbton_id = dbton_id;
- spider_dbton_oracle.db_util->dbton_id = dbton_id;
- spider_dbton[dbton_id] = spider_dbton_oracle;
- ++dbton_id;
-#endif
for (roop_count = 0; roop_count < SPIDER_DBTON_SIZE; roop_count++)
{
if (spider_dbton[roop_count].init)
@@ -7308,7 +6875,6 @@ int spider_db_init(
}
DBUG_RETURN(0);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
error_init_dbton:
for (roop_count--; roop_count >= 0; roop_count--)
{
@@ -7331,7 +6897,6 @@ error_init_table_sts_threads:
}
spider_free(NULL, spider_table_sts_threads, MYF(0));
roop_count = spider_param_udf_table_mon_mutex_count() - 1;
-#endif
error_init_udf_table_mon_list_hash:
for (; roop_count >= 0; roop_count--)
{
@@ -7377,14 +6942,12 @@ error_open_connections_hash_init:
spider_lgtm_tblhnd_share_hash.array.size_of_element);
my_hash_free(&spider_lgtm_tblhnd_share_hash);
error_lgtm_tblhnd_share_hash_init:
-#ifdef WITH_PARTITION_STORAGE_ENGINE
spider_free_mem_calc(NULL,
spider_open_wide_share_id,
spider_open_wide_share.array.max_element *
spider_open_wide_share.array.size_of_element);
my_hash_free(&spider_open_wide_share);
error_open_wide_share_hash_init:
-#endif
spider_free_mem_calc(NULL,
spider_init_error_tables_id,
spider_init_error_tables.array.max_element *
@@ -7409,10 +6972,8 @@ error_open_conn_mutex_init:
error_conn_mutex_init:
pthread_mutex_destroy(&spider_lgtm_tblhnd_share_mutex);
error_lgtm_tblhnd_share_mutex_init:
-#ifdef WITH_PARTITION_STORAGE_ENGINE
pthread_mutex_destroy(&spider_wide_share_mutex);
error_wide_share_mutex_init:
-#endif
pthread_mutex_destroy(&spider_init_error_tbl_mutex);
error_init_error_tbl_mutex_init:
pthread_mutex_destroy(&spider_ipport_conn_mutex);
@@ -7423,13 +6984,11 @@ error_conn_id_mutex_init:
error_thread_id_mutex_init:
pthread_mutex_destroy(&spider_tbl_mutex);
error_tbl_mutex_init:
-#ifndef WITHOUT_SPIDER_BG_SEARCH
/*
error_pt_attr_setstate:
*/
pthread_attr_destroy(&spider_pt_attr);
error_pt_attr_init:
-#endif
DBUG_RETURN(error_num);
}
@@ -7478,7 +7037,6 @@ char *spider_create_table_name_string(
DBUG_RETURN(res);
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
/*
Get the target partition_elements.
@@ -7568,7 +7126,6 @@ void spider_get_partition_info(
DBUG_PRINT("info",("spider no hit"));
DBUG_VOID_RETURN;
}
-#endif
int spider_get_sts(
SPIDER_SHARE *share,
@@ -7577,20 +7134,15 @@ int spider_get_sts(
ha_spider *spider,
double sts_interval,
int sts_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int sts_sync,
-#endif
int sts_sync_level,
uint flag
) {
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int get_type;
-#endif
int error_num = 0;
bool need_to_get = TRUE;
DBUG_ENTER("spider_get_sts");
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
sts_sync == 0
) {
@@ -7624,7 +7176,6 @@ int spider_get_sts(
/* copy */
get_type = 0;
}
-#endif
if (
!share->sts_init &&
share->table_share->tmp_table == NO_TMP_TABLE &&
@@ -7647,23 +7198,16 @@ int spider_get_sts(
if (need_to_get)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (get_type == 0)
spider_copy_sts_to_share(share, share->wide_share);
else {
-#endif
error_num = spider_db_show_table_status(spider, link_idx, sts_mode, flag);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
}
-#endif
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (get_type >= 2)
pthread_mutex_unlock(&share->wide_share->sts_mutex);
-#endif
if (error_num)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER *partition_handler =
spider->partition_handler;
if (
@@ -7705,17 +7249,14 @@ int spider_get_sts(
}
}
if (error_num)
-#endif
DBUG_RETURN(error_num);
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (sts_sync >= sts_sync_level && get_type > 0)
{
spider_copy_sts_to_wide_share(share->wide_share, share);
share->wide_share->sts_get_time = tmp_time;
share->wide_share->sts_init = TRUE;
}
-#endif
share->sts_get_time = tmp_time;
share->sts_init = TRUE;
DBUG_RETURN(0);
@@ -7729,19 +7270,14 @@ int spider_get_crd(
TABLE *table,
double crd_interval,
int crd_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int crd_sync,
-#endif
int crd_sync_level
) {
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int get_type;
-#endif
int error_num = 0;
bool need_to_get = TRUE;
DBUG_ENTER("spider_get_crd");
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (
crd_sync == 0
) {
@@ -7775,7 +7311,6 @@ int spider_get_crd(
/* copy */
get_type = 0;
}
-#endif
if (
!share->crd_init &&
share->table_share->tmp_table == NO_TMP_TABLE &&
@@ -7798,24 +7333,17 @@ int spider_get_crd(
if (need_to_get)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (get_type == 0)
spider_copy_crd_to_share(share, share->wide_share,
table->s->fields);
else {
-#endif
error_num = spider_db_show_index(spider, link_idx, table, crd_mode);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
}
-#endif
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (get_type >= 2)
pthread_mutex_unlock(&share->wide_share->crd_mutex);
-#endif
if (error_num)
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARTITION_HANDLER *partition_handler =
spider->partition_handler;
if (
@@ -7858,10 +7386,8 @@ int spider_get_crd(
}
}
if (error_num)
-#endif
DBUG_RETURN(error_num);
}
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (crd_sync >= crd_sync_level && get_type > 0)
{
spider_copy_crd_to_wide_share(share->wide_share, share,
@@ -7869,7 +7395,6 @@ int spider_get_crd(
share->wide_share->crd_get_time = tmp_time;
share->wide_share->crd_init = TRUE;
}
-#endif
share->crd_get_time = tmp_time;
share->crd_init = TRUE;
DBUG_RETURN(0);
@@ -7920,16 +7445,10 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
char *tmp_name;
DBUG_ENTER("spider_get_init_error_table");
pthread_mutex_lock(&spider_init_error_tbl_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
my_hash_search_using_hash_value(
&spider_init_error_tables, share->table_name_hash_value,
(uchar*) share->table_name, share->table_name_length)))
-#else
- if (!(spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search(
- &spider_init_error_tables,
- (uchar*) share->table_name, share->table_name_length)))
-#endif
{
if (!create)
{
@@ -7948,18 +7467,11 @@ SPIDER_INIT_ERROR_TABLE *spider_get_init_error_table(
memcpy(tmp_name, share->table_name, share->table_name_length);
spider_init_error_table->table_name = tmp_name;
spider_init_error_table->table_name_length = share->table_name_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
spider_init_error_table->table_name_hash_value =
share->table_name_hash_value;
-#endif
uint old_elements = spider_init_error_tables.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&spider_init_error_tables,
- share->table_name_hash_value, (uchar*) spider_init_error_table))
-#else
if (my_hash_insert(&spider_init_error_tables,
(uchar*) spider_init_error_table))
-#endif
{
spider_free(trx, spider_init_error_table, MYF(0));
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
@@ -7982,29 +7494,16 @@ void spider_delete_init_error_table(
) {
SPIDER_INIT_ERROR_TABLE *spider_init_error_table;
uint length = strlen(name);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) name, length);
-#endif
DBUG_ENTER("spider_delete_init_error_table");
pthread_mutex_lock(&spider_init_error_tbl_mutex);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *)
my_hash_search_using_hash_value(&spider_init_error_tables, hash_value,
(uchar*) name, length)))
-#else
- if ((spider_init_error_table = (SPIDER_INIT_ERROR_TABLE *) my_hash_search(
- &spider_init_error_tables, (uchar*) name, length)))
-#endif
{
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_init_error_tables,
- spider_init_error_table->table_name_hash_value,
- (uchar*) spider_init_error_table);
-#else
my_hash_delete(&spider_init_error_tables,
(uchar*) spider_init_error_table);
-#endif
spider_free(spider_current_trx, spider_init_error_table, MYF(0));
}
pthread_mutex_unlock(&spider_init_error_tbl_mutex);
@@ -8071,10 +7570,8 @@ void spider_set_tmp_share_pointer(
tmp_share->monitoring_binlog_pos_at_failing = &tmp_long[3];
tmp_share->monitoring_flag = &tmp_long[4];
tmp_share->monitoring_kind = &tmp_long[5];
-#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_flag = &tmp_long[6];
tmp_share->monitoring_bg_kind = &tmp_long[7];
-#endif
tmp_share->use_handlers = &tmp_long[13];
tmp_share->connect_timeouts = &tmp_long[14];
tmp_long[13] = -1;
@@ -8087,9 +7584,7 @@ void spider_set_tmp_share_pointer(
tmp_share->strict_group_bys = &tmp_long[19];
tmp_share->monitoring_limit = &tmp_longlong[0];
tmp_share->monitoring_sid = &tmp_longlong[1];
-#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_interval = &tmp_longlong[2];
-#endif
tmp_share->server_names_lengths = &tmp_connect_info_length[0];
tmp_share->tgt_table_names_lengths = &tmp_connect_info_length[1];
tmp_share->tgt_dbs_lengths = &tmp_connect_info_length[2];
@@ -8138,15 +7633,11 @@ void spider_set_tmp_share_pointer(
tmp_share->monitoring_binlog_pos_at_failing_length = 1;
tmp_share->monitoring_flag_length = 1;
tmp_share->monitoring_kind_length = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_flag_length = 1;
tmp_share->monitoring_bg_kind_length = 1;
-#endif
tmp_share->monitoring_limit_length = 1;
tmp_share->monitoring_sid_length = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_interval_length = 1;
-#endif
tmp_share->use_handlers_length = 1;
tmp_share->connect_timeouts_length = 1;
tmp_share->net_read_timeouts_length = 1;
@@ -8155,16 +7646,12 @@ void spider_set_tmp_share_pointer(
tmp_share->bka_table_name_types_length = 1;
tmp_share->strict_group_bys_length = 1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_flag[0] = -1;
tmp_share->monitoring_bg_kind[0] = -1;
-#endif
tmp_share->monitoring_binlog_pos_at_failing[0] = -1;
tmp_share->monitoring_flag[0] = -1;
tmp_share->monitoring_kind[0] = -1;
-#ifndef WITHOUT_SPIDER_BG_SEARCH
tmp_share->monitoring_bg_interval[0] = -1;
-#endif
tmp_share->monitoring_limit[0] = -1;
tmp_share->monitoring_sid[0] = -1;
tmp_share->bka_engine = NULL;
@@ -8348,13 +7835,11 @@ longlong spider_split_read_param(
DBUG_PRINT("info",("spider bulk_update_mode=%d", bulk_update_mode));
DBUG_PRINT("info",("spider support_bulk_update_sql=%s",
spider->support_bulk_update_sql() ? "TRUE" : "FALSE"));
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
bool inserting =
(
spider->wide_handler->sql_command == SQLCOM_INSERT ||
spider->wide_handler->sql_command == SQLCOM_INSERT_SELECT
);
-#endif
bool updating =
(
spider->wide_handler->sql_command == SQLCOM_UPDATE ||
@@ -8375,12 +7860,10 @@ longlong spider_split_read_param(
DBUG_PRINT("info",("spider replacing=%s", replacing ? "TRUE" : "FALSE"));
TABLE *table = spider->get_table();
if (
-#ifdef SPIDER_HAS_GROUP_BY_HANDLER
(
inserting &&
spider->use_fields
) ||
-#endif
replacing ||
(
(
@@ -8574,75 +8057,52 @@ bool spider_check_direct_order_limit(
spider->use_index_merge ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider is_clone=%s",
spider->is_clone ? "TRUE" : "FALSE"));
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_PRINT("info",("spider is_bulk_access_clone=%s",
- spider->is_bulk_access_clone ? "TRUE" : "FALSE"));
-#endif
if (
spider->wide_handler->sql_command != SQLCOM_HA_READ &&
!spider->use_index_merge &&
-#ifdef HA_CAN_BULK_ACCESS
- (!spider->is_clone || spider->is_bulk_access_clone)
-#else
!spider->is_clone
-#endif
) {
spider_get_select_limit(spider, &select_lex, &select_limit, &offset_limit);
bool first_check = TRUE;
DBUG_PRINT("info",("spider select_lex=%p", select_lex));
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
DBUG_PRINT("info",("spider leaf_tables.elements=%u",
select_lex ? select_lex->leaf_tables.elements : 0));
-#endif
if (select_lex && (select_lex->options & SELECT_DISTINCT))
{
DBUG_PRINT("info",("spider with distinct"));
spider->result_list.direct_distinct = TRUE;
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = TRUE;
-#endif
DBUG_PRINT("info",("spider select_limit=%lld", select_limit));
DBUG_PRINT("info",("spider offset_limit=%lld", offset_limit));
if (
-#if MYSQL_VERSION_ID < 50500
- !thd->variables.engine_condition_pushdown ||
-#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else
!(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
-#endif
#ifdef SPIDER_NEED_CHECK_CONDITION_AT_CHECKING_DIRECT_ORDER_LIMIT
!spider->condition ||
#endif
!select_lex ||
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
select_lex->leaf_tables.elements != 1 ||
-#endif
select_lex->table_list.elements != 1
) {
DBUG_PRINT("info",("spider first_check is FALSE"));
first_check = FALSE;
spider->result_list.direct_distinct = FALSE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = FALSE;
-#endif
} else if (spider_db_append_condition(spider, NULL, 0, TRUE))
{
DBUG_PRINT("info",("spider FALSE by condition"));
first_check = FALSE;
spider->result_list.direct_distinct = FALSE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = FALSE;
-#endif
} else if (spider->sql_kinds & SPIDER_SQL_KIND_HANDLER)
{
DBUG_PRINT("info",("spider sql_kinds with SPIDER_SQL_KIND_HANDLER"));
spider->result_list.direct_distinct = FALSE;
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate = FALSE;
} else if (
!select_lex->group_list.elements &&
@@ -8680,7 +8140,6 @@ bool spider_check_direct_order_limit(
first_check = FALSE;
spider->result_list.direct_distinct = FALSE;
}
-#endif
}
longlong direct_order_limit = spider_param_direct_order_limit(thd,
@@ -8692,10 +8151,8 @@ bool spider_check_direct_order_limit(
first_check ? "TRUE" : "FALSE"));
DBUG_PRINT("info",("spider (select_lex->options & OPTION_FOUND_ROWS)=%s",
select_lex && (select_lex->options & OPTION_FOUND_ROWS) ? "TRUE" : "FALSE"));
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
DBUG_PRINT("info",("spider direct_aggregate=%s",
spider->result_list.direct_aggregate ? "TRUE" : "FALSE"));
-#endif
DBUG_PRINT("info",("spider select_lex->group_list.elements=%u",
select_lex ? select_lex->group_list.elements : 0));
DBUG_PRINT("info",("spider select_lex->with_sum_func=%s",
@@ -8709,9 +8166,7 @@ bool spider_check_direct_order_limit(
!select_lex->limit_params.explicit_limit ||
(select_lex->options & OPTION_FOUND_ROWS) ||
(
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
!spider->result_list.direct_aggregate &&
-#endif
(
select_lex->group_list.elements ||
select_lex->with_sum_func
@@ -8745,7 +8200,6 @@ bool spider_check_direct_order_limit(
DBUG_RETURN(FALSE);
}
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_all_part_in_order(
ORDER *order,
TABLE *table
@@ -8808,12 +8262,6 @@ Field *spider_field_exchange(
Field *field
) {
DBUG_ENTER("spider_field_exchange");
-#ifdef HA_CAN_BULK_ACCESS
- if (handler->is_bulk_access_clone)
- {
- handler = handler->pt_clone_source_handler;
- }
-#endif
DBUG_PRINT("info",("spider in field=%p", field));
DBUG_PRINT("info",("spider in field->table=%p", field->table));
DBUG_PRINT("info",("spider table=%p", handler->get_table()));
@@ -8822,7 +8270,6 @@ Field *spider_field_exchange(
DBUG_PRINT("info",("spider out field=%p", field));
DBUG_RETURN(field);
}
-#endif
int spider_set_direct_limit_offset(
ha_spider *spider
@@ -8855,9 +8302,7 @@ int spider_set_direct_limit_offset(
if (
spider->wide_handler->sql_command != SQLCOM_SELECT ||
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
spider->result_list.direct_aggregate ||
-#endif
spider->result_list.direct_order_limit ||
spider->prev_index_rnd_init != SPD_RND // must be RND_INIT and not be INDEX_INIT
)
@@ -8888,15 +8333,11 @@ int spider_set_direct_limit_offset(
// contain where
if (
-#if MYSQL_VERSION_ID < 50500
- !thd->variables.engine_condition_pushdown ||
-#else
#ifdef SPIDER_ENGINE_CONDITION_PUSHDOWN_IS_ALWAYS_ON
#else
!(thd->variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN) ||
#endif
-#endif
// conditions is null may be no where condition in rand_init
spider->wide_handler->condition
)
@@ -9042,24 +8483,14 @@ ulong spider_calc_for_sort(
double spider_rand(
uint32 rand_source
) {
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
struct my_rnd_struct rand;
-#else
- struct rand_struct rand;
-#endif
DBUG_ENTER("spider_rand");
/* generate same as rand function for applications */
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
my_rnd_init(&rand, (uint32) (rand_source * 65537L + 55555555L),
(uint32) (rand_source * 268435457L));
-#else
- randominit(&rand, (uint32) (rand_source * 65537L + 55555555L),
- (uint32) (rand_source * 268435457L));
-#endif
DBUG_RETURN(my_rnd(&rand));
}
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
int spider_discover_table_structure_internal(
SPIDER_TRX *trx,
SPIDER_SHARE *spider_share,
@@ -9093,14 +8524,10 @@ int spider_discover_table_structure(
const char *table_name = share->path.str;
uint table_name_length = (uint) strlen(table_name);
SPIDER_TRX *trx;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info = thd->work_part_info;
-#endif
SPIDER_Open_tables_backup open_tables_backup;
TABLE *table_tables;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
uint str_len;
-#endif
char buf[MAX_FIELD_WIDTH];
spider_string str(buf, sizeof(buf), system_charset_info);
DBUG_ENTER("spider_discover_table_structure");
@@ -9122,13 +8549,9 @@ int spider_discover_table_structure(
str.q_append(share->table_name.str, share->table_name.length);
str.q_append(SPIDER_SQL_LCL_NAME_QUOTE_STR, SPIDER_SQL_LCL_NAME_QUOTE_LEN);
str.q_append(SPIDER_SQL_OPEN_PAREN_STR, SPIDER_SQL_OPEN_PAREN_LEN);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
str_len = str.length();
-#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(&spider_open_tables,
(uchar*) table_name, table_name_length);
-#endif
if (!(trx = spider_get_trx(thd, TRUE, &error_num)))
{
DBUG_PRINT("info",("spider spider_get_trx error"));
@@ -9137,17 +8560,11 @@ int spider_discover_table_structure(
}
share->table_charset = info->default_table_charset;
share->comment = info->comment;
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (!part_info)
{
-#endif
if (!(spider_share = spider_create_share(table_name, share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
-#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
-#endif
&error_num
))) {
DBUG_RETURN(error_num);
@@ -9163,7 +8580,6 @@ int spider_discover_table_structure(
SPIDER_SYS_TABLES_TABLE_NAME_LEN, TRUE, &open_tables_backup, FALSE,
&error_num))
) {
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
if (thd->lex->create_info.or_replace())
{
error_num = spider_delete_tables(table_tables,
@@ -9171,18 +8587,14 @@ int spider_discover_table_structure(
}
if (!error_num)
{
-#endif
error_num = spider_insert_tables(table_tables, spider_share);
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
}
-#endif
spider_close_sys_table(thd, table_tables,
&open_tables_backup, FALSE);
}
}
spider_free_share_resource_only(spider_share);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
} else {
char tmp_name[FN_REFLEN + 1];
List_iterator<partition_element> part_it(part_info->partitions);
@@ -9206,9 +8618,7 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
-#endif
&error_num
))) {
DBUG_RETURN(error_num);
@@ -9234,9 +8644,7 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
-#endif
&error_num
))) {
DBUG_RETURN(error_num);
@@ -9277,15 +8685,12 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
-#endif
&error_num
))) {
DBUG_RETURN(error_num);
}
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
if (thd->lex->create_info.or_replace())
{
error_num = spider_delete_tables(table_tables,
@@ -9293,11 +8698,8 @@ int spider_discover_table_structure(
}
if (!error_num)
{
-#endif
error_num = spider_insert_tables(table_tables, spider_share);
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
}
-#endif
spider_free_share_resource_only(spider_share);
if (error_num)
@@ -9315,15 +8717,12 @@ int spider_discover_table_structure(
DBUG_PRINT("info",("spider tmp_name=%s", tmp_name));
if (!(spider_share = spider_create_share(tmp_name, share,
part_info,
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
hash_value,
-#endif
&error_num
))) {
DBUG_RETURN(error_num);
}
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
if (thd->lex->create_info.or_replace())
{
error_num = spider_delete_tables(table_tables,
@@ -9331,11 +8730,8 @@ int spider_discover_table_structure(
}
if (!error_num)
{
-#endif
error_num = spider_insert_tables(table_tables, spider_share);
-#ifdef SPIDER_SUPPORT_CREATE_OR_REPLACE_TABLE
}
-#endif
spider_free_share_resource_only(spider_share);
if (error_num)
@@ -9346,7 +8742,6 @@ int spider_discover_table_structure(
&open_tables_backup, FALSE);
}
}
-#endif
if (!error_num)
thd->clear_error();
@@ -9394,7 +8789,6 @@ int spider_discover_table_structure(
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
}
str.q_append(SPIDER_SQL_VALUE_QUOTE_STR, SPIDER_SQL_VALUE_QUOTE_LEN);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
DBUG_PRINT("info",("spider part_info=%p", part_info));
if (part_info)
{
@@ -9430,16 +8824,13 @@ int spider_discover_table_structure(
str.q_append(part_syntax, part_syntax_len);
SPIDER_free_part_syntax(part_syntax, MYF(0));
}
-#endif
DBUG_PRINT("info",("spider str=%s", str.c_ptr_safe()));
error_num = share->init_from_sql_statement_string(thd, TRUE, str.ptr(),
str.length());
DBUG_RETURN(error_num);
}
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_create_spider_object_for_share(
SPIDER_TRX *trx,
SPIDER_SHARE *share,
@@ -9568,46 +8959,27 @@ int spider_create_sts_threads(
) {
int error_num;
DBUG_ENTER("spider_create_sts_threads");
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_thread->mutex,
- MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_stss,
&spider_thread->mutex, MY_MUTEX_INIT_FAST))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&spider_thread->cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_stss,
&spider_thread->cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&spider_thread->sync_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_sts_syncs,
&spider_thread->sync_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_create(&spider_thread->thread, &spider_pt_attr,
- spider_table_bg_sts_action, (void *) spider_thread)
- )
-#else
if (mysql_thread_create(spd_key_thd_bg_stss, &spider_thread->thread,
&spider_pt_attr, spider_table_bg_sts_action, (void *) spider_thread)
)
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create;
@@ -9656,46 +9028,27 @@ int spider_create_crd_threads(
) {
int error_num;
DBUG_ENTER("spider_create_crd_threads");
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&spider_thread->mutex,
- MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_bg_crds,
&spider_thread->mutex, MY_MUTEX_INIT_FAST))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_mutex_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&spider_thread->cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_crds,
&spider_thread->cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_cond_init(&spider_thread->sync_cond, NULL))
-#else
if (mysql_cond_init(spd_key_cond_bg_crd_syncs,
&spider_thread->sync_cond, NULL))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_sync_cond_init;
}
-#if MYSQL_VERSION_ID < 50500
- if (pthread_create(&spider_thread->thread, &spider_pt_attr,
- spider_table_bg_crd_action, (void *) spider_thread)
- )
-#else
if (mysql_thread_create(spd_key_thd_bg_crds, &spider_thread->thread,
&spider_pt_attr, spider_table_bg_crd_action, (void *) spider_thread)
)
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error_thread_create;
@@ -9910,18 +9263,11 @@ void *spider_table_bg_sts_action(
("spider search_link_idx=%d", spider->search_link_idx));
if (spider->search_link_idx >= 0 && conns[spider->search_link_idx])
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (spider_get_sts(share, spider->search_link_idx,
share->bg_sts_try_time, spider,
share->bg_sts_interval, share->bg_sts_mode,
share->bg_sts_sync,
2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
-#else
- if (spider_get_sts(share, spider->search_link_idx,
- share->bg_sts_try_time, spider,
- share->bg_sts_interval, share->bg_sts_mode,
- 2, HA_STATUS_CONST | HA_STATUS_VARIABLE))
-#endif
{
spider->search_link_idx = -1;
}
@@ -10063,18 +9409,11 @@ void *spider_table_bg_crd_action(
("spider search_link_idx=%d", spider->search_link_idx));
if (spider->search_link_idx >= 0 && conns[spider->search_link_idx])
{
-#ifdef WITH_PARTITION_STORAGE_ENGINE
if (spider_get_crd(share, spider->search_link_idx,
share->bg_crd_try_time, spider, table,
share->bg_crd_interval, share->bg_crd_mode,
share->bg_crd_sync,
2))
-#else
- if (spider_get_crd(share, spider->search_link_idx,
- share->bg_crd_try_time, spider, table,
- share->bg_crd_interval, share->bg_crd_mode,
- 2))
-#endif
{
spider->search_link_idx = -1;
}
@@ -10261,7 +9600,6 @@ void spider_table_remove_share_from_crd_thread(
}
DBUG_VOID_RETURN;
}
-#endif
uchar *spider_duplicate_char(
uchar *dst,
diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h
index c55e016c988..9b6eecb9d56 100644
--- a/storage/spider/spd_table.h
+++ b/storage/spider/spd_table.h
@@ -402,18 +402,14 @@ int spider_increase_longlong_list(
int spider_parse_connect_info(
SPIDER_SHARE *share,
TABLE_SHARE *table_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info,
-#endif
uint create_table
);
int spider_set_connect_info_default(
SPIDER_SHARE *share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_element *part_elem,
partition_element *sub_elem,
-#endif
TABLE_SHARE *table_share
);
@@ -442,7 +438,6 @@ int spider_create_conn_keys(
SPIDER_SHARE *share
);
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
const char *table_name,
uint table_name_length,
@@ -451,15 +446,6 @@ SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
bool need_to_create,
int *error_num
);
-#else
-SPIDER_LGTM_TBLHND_SHARE *spider_get_lgtm_tblhnd_share(
- const char *table_name,
- uint table_name_length,
- bool locked,
- bool need_to_create,
- int *error_num
-);
-#endif
void spider_free_lgtm_tblhnd_share_alloc(
SPIDER_LGTM_TBLHND_SHARE *lgtm_tblhnd_share,
@@ -469,12 +455,8 @@ void spider_free_lgtm_tblhnd_share_alloc(
SPIDER_SHARE *spider_create_share(
const char *table_name,
TABLE_SHARE *table_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info,
-#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value,
-#endif
int *error_num
);
@@ -584,7 +566,6 @@ char *spider_create_table_name_string(
const char *sub_name
);
-#ifdef WITH_PARTITION_STORAGE_ENGINE
void spider_get_partition_info(
const char *table_name,
uint table_name_length,
@@ -593,7 +574,6 @@ void spider_get_partition_info(
partition_element **part_elem,
partition_element **sub_elem
);
-#endif
int spider_get_sts(
SPIDER_SHARE *share,
@@ -602,9 +582,7 @@ int spider_get_sts(
ha_spider *spider,
double sts_interval,
int sts_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int sts_sync,
-#endif
int sts_sync_level,
uint flag
);
@@ -617,9 +595,7 @@ int spider_get_crd(
TABLE *table,
double crd_interval,
int crd_mode,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
int crd_sync,
-#endif
int crd_sync_level
);
@@ -709,7 +685,6 @@ bool spider_check_direct_order_limit(
ha_spider *spider
);
-#ifdef HANDLER_HAS_DIRECT_AGGREGATE
bool spider_all_part_in_order(
ORDER *order,
TABLE *table
@@ -719,7 +694,6 @@ Field *spider_field_exchange(
handler *handler,
Field *field
);
-#endif
int spider_set_direct_limit_offset(
ha_spider *spider
@@ -744,7 +718,6 @@ double spider_rand(
uint32 rand_source
);
-#ifdef SPIDER_HAS_DISCOVER_TABLE_STRUCTURE
int spider_discover_table_structure_internal(
SPIDER_TRX *trx,
SPIDER_SHARE *spider_share,
@@ -757,9 +730,7 @@ int spider_discover_table_structure(
TABLE_SHARE *share,
HA_CREATE_INFO *info
);
-#endif
-#ifndef WITHOUT_SPIDER_BG_SEARCH
int spider_create_spider_object_for_share(
SPIDER_TRX *trx,
SPIDER_SHARE *share,
@@ -809,7 +780,6 @@ void spider_table_remove_share_from_sts_thread(
void spider_table_remove_share_from_crd_thread(
SPIDER_SHARE *share
);
-#endif
uchar *spider_duplicate_char(
uchar *dst,
uchar esc,
diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index dac9b728e97..29dddee5b98 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -18,16 +18,11 @@
#include <my_global.h>
#include "mysql_version.h"
#include "spd_environ.h"
-#if MYSQL_VERSION_ID < 50500
-#include "mysql_priv.h"
-#include <mysql/plugin.h>
-#else
#include "sql_priv.h"
#include "probes_mysql.h"
#include "sql_class.h"
#include "sql_partition.h"
#include "records.h"
-#endif
#include "spd_err.h"
#include "spd_param.h"
#include "spd_db_include.h"
@@ -384,12 +379,7 @@ void spider_free_trx_alter_table_alloc(
SPIDER_ALTER_TABLE *alter_table
) {
DBUG_ENTER("spider_free_trx_alter_table_alloc");
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&trx->trx_alter_table_hash,
- alter_table->table_name_hash_value, (uchar*) alter_table);
-#else
my_hash_delete(&trx->trx_alter_table_hash, (uchar*) alter_table);
-#endif
if (alter_table->tmp_char)
spider_free(trx, alter_table->tmp_char, MYF(0));
spider_free(trx, alter_table, MYF(0));
@@ -590,11 +580,9 @@ int spider_create_trx_alter_table(
alter_table->table_name = tmp_name;
memcpy(alter_table->table_name, share->table_name, share->table_name_length);
alter_table->table_name_length = share->table_name_length;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
DBUG_PRINT("info",("spider table_name_hash_value=%u",
share->table_name_hash_value));
alter_table->table_name_hash_value = share->table_name_hash_value;
-#endif
alter_table->tmp_priority = share->priority;
alter_table->link_count = share->link_count;
alter_table->all_link_count = share->all_link_count;
@@ -904,12 +892,7 @@ int spider_create_trx_alter_table(
share_alter->tmp_link_statuses_length;
old_elements = trx->trx_alter_table_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&trx->trx_alter_table_hash,
- alter_table->table_name_hash_value, (uchar*) alter_table))
-#else
if (my_hash_insert(&trx->trx_alter_table_hash, (uchar*) alter_table))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error;
@@ -1250,13 +1233,8 @@ SPIDER_TRX *spider_get_trx(
roop_count < (int) spider_param_udf_table_lock_mutex_count();
roop_count++)
{
-#if MYSQL_VERSION_ID < 50500
- if (pthread_mutex_init(&trx->udf_table_mutexes[roop_count],
- MY_MUTEX_INIT_FAST))
-#else
if (mysql_mutex_init(spd_key_mutex_udf_table,
&trx->udf_table_mutexes[roop_count], MY_MUTEX_INIT_FAST))
-#endif
goto error_init_udf_table_mutex;
}
@@ -1313,13 +1291,6 @@ SPIDER_TRX *spider_get_trx(
trx->trx_ha_hash.array.size_of_element);
trx->thd = (THD*) thd;
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
- if (thd)
- trx->thd_hash_value = my_calc_hash(&spider_allocated_thds,
- (uchar*) thd, sizeof(THD *));
- else
- trx->thd_hash_value = 0;
-#endif
pthread_mutex_lock(&spider_thread_id_mutex);
trx->spider_thread_id = spider_thread_id;
++spider_thread_id;
@@ -1333,10 +1304,8 @@ SPIDER_TRX *spider_get_trx(
if (
spider_set_connect_info_default(
trx->tmp_share,
-#ifdef WITH_PARTITION_STORAGE_ENGINE
NULL,
NULL,
-#endif
NULL
) ||
spider_set_connect_info_default_db_table(
@@ -1406,12 +1375,7 @@ SPIDER_TRX *spider_get_trx(
{
pthread_mutex_lock(&spider_allocated_thds_mutex);
uint old_elements = spider_allocated_thds.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&spider_allocated_thds,
- trx->thd_hash_value, (uchar*) thd))
-#else
if (my_hash_insert(&spider_allocated_thds, (uchar*) thd))
-#endif
{
pthread_mutex_unlock(&spider_allocated_thds_mutex);
goto error_allocated_thds_insert;
@@ -1517,12 +1481,7 @@ int spider_free_trx(
{
if (need_lock)
pthread_mutex_lock(&spider_allocated_thds_mutex);
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&spider_allocated_thds,
- trx->thd_hash_value, (uchar*) trx->thd);
-#else
my_hash_delete(&spider_allocated_thds, (uchar*) trx->thd);
-#endif
if (need_lock)
pthread_mutex_unlock(&spider_allocated_thds_mutex);
}
@@ -1679,14 +1638,12 @@ static int spider_xa_lock(
DBUG_ENTER("spider_xa_lock");
#ifdef SPIDER_XID_USES_xid_cache_iterate
#else
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
(uchar*) xid_state->xid.key(), xid_state->xid.key_length());
#ifdef XID_CACHE_IS_SPLITTED
uint idx = hash_value % *spd_db_att_xid_cache_split_num;
#endif
#endif
-#endif
old_proc_info = thd_proc_info(thd, "Locking xid by Spider");
#ifdef SPIDER_XID_USES_xid_cache_iterate
if (xid_cache_insert(thd, xid_state, xid))
@@ -1701,7 +1658,6 @@ static int spider_xa_lock(
#else
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
#endif
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
#ifdef XID_CACHE_IS_SPLITTED
if (my_hash_search_using_hash_value(&spd_db_att_xid_cache[idx], hash_value,
xid_state->xid.key(), xid_state->xid.key_length()))
@@ -1709,25 +1665,11 @@ static int spider_xa_lock(
if (my_hash_search_using_hash_value(spd_db_att_xid_cache, hash_value,
xid_state->xid.key(), xid_state->xid.key_length()))
#endif
-#else
- if (my_hash_search(spd_db_att_xid_cache,
- xid_state->xid.key(), xid_state->xid.key_length()))
-#endif
{
error_num = ER_SPIDER_XA_LOCKED_NUM;
goto error;
}
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
-#ifdef XID_CACHE_IS_SPLITTED
- if (my_hash_insert_with_hash_value(&spd_db_att_xid_cache[idx], hash_value,
- (uchar*)xid_state))
-#else
- if (my_hash_insert_with_hash_value(spd_db_att_xid_cache, hash_value,
- (uchar*)xid_state))
-#endif
-#else
if (my_hash_insert(spd_db_att_xid_cache, (uchar*)xid_state))
-#endif
{
error_num = HA_ERR_OUT_OF_MEM;
goto error;
@@ -1762,13 +1704,6 @@ static int spider_xa_unlock(
DBUG_ENTER("spider_xa_unlock");
#ifdef SPIDER_XID_USES_xid_cache_iterate
#else
-#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
- my_hash_value_type hash_value = my_calc_hash(spd_db_att_xid_cache,
- (uchar*) xid_state->xid.key(), xid_state->xid.key_length());
-#ifdef XID_CACHE_IS_SPLITTED
- uint idx = hash_value % *spd_db_att_xid_cache_split_num;
-#endif
-#endif
#endif
old_proc_info = thd_proc_info(thd, "Unlocking xid by Spider");
#ifdef SPIDER_XID_USES_xid_cache_iterate
@@ -1779,17 +1714,7 @@ static int spider_xa_unlock(
#else
pthread_mutex_lock(spd_db_att_LOCK_xid_cache);
#endif
-#if defined(SPIDER_HAS_HASH_VALUE_TYPE) && defined(HASH_UPDATE_WITH_HASH_VALUE)
-#ifdef XID_CACHE_IS_SPLITTED
- my_hash_delete_with_hash_value(&spd_db_att_xid_cache[idx],
- hash_value, (uchar *)xid_state);
-#else
- my_hash_delete_with_hash_value(spd_db_att_xid_cache,
- hash_value, (uchar *)xid_state);
-#endif
-#else
my_hash_delete(spd_db_att_xid_cache, (uchar *)xid_state);
-#endif
#ifdef XID_CACHE_IS_SPLITTED
pthread_mutex_unlock(&spd_db_att_LOCK_xid_cache[idx]);
#else
@@ -1875,17 +1800,10 @@ int spider_internal_start_trx(
(trx->xid.data, "%lx%016llx", thd_get_thread_id(thd),
thd->query_id));
}
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100002
trx->xid.bqual_length
= my_sprintf(trx->xid.data + trx->xid.gtrid_length,
(trx->xid.data + trx->xid.gtrid_length, "%lx",
thd->variables.server_id));
-#else
- trx->xid.bqual_length
- = my_sprintf(trx->xid.data + trx->xid.gtrid_length,
- (trx->xid.data + trx->xid.gtrid_length, "%x",
- thd->server_id));
-#endif
#ifdef SPIDER_XID_STATE_HAS_in_thd
trx->internal_xid_state.in_thd = 1;
@@ -3316,11 +3234,6 @@ int spider_commit(
if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr)))
DBUG_RETURN(0); /* transaction is not started */
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p",
- trx->bulk_access_conn_first));
- trx->bulk_access_conn_first = NULL;
-#endif
/*
We do (almost) nothing if the following two conditions are both met:
@@ -3414,11 +3327,6 @@ int spider_rollback(
if (!(trx = (SPIDER_TRX*) thd_get_ha_data(thd, spider_hton_ptr)))
DBUG_RETURN(0); /* transaction is not started */
-#ifdef HA_CAN_BULK_ACCESS
- DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p",
- trx->bulk_access_conn_first));
- trx->bulk_access_conn_first = NULL;
-#endif
if (all || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
{
@@ -3902,19 +3810,8 @@ THD *spider_create_tmp_thd()
DBUG_ENTER("spider_create_tmp_thd");
if (!(thd = SPIDER_new_THD((my_thread_id) 0)))
DBUG_RETURN(NULL);
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
thd->killed = NOT_KILLED;
-#else
- thd->killed = THD::NOT_KILLED;
-#endif
-#if MYSQL_VERSION_ID < 50500
- thd->locked_tables = FALSE;
-#endif
thd->proc_info = "";
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100200
-#else
- thd->thread_id = thd->variables.pseudo_thread_id = 0;
-#endif
thd->thread_stack = (char*) &thd;
thd->store_globals();
lex_start(thd);
@@ -3926,11 +3823,7 @@ void spider_free_tmp_thd(
) {
DBUG_ENTER("spider_free_tmp_thd");
thd->cleanup();
-#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
thd->reset_globals();
-#else
- thd->restore_globals();
-#endif
delete thd;
DBUG_VOID_RETURN;
}
@@ -3957,12 +3850,7 @@ int spider_create_trx_ha(
) {
DBUG_PRINT("info",("spider need recreate"));
need_create = TRUE;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- my_hash_delete_with_hash_value(&trx->trx_ha_hash,
- share->table_name_hash_value, (uchar*) trx_ha);
-#else
my_hash_delete(&trx->trx_ha_hash, (uchar*) trx_ha);
-#endif
spider_free(trx, trx_ha, MYF(0));
} else {
DBUG_PRINT("info",("spider use this"));
@@ -3993,12 +3881,7 @@ int spider_create_trx_ha(
trx_ha->conn_can_fo = conn_can_fo;
trx_ha->wait_for_reusing = FALSE;
uint old_elements = trx->trx_ha_hash.array.max_element;
-#ifdef HASH_UPDATE_WITH_HASH_VALUE
- if (my_hash_insert_with_hash_value(&trx->trx_ha_hash,
- share->table_name_hash_value, (uchar*) trx_ha))
-#else
if (my_hash_insert(&trx->trx_ha_hash, (uchar*) trx_ha))
-#endif
{
spider_free(trx, trx_ha, MYF(0));
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
@@ -4025,14 +3908,9 @@ SPIDER_TRX_HA *spider_check_trx_ha(
SPIDER_TRX_HA *trx_ha;
SPIDER_SHARE *share = spider->share;
DBUG_ENTER("spider_check_trx_ha");
-#ifdef SPIDER_HAS_HASH_VALUE_TYPE
if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search_using_hash_value(
&trx->trx_ha_hash, share->table_name_hash_value,
(uchar*) share->table_name, share->table_name_length)))
-#else
- if ((trx_ha = (SPIDER_TRX_HA *) my_hash_search(&trx->trx_ha_hash,
- (uchar*) share->table_name, share->table_name_length)))
-#endif
{
memcpy(spider->conn_link_idx, trx_ha->conn_link_idx,
sizeof(uint) * share->link_count);
@@ -4148,34 +4026,3 @@ int spider_trx_check_link_idx_failed(
DBUG_RETURN(0);
}
-#ifdef HA_CAN_BULK_ACCESS
-void spider_trx_add_bulk_access_conn(
- SPIDER_TRX *trx,
- SPIDER_CONN *conn
-) {
- DBUG_ENTER("spider_trx_add_bulk_access_conn");
- DBUG_PRINT("info",("spider trx=%p", trx));
- DBUG_PRINT("info",("spider conn=%p", conn));
- DBUG_PRINT("info",("spider conn->bulk_access_requests=%u",
- conn->bulk_access_requests));
- DBUG_PRINT("info",("spider conn->bulk_access_sended=%u",
- conn->bulk_access_sended));
- DBUG_PRINT("info",("spider trx->bulk_access_conn_first=%p",
- trx->bulk_access_conn_first));
- if (!conn->bulk_access_requests && !conn->bulk_access_sended)
- {
- if (!trx->bulk_access_conn_first)
- {
- trx->bulk_access_conn_first = conn;
- } else {
- trx->bulk_access_conn_last->bulk_access_next = conn;
- }
- trx->bulk_access_conn_last = conn;
- conn->bulk_access_next = NULL;
- }
- conn->bulk_access_requests++;
- DBUG_PRINT("info",("spider conn->bulk_access_requests=%u",
- conn->bulk_access_requests));
- DBUG_VOID_RETURN;
-}
-#endif
diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h
index 3bf93aada1a..2055a49717e 100644
--- a/storage/spider/spd_trx.h
+++ b/storage/spider/spd_trx.h
@@ -266,9 +266,3 @@ int spider_trx_check_link_idx_failed(
ha_spider *spider
);
-#ifdef HA_CAN_BULK_ACCESS
-void spider_trx_add_bulk_access_conn(
- SPIDER_TRX *trx,
- SPIDER_CONN *conn
-);
-#endif
diff --git a/storage/spider/spd_udf.cc b/storage/spider/spd_udf.cc
index 3f7cc65477f..13a9b41f7e2 100644
--- a/storage/spider/spd_udf.cc
+++ b/storage/spider/spd_udf.cc
@@ -43,7 +43,6 @@ void spider_direct_sql_deinit(
spider_direct_sql_deinit_body(initid);
}
-#ifndef WITHOUT_SPIDER_BG_SEARCH
long long spider_bg_direct_sql(
UDF_INIT *initid,
UDF_ARGS *args,
@@ -83,7 +82,6 @@ void spider_bg_direct_sql_add(
) {
spider_direct_sql_body(initid, args, is_null, error, TRUE);
}
-#endif
long long spider_ping_table(
UDF_INIT *initid,
diff --git a/storage/spider/spd_udf.h b/storage/spider/spd_udf.h
index d00a6151894..bb9f1ce252b 100644
--- a/storage/spider/spd_udf.h
+++ b/storage/spider/spd_udf.h
@@ -32,7 +32,6 @@ void spider_direct_sql_deinit_body(
UDF_INIT *initid
);
-#ifndef WITHOUT_SPIDER_BG_SEARCH
void spider_direct_sql_bg_start(
UDF_INIT *initid
);
@@ -40,7 +39,6 @@ void spider_direct_sql_bg_start(
long long spider_direct_sql_bg_end(
UDF_INIT *initid
);
-#endif
long long spider_ping_table_body(
UDF_INIT *initid,
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 6544f88f559..fcccc896bbf 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -632,3 +632,7 @@ struct charset_info_st my_charset_bin =
&my_charset_handler,
&my_collation_binary_handler
};
+
+
+struct charset_info_st my_collation_contextually_typed_binary= {0};
+struct charset_info_st my_collation_contextually_typed_default= {0};
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 6898e9741a8..903dec978b4 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, 2020, MariaDB Corporation.
+/* Copyright (c) 2016, 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
@@ -983,8 +983,10 @@ enum json_path_chr_classes {
P_USD, /* $ */
P_ASTER, /* * */
P_LSQRB, /* [ */
+ P_T, /* t (for to) */
P_RSQRB, /* ] */
P_POINT, /* . */
+ P_NEG, /* hyphen (for negative index in path) */
P_ZERO, /* 0 */
P_DIGIT, /* 123456789 */
P_L, /* l (for "lax") */
@@ -1006,18 +1008,18 @@ static enum json_path_chr_classes json_path_chr_map[128] = {
P_ERR, P_ERR, P_ERR, P_ERR, P_ERR, P_ERR, P_ERR, P_ERR,
P_SPACE, P_ETC, P_QUOTE, P_ETC, P_USD, P_ETC, P_ETC, P_ETC,
- P_ETC, P_ETC, P_ASTER, P_ETC, P_ETC, P_ETC, P_POINT, P_ETC,
+ P_ETC, P_ETC, P_ASTER, P_ETC, P_ETC, P_NEG, P_POINT, P_ETC,
P_ZERO, P_DIGIT, P_DIGIT, P_DIGIT, P_DIGIT, P_DIGIT, P_DIGIT, P_DIGIT,
P_DIGIT, P_DIGIT, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC,
P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC,
P_ETC, P_ETC, P_ETC, P_ETC, P_L, P_ETC, P_ETC, P_ETC,
- P_ETC, P_ETC, P_S, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC,
+ P_ETC, P_ETC, P_S, P_ETC, P_T, P_ETC, P_ETC, P_ETC,
P_ETC, P_ETC, P_ETC, P_LSQRB, P_BKSL, P_RSQRB, P_ETC, P_ETC,
P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC,
P_ETC, P_ETC, P_ETC, P_ETC, P_L, P_ETC, P_ETC, P_ETC,
- P_ETC, P_ETC, P_S, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC,
+ P_ETC, P_ETC, P_S, P_ETC, P_T, P_ETC, P_ETC, P_ETC,
P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC, P_ETC
};
@@ -1029,6 +1031,7 @@ enum json_path_states {
PS_AR, /* Parse array step. */
PS_SAR, /* space after the '['. */
PS_AWD, /* Array wildcard. */
+ PS_NEG, /* Parse '-' (hyphen) */
PS_Z, /* '0' (as an array item number). */
PS_INT, /* Parse integer (as an array item number). */
PS_AS, /* Space. */
@@ -1039,6 +1042,8 @@ enum json_path_states {
PS_DWD, /* Double wildcard. */
PS_KEYX, /* Key started with quote ("). */
PS_KNMX, /* Parse quoted key name. */
+ PS_LAST, /* Parse 'last' keyword */
+ PS_T, /* Parse 'to' keyword. */
N_PATH_STATES, /* Below are states that aren't in the transitions table. */
PS_SCT, /* Parse the 'strict' keyword. */
PS_EKY, /* '.' after the keyname so next step is the key. */
@@ -1054,67 +1059,76 @@ enum json_path_states {
static int json_path_transitions[N_PATH_STATES][N_PATH_CLASSES]=
{
/*
- EOS $, * [ ] . 0
- 1..9 L S SPACE \ " ETC
+ EOS $, * [ to ] . -
+ 0 1..9 L S SPACE \ " ETC
ERR BAD
*/
-/* GO */ { JE_EOS, PS_PT, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
- JE_SYN, PS_LAX, PS_SCT, PS_GO, JE_SYN, JE_SYN, JE_SYN,
+/* GO */ { JE_EOS, PS_PT, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+ JE_SYN, JE_SYN, PS_LAX, PS_SCT, PS_GO, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* LAX */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
- JE_SYN, PS_LAX, JE_SYN, PS_GO, JE_SYN, JE_SYN, JE_SYN,
+/* LAX */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+ JE_SYN, JE_SYN, PS_LAX, JE_SYN, PS_GO, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* PT */ { PS_OK, JE_SYN, PS_AST, PS_AR, JE_SYN, PS_KEY, JE_SYN, JE_SYN,
- JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+/* PT */ { PS_OK, JE_SYN, PS_AST, PS_AR, JE_SYN, JE_SYN, PS_KEY, JE_SYN,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* AR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, JE_SYN, JE_SYN, PS_Z,
- PS_INT, JE_SYN, JE_SYN, PS_SAR, JE_SYN, JE_SYN, JE_SYN,
+/* AR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_NEG,
+ PS_Z, PS_INT, PS_LAST, JE_SYN, PS_SAR, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* SAR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, PS_PT, JE_SYN, PS_Z,
- PS_INT, JE_SYN, JE_SYN, PS_SAR, JE_SYN, JE_SYN, JE_SYN,
+/* SAR */ { JE_EOS, JE_SYN, PS_AWD, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN,
+ PS_Z, PS_INT, PS_LAST, JE_SYN, PS_SAR, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* AWD */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN,
- JE_SYN, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
+/* AWD */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* Z */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN,
- JE_SYN, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
+/* NEG */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+ PS_INT, PS_INT, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* INT */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, PS_INT,
- PS_INT, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
+/* Z */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* AS */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN, JE_SYN,
- JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
+/* INT */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, JE_SYN,
+ PS_INT, PS_INT, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* KEY */ { JE_EOS, PS_KNM, PS_KWD, JE_SYN, PS_KNM, JE_SYN, PS_KNM,
- PS_KNM, PS_KNM, PS_KNM, PS_KNM, JE_SYN, PS_KEYX, PS_KNM,
+/* AS */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, PS_T, PS_PT, JE_SYN, PS_NEG,
+ PS_Z, PS_INT, PS_LAST, PS_AS, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* KNM */ { PS_KOK, PS_KNM, PS_AST, PS_EAR, PS_KNM, PS_EKY, PS_KNM,
- PS_KNM, PS_KNM, PS_KNM, PS_KNM, PS_ESC, PS_KNM, PS_KNM,
+/* KEY */ { JE_EOS, PS_KNM, PS_KWD, JE_SYN, PS_KNM, PS_KNM, JE_SYN, JE_SYN,
+ PS_KNM, PS_KNM, PS_KNM, PS_KNM, PS_KNM, JE_SYN, PS_KEYX, PS_KNM,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* KWD */ { PS_OK, JE_SYN, JE_SYN, PS_AR, JE_SYN, PS_EKY, JE_SYN,
- JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+/* KNM */ { PS_KOK, PS_KNM, PS_AST, PS_EAR, PS_KNM, PS_KNM, PS_EKY, PS_KNM,
+ PS_KNM, PS_KNM, PS_KNM, PS_KNM, PS_KNM, PS_ESC, PS_KNM, PS_KNM,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* AST */ { JE_SYN, JE_SYN, PS_DWD, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
- JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+/* KWD */ { PS_OK, JE_SYN, JE_SYN, PS_AR, JE_SYN, JE_SYN, PS_EKY, JE_SYN,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* DWD */ { JE_SYN, JE_SYN, PS_AST, PS_AR, JE_SYN, PS_KEY, JE_SYN, JE_SYN,
- JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+/* AST */ { JE_SYN, JE_SYN, PS_DWD, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* KEYX*/ { JE_EOS, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX,
- PS_KNMX,PS_KNMX, PS_KNMX, PS_KNMX, PS_ESCX, PS_EKYX, PS_KNMX,
+/* DWD */ { JE_SYN, JE_SYN, PS_AST, PS_AR, JE_SYN, JE_SYN, PS_KEY, JE_SYN,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN,
JE_NOT_JSON_CHR, JE_BAD_CHR},
-/* KNMX */{ JE_EOS, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX,
- PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX,PS_ESCX, PS_EKYX, PS_KNMX,
+/* KEYX*/ { JE_EOS, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, JE_SYN,
+ PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_ESCX, PS_EKYX, PS_KNMX,
JE_NOT_JSON_CHR, JE_BAD_CHR},
+/* KNMX */{ JE_EOS, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX,
+ PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_KNMX, PS_ESCX, PS_EKYX, PS_KNMX,
+ JE_NOT_JSON_CHR, JE_BAD_CHR},
+/* LAST */{ JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, PS_NEG,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
+ JE_SYN, JE_BAD_CHR},
+/* T */ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_PT, JE_SYN, PS_NEG,
+ JE_SYN, JE_SYN, JE_SYN, JE_SYN, PS_AS, JE_SYN, JE_SYN, JE_SYN,
+ JE_SYN, JE_BAD_CHR},
};
int json_path_setup(json_path_t *p,
CHARSET_INFO *i_cs, const uchar *str, const uchar *end)
{
- int c_len, t_next, state= PS_GO;
+ int c_len, t_next, state= PS_GO, is_negative_index= 0, is_last= 0,
+ prev_value=0, is_to= 0, *cur_val;
enum json_path_step_types double_wildcard= JSON_PATH_KEY_NULL;
-
json_string_setup(&p->s, i_cs, str, end);
p->steps[0].type= JSON_PATH_ARRAY_WILD;
@@ -1153,8 +1167,22 @@ int json_path_setup(json_path_t *p,
p->types_used|= JSON_PATH_WILD;
continue;
case PS_INT:
- p->last_step->n_item*= 10;
- p->last_step->n_item+= p->s.c_next - '0';
+ cur_val= is_to ? &(p->last_step->n_item_end) :
+ &(p->last_step->n_item);
+ if (is_last)
+ {
+ prev_value*= 10;
+ prev_value-= p->s.c_next - '0';
+ *cur_val= -1 + prev_value;
+ }
+ else
+ {
+ (*cur_val)*= 10;
+ if (is_negative_index)
+ *cur_val-= p->s.c_next - '0';
+ else
+ *cur_val+= p->s.c_next - '0';
+ }
continue;
case PS_EKYX:
p->last_step->key_end= p->s.c_str - c_len;
@@ -1166,6 +1194,10 @@ int json_path_setup(json_path_t *p,
/* fall through */
case PS_KEY:
p->last_step++;
+ is_to= 0;
+ prev_value= 0;
+ is_negative_index= 0;
+ is_last= 0;
if (p->last_step - p->steps >= JSON_DEPTH_LIMIT)
return p->s.error= JE_DEPTH;
p->types_used|= p->last_step->type= JSON_PATH_KEY | double_wildcard;
@@ -1180,6 +1212,10 @@ int json_path_setup(json_path_t *p,
/* fall through */
case PS_AR:
p->last_step++;
+ is_last= 0;
+ is_to= 0;
+ prev_value= 0;
+ is_negative_index= 0;
if (p->last_step - p->steps >= JSON_DEPTH_LIMIT)
return p->s.error= JE_DEPTH;
p->types_used|= p->last_step->type= JSON_PATH_ARRAY | double_wildcard;
@@ -1203,6 +1239,31 @@ int json_path_setup(json_path_t *p,
case PS_DWD:
double_wildcard= JSON_PATH_DOUBLE_WILD;
continue;
+ case PS_NEG:
+ p->types_used|= JSON_PATH_NEGATIVE_INDEX;
+ is_negative_index= 1;
+ continue;
+ case PS_LAST:
+ if ((p->s.error= skip_string_verbatim(&p->s, "ast")))
+ return 1;
+ p->types_used|= JSON_PATH_NEGATIVE_INDEX;
+ is_last= 1;
+ if (is_to)
+ p->last_step->n_item_end= -1;
+ else
+ p->last_step->n_item= -1;
+ continue;
+ case PS_T:
+ if ((p->s.error= skip_string_verbatim(&p->s, "o")))
+ return 1;
+ is_to= 1;
+ is_negative_index= 0;
+ is_last= 0;
+ prev_value= 0;
+ p->last_step->n_item_end= 0;
+ p->last_step->type|= JSON_PATH_ARRAY_RANGE;
+ p->types_used|= JSON_PATH_ARRAY_RANGE;
+ continue;
};
} while (state != PS_OK);
@@ -1242,6 +1303,15 @@ int json_skip_level_and_count(json_engine_t *j, int *n_items_skipped)
}
+int json_skip_array_and_count(json_engine_t *je, int *n_items)
+{
+ json_engine_t j= *je;
+ *n_items= 0;
+
+ return json_skip_level_and_count(&j, n_items);
+}
+
+
int json_skip_key(json_engine_t *j)
{
if (json_read_value(j))
@@ -1254,7 +1324,7 @@ int json_skip_key(json_engine_t *j)
}
-#define SKIPPED_STEP_MARK ((uint) ~0)
+#define SKIPPED_STEP_MARK ((int) ~0)
/*
Current step of the patch matches the JSON construction.
@@ -1262,7 +1332,7 @@ int json_skip_key(json_engine_t *j)
step of the path.
*/
static int handle_match(json_engine_t *je, json_path_t *p,
- json_path_step_t **p_cur_step, uint *array_counters)
+ json_path_step_t **p_cur_step, int *array_counters)
{
json_path_step_t *next_step= *p_cur_step + 1;
@@ -1299,13 +1369,29 @@ static int handle_match(json_engine_t *je, json_path_t *p,
} while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0);
}
-
- array_counters[next_step - p->steps]= 0;
-
if ((int) je->value_type !=
(int) (next_step->type & JSON_PATH_KEY_OR_ARRAY))
return json_skip_level(je);
+ array_counters[next_step - p->steps]= 0;
+ if (next_step->type & JSON_PATH_ARRAY)
+ {
+ int array_size;
+ if (next_step->n_item >= 0)
+ array_size= 0;
+ else
+ {
+ json_engine_t j2= *je;
+ if (json_skip_array_and_count(&j2, &array_size))
+ {
+ *je= j2;
+ return 1;
+ }
+ array_size= -array_size;
+ }
+ array_counters[next_step - p->steps]= array_size;
+ }
+
*p_cur_step= next_step;
return 0;
}
@@ -1330,9 +1416,10 @@ int json_key_matches(json_engine_t *je, json_string_t *k)
int json_find_path(json_engine_t *je,
json_path_t *p, json_path_step_t **p_cur_step,
- uint *array_counters)
+ int *array_counters)
{
json_string_t key_name;
+ int res= 0;
json_string_set_cs(&key_name, p->s.cs);
@@ -1359,8 +1446,15 @@ int json_find_path(json_engine_t *je,
break;
case JST_VALUE:
DBUG_ASSERT(cur_step->type & JSON_PATH_ARRAY);
- if (cur_step->type & JSON_PATH_WILD ||
- cur_step->n_item == array_counters[cur_step - p->steps]++)
+ if (cur_step->type & JSON_PATH_ARRAY_RANGE)
+ {
+ res= (cur_step->n_item <= array_counters[cur_step - p->steps] &&
+ cur_step->n_item_end >= array_counters[cur_step - p->steps]);
+ array_counters[cur_step - p->steps]++;
+ }
+ else
+ res= cur_step->n_item == array_counters[cur_step - p->steps]++;
+ if ((cur_step->type & JSON_PATH_WILD) || res)
{
/* Array item matches. */
if (cur_step == p->last_step ||
diff --git a/unittest/json_lib/json_lib-t.c b/unittest/json_lib/json_lib-t.c
index 378ebe201f5..c5a6df54e1d 100644
--- a/unittest/json_lib/json_lib-t.c
+++ b/unittest/json_lib/json_lib-t.c
@@ -140,7 +140,7 @@ test_search()
json_path_t p;
json_path_step_t *cur_step;
int n_matches, scal_values;
- uint array_counters[JSON_DEPTH_LIMIT];
+ int array_counters[JSON_DEPTH_LIMIT];
if (json_scan_start(&je, ci, s_e(fj0)) ||
json_path_setup(&p, ci, s_e(fp0)))