summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-08-13 23:49:10 +0400
committerAlexander Barkov <bar@mariadb.com>2019-08-13 23:49:10 +0400
commitc1599821a55ac4f59c5c799480a07913e1c26daa (patch)
tree0c064252ad3959fcd53b0f06a40b98d691fe070e
parent624dd71b9419555eca8baadc695e3376de72286f (diff)
parentc4fd167d5a740f67ee5287a9b05b5383403b9ed0 (diff)
downloadmariadb-git-c1599821a55ac4f59c5c799480a07913e1c26daa.tar.gz
Merge remote-tracking branch 'origin/10.4' into 10.5
-rw-r--r--extra/wolfssl/CMakeLists.txt4
m---------extra/wolfssl/wolfssl0
m---------libmariadb0
-rw-r--r--mysql-test/README6
-rw-r--r--mysql-test/include/switch_to_mysql_user.inc2
-rw-r--r--mysql-test/main/connect_debug.result5
-rw-r--r--mysql-test/main/connect_debug.test11
-rw-r--r--mysql-test/main/create.result4
-rw-r--r--mysql-test/main/create.test7
-rw-r--r--mysql-test/main/ctype_collate.result2
-rw-r--r--mysql-test/main/ctype_latin2_ch.result2
-rw-r--r--mysql-test/main/derived.result11
-rw-r--r--mysql-test/main/derived.test4
-rw-r--r--mysql-test/main/derived_view.result59
-rw-r--r--mysql-test/main/derived_view.test34
-rw-r--r--mysql-test/main/func_group.result2
-rw-r--r--mysql-test/main/func_hybrid_type.result15
-rw-r--r--mysql-test/main/func_hybrid_type.test10
-rw-r--r--mysql-test/main/func_str.result84
-rw-r--r--mysql-test/main/func_str.test60
-rw-r--r--mysql-test/main/gis.result4
-rw-r--r--mysql-test/main/group_min_max.result2
-rw-r--r--mysql-test/main/having.result9
-rw-r--r--mysql-test/main/having.test13
-rw-r--r--mysql-test/main/information_schema_parameters.result4
-rw-r--r--mysql-test/main/information_schema_parameters.test2
-rw-r--r--mysql-test/main/join.result1384
-rw-r--r--mysql-test/main/join.test404
-rw-r--r--mysql-test/main/join_cache.result2
-rw-r--r--mysql-test/main/join_outer_innodb.result2
-rw-r--r--mysql-test/main/join_outer_innodb.test2
-rw-r--r--mysql-test/main/opt_trace.result488
-rw-r--r--mysql-test/main/opt_trace.test28
-rw-r--r--mysql-test/main/opt_trace_index_merge.result4
-rw-r--r--mysql-test/main/opt_trace_index_merge_innodb.result4
-rw-r--r--mysql-test/main/opt_trace_security.result8
-rw-r--r--mysql-test/main/plugin.result10
-rw-r--r--mysql-test/main/plugin.test11
-rw-r--r--mysql-test/main/plugin_not_embedded.result4
-rw-r--r--mysql-test/main/plugin_not_embedded.test9
-rw-r--r--mysql-test/main/ps.result63
-rw-r--r--mysql-test/main/ps.test77
-rw-r--r--mysql-test/main/ps_innodb.result64
-rw-r--r--mysql-test/main/ps_innodb.test80
-rw-r--r--mysql-test/main/selectivity.result6
-rw-r--r--mysql-test/main/selectivity_innodb.result6
-rw-r--r--mysql-test/main/subselect.result35
-rw-r--r--mysql-test/main/subselect.test24
-rw-r--r--mysql-test/main/subselect4.result5
-rw-r--r--mysql-test/main/subselect_cache.result2
-rw-r--r--mysql-test/main/subselect_exists2in.result8
-rw-r--r--mysql-test/main/subselect_innodb.result2
-rw-r--r--mysql-test/main/subselect_mat.result2
-rw-r--r--mysql-test/main/subselect_no_exists_to_in.result41
-rw-r--r--mysql-test/main/subselect_no_mat.result35
-rw-r--r--mysql-test/main/subselect_no_opts.result35
-rw-r--r--mysql-test/main/subselect_no_scache.result35
-rw-r--r--mysql-test/main/subselect_no_semijoin.result35
-rw-r--r--mysql-test/main/subselect_sj_mat.result2
-rw-r--r--mysql-test/main/system_mysql_db_fix40123.result16
-rw-r--r--mysql-test/main/system_mysql_db_fix50030.result16
-rw-r--r--mysql-test/main/system_mysql_db_fix50117.result24
-rw-r--r--mysql-test/main/system_mysql_db_fix50117.test24
-rw-r--r--mysql-test/main/type_date.result15
-rw-r--r--mysql-test/main/type_date.test8
-rw-r--r--mysql-test/main/type_int.result13
-rw-r--r--mysql-test/main/type_int.test11
-rw-r--r--mysql-test/main/type_temporal_innodb.result13
-rw-r--r--mysql-test/main/type_temporal_innodb.test15
-rw-r--r--mysql-test/main/view.result15
-rw-r--r--mysql-test/main/view.test20
-rw-r--r--mysql-test/main/view_alias.result10
-rw-r--r--mysql-test/main/warnings.result1
-rw-r--r--mysql-test/main/win_percentile.result295
-rw-r--r--mysql-test/main/win_percentile.test80
-rw-r--r--mysql-test/suite/binlog/include/drop_temp_table.test70
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result41
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result41
-rw-r--r--mysql-test/suite/binlog_encryption/multisource.result2
-rw-r--r--mysql-test/suite/compat/oracle/r/column_compression.result6
-rw-r--r--mysql-test/suite/compat/oracle/r/sp.result2
-rw-r--r--mysql-test/suite/compat/oracle/r/type_blob.result18
-rw-r--r--mysql-test/suite/compat/oracle/t/type_blob.test13
-rw-r--r--mysql-test/suite/galera/r/GAL-382.result4
-rw-r--r--mysql-test/suite/galera/t/MW-336.test8
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result129
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online-fk.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-virtual-columns.result8
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug51378.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug57252.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug60229.result6
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test60
-rw-r--r--mysql-test/suite/innodb_gis/r/1.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/gis.result4
-rw-r--r--mysql-test/suite/innodb_zip/r/page_size.result4
-rw-r--r--mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result4
-rw-r--r--mysql-test/suite/multi_source/disabled.def1
-rw-r--r--mysql-test/suite/multi_source/multisource.result2
-rw-r--r--mysql-test/suite/parts/r/alter_data_directory_innodb.result4
-rw-r--r--mysql-test/suite/plugins/disabled.def1
-rw-r--r--mysql-test/suite/rpl/r/rpl_blackhole.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result2
-rw-r--r--mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test7
-rw-r--r--mysql-test/suite/versioning/r/online.result4
-rw-r--r--mysql-test/suite/versioning/r/truncate.result23
-rw-r--r--mysql-test/suite/versioning/r/trx_id.result4
-rw-r--r--mysql-test/suite/versioning/t/truncate.test24
-rw-r--r--mysql-test/unstable-tests112
-rw-r--r--mysys/thr_mutex.c4
-rw-r--r--mysys_ssl/my_crypt.cc16
-rw-r--r--plugin/auth_pam/auth_pam.c2
-rw-r--r--plugin/auth_pam/auth_pam_tool.c2
-rw-r--r--plugin/server_audit/server_audit.c6
-rw-r--r--plugin/server_audit/test_audit_v4.c4
-rw-r--r--plugin/win_auth_client/common.cc2
-rw-r--r--scripts/mysql_install_db.sh9
-rw-r--r--scripts/mysql_system_tables.sql14
-rw-r--r--sql-common/client_plugin.c8
-rw-r--r--sql-common/my_time.c6
-rw-r--r--sql/field.cc4
-rw-r--r--sql/field.h23
-rw-r--r--sql/item.cc15
-rw-r--r--sql/item.h4
-rw-r--r--sql/item_cmpfunc.h4
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/item_strfunc.cc100
-rw-r--r--sql/item_subselect.cc29
-rw-r--r--sql/item_sum.cc140
-rw-r--r--sql/item_sum.h53
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/item_windowfunc.cc65
-rw-r--r--sql/item_windowfunc.h25
-rw-r--r--sql/item_xmlfunc.cc4
-rw-r--r--sql/item_xmlfunc.h3
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/rpl_gtid.cc2
-rw-r--r--sql/session_tracker.cc16
-rw-r--r--sql/sql_acl.cc3
-rw-r--r--sql/sql_class.cc1
-rw-r--r--sql/sql_delete.cc20
-rw-r--r--sql/sql_insert.cc6
-rw-r--r--sql/sql_lex.cc23
-rw-r--r--sql/sql_lex.h36
-rw-r--r--sql/sql_parse.cc236
-rw-r--r--sql/sql_plugin.cc7
-rw-r--r--sql/sql_select.cc53
-rw-r--r--sql/sql_show.cc26
-rw-r--r--sql/sql_table.cc16
-rw-r--r--sql/sql_type.cc73
-rw-r--r--sql/sql_type.h25
-rw-r--r--sql/sql_yacc.yy67
-rw-r--r--sql/sql_yacc_ora.yy69
-rw-r--r--sql/table.cc7
-rw-r--r--sql/table.h24
-rw-r--r--storage/connect/ha_connect.cc2
-rw-r--r--storage/connect/mysql-test/connect/disabled.def24
-rw-r--r--storage/innobase/btr/btr0cur.cc2
-rw-r--r--storage/innobase/include/btr0cur.h2
-rw-r--r--storage/innobase/include/row0upd.h26
-rw-r--r--storage/innobase/log/log0crypt.cc6
-rw-r--r--storage/innobase/row/row0log.cc20
-rw-r--r--storage/innobase/row/row0merge.cc12
-rw-r--r--storage/innobase/row/row0upd.cc19
-rw-r--r--storage/innobase/trx/trx0rseg.cc12
-rw-r--r--storage/innobase/trx/trx0undo.cc15
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/add_unique_index_inplace.result8
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_blob_indexes.result10
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/type_text_indexes.result16
-rw-r--r--storage/spider/spd_db_conn.cc4
-rw-r--r--storage/spider/spd_include.h4
-rw-r--r--storage/spider/spd_malloc.h5
-rw-r--r--storage/spider/spd_table.cc104
-rw-r--r--storage/tokudb/PerconaFT/ft/comparator.h14
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-status.cc14
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-status.h14
-rw-r--r--storage/tokudb/PerconaFT/locktree/keyrange.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/keyrange.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/locktree.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/locktree.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/manager.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/range_buffer.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/range_buffer.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/treenode.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/treenode.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/txnid_set.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/txnid_set.h1
-rw-r--r--storage/tokudb/PerconaFT/locktree/wfg.cc1
-rw-r--r--storage/tokudb/PerconaFT/locktree/wfg.h1
-rw-r--r--storage/tokudb/PerconaFT/portability/memory.cc31
-rw-r--r--storage/tokudb/PerconaFT/portability/memory.h14
-rw-r--r--storage/tokudb/PerconaFT/portability/portability.cc2
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_atomic.h14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_instrumentation.h46
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_portability.h14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_pthread.cc14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_pthread.h14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_race_tools.h14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_time.cc14
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_time.h14
-rw-r--r--storage/tokudb/PerconaFT/util/dbt.h14
-rw-r--r--storage/tokudb/PerconaFT/util/growable_array.h1
-rw-r--r--storage/tokudb/PerconaFT/util/memarena.cc14
-rw-r--r--storage/tokudb/PerconaFT/util/memarena.h14
-rw-r--r--storage/tokudb/PerconaFT/util/omt.cc1
-rw-r--r--storage/tokudb/PerconaFT/util/omt.h1
-rw-r--r--storage/tokudb/PerconaFT/util/partitioned_counter.cc14
-rw-r--r--storage/tokudb/PerconaFT/util/partitioned_counter.h14
-rw-r--r--storage/tokudb/PerconaFT/util/status.h14
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_Makefile10
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_bin.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_char.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_int.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py2
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/fast_update_Makefile4
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_sync_tokudb-master.opt1
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_tokudb-master.opt1
-rw-r--r--storage/tokudb/mysql-test/tokudb_parts/t/partition_special_tokudb-master.opt1
-rw-r--r--support-files/mysql.server.sh2
-rw-r--r--win/packaging/heidisql.cmake3
-rw-r--r--win/packaging/heidisql.wxi.in20
234 files changed, 5541 insertions, 893 deletions
diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt
index 2cb3f1dd3d1..7eefa840bfa 100644
--- a/extra/wolfssl/CMakeLists.txt
+++ b/extra/wolfssl/CMakeLists.txt
@@ -40,10 +40,6 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/wolfssl)
IF(MSVC)
# size_t to long truncation warning
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd4267 -wd4334")
- IF(CMAKE_C_COMPILER_ID MATCHES Clang)
- # Workaround a bug with clang-cl, see https://github.com/wolfSSL/wolfssl/pull/2090
- ADD_DEFINITIONS(-DMP_16BIT)
- ENDIF()
ENDIF()
ADD_CONVENIENCE_LIBRARY(wolfssl ${WOLFSSL_SOURCES})
diff --git a/extra/wolfssl/wolfssl b/extra/wolfssl/wolfssl
-Subproject 21f2beca9f320199fcea4a96df3e19967804144
+Subproject 50fbdb961fd8c2d8123064e567ae8ec44167732
diff --git a/libmariadb b/libmariadb
-Subproject 5fa9c4615e71b696b84b4c77aefa197466526a1
+Subproject ed3a91c139175746c5d6903d67ca902d91228f6
diff --git a/mysql-test/README b/mysql-test/README
index d925964fed5..f1c38f11716 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -51,7 +51,7 @@ options with which the server is started, restart the server during
execution, etc.)
You can create your own test cases. To create a test case, create a new
-file in the t subdirectory using a text editor. The file should have a .test
+file in the main subdirectory using a text editor. The file should have a .test
extension. For example:
# xemacs t/test_case_name.test
@@ -60,7 +60,7 @@ In the file, put a set of SQL statements that create some tables,
load test data, and run some queries to manipulate it.
Your test should begin by dropping the tables you are going to create and
-end by dropping them again. This ensures that you can run the test over
+end by dropping them again. This ensures that you can run the test over
and over again.
If you are using mysqltest commands in your test case, you should create
@@ -81,7 +81,7 @@ comments, you can create the result file in one of the following ways:
# mysqltest --record --database test --result-file=r/test_case_name.result < t/test_case_name.test
-When this is done, take a look at r/test_case_name.result .
+When this is done, take a look at r/test_case_name.result.
If the result is incorrect, you have found a bug. In this case, you should
edit the test result to the correct results so that we can verify that
the bug is corrected in future releases.
diff --git a/mysql-test/include/switch_to_mysql_user.inc b/mysql-test/include/switch_to_mysql_user.inc
index f5801db6114..4d67f30a10b 100644
--- a/mysql-test/include/switch_to_mysql_user.inc
+++ b/mysql-test/include/switch_to_mysql_user.inc
@@ -48,7 +48,7 @@ CREATE TABLE mysql.user (
is_role enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
default_role char(80) binary DEFAULT '' NOT NULL,
max_statement_time decimal(12,6) DEFAULT 0 NOT NULL,
- PRIMARY KEY Host (Host,User)
+ PRIMARY KEY (Host,User)
) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
insert mysql.user select * from mysql.user_bak;
rename table mysql.global_priv to mysql.global_priv_bak;
diff --git a/mysql-test/main/connect_debug.result b/mysql-test/main/connect_debug.result
index 0452b238db9..6c066c16731 100644
--- a/mysql-test/main/connect_debug.result
+++ b/mysql-test/main/connect_debug.result
@@ -3,3 +3,8 @@ set global debug_dbug='+d,auth_disconnect';
create user 'bad' identified by 'worse';
set global debug_dbug=@old_dbug;
drop user bad;
+set global debug_dbug='+d,auth_invalid_plugin';
+create user 'bad' identified by 'worse';
+ERROR 1045 (28000): Plugin foo/bar could not be loaded: invalid plugin name
+set global debug_dbug=@old_dbug;
+drop user bad;
diff --git a/mysql-test/main/connect_debug.test b/mysql-test/main/connect_debug.test
index 299b605b2cd..7a2f2872b79 100644
--- a/mysql-test/main/connect_debug.test
+++ b/mysql-test/main/connect_debug.test
@@ -1,3 +1,4 @@
+source include/not_embedded.inc;
source include/have_debug.inc;
set @old_dbug=@@global.debug_dbug;
@@ -10,3 +11,13 @@ create user 'bad' identified by 'worse';
--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse
set global debug_dbug=@old_dbug;
drop user bad;
+
+#
+# malicious server, invalid plugin name
+#
+set global debug_dbug='+d,auth_invalid_plugin';
+create user 'bad' identified by 'worse';
+--error 1
+--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse 2>&1
+set global debug_dbug=@old_dbug;
+drop user bad;
diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result
index ea9014498e0..d8e9272e930 100644
--- a/mysql-test/main/create.result
+++ b/mysql-test/main/create.result
@@ -2008,3 +2008,7 @@ create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
Warnings:
Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release
drop table t1;
+CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2));
+Warnings:
+Warning 1280 Name 'foo' ignored for PRIMARY key.
+DROP TABLE t1;
diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test
index 4bf6ce99504..8f7b06f5281 100644
--- a/mysql-test/main/create.test
+++ b/mysql-test/main/create.test
@@ -1864,3 +1864,10 @@ create table t1;
#
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
drop table t1;
+
+#
+# MDEV-17544 No warning when trying to name a primary key constraint.
+#
+CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2));
+DROP TABLE t1;
+
diff --git a/mysql-test/main/ctype_collate.result b/mysql-test/main/ctype_collate.result
index 5e8c5adac8f..93bf07908b5 100644
--- a/mysql-test/main/ctype_collate.result
+++ b/mysql-test/main/ctype_collate.result
@@ -732,6 +732,8 @@ CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
PRIMARY KEY b (b(32))
);
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
explain
select hex(b) from t1 force index (PRIMARY) where b<'zzz';
diff --git a/mysql-test/main/ctype_latin2_ch.result b/mysql-test/main/ctype_latin2_ch.result
index a396bc77fb6..962c29f7ab4 100644
--- a/mysql-test/main/ctype_latin2_ch.result
+++ b/mysql-test/main/ctype_latin2_ch.result
@@ -10,6 +10,8 @@ tt char(255) not null
insert into t1 values (1,'Aa');
insert into t1 values (2,'Aas');
alter table t1 add primary key aaa(tt);
+Warnings:
+Warning 1280 Name 'aaa' ignored for PRIMARY key.
select * from t1 where tt like 'Aa%';
id tt
1 Aa
diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result
index 792a859d849..a875f8ddf9f 100644
--- a/mysql-test/main/derived.result
+++ b/mysql-test/main/derived.result
@@ -606,6 +606,17 @@ select x.id, message from (select id from t1) x left join
(select id, 1 as message from t2) y on x.id=y.id
where coalesce(message,0) <> 0;
id message
+explain extended
+select x.id, message from (select id from t1) x left join
+(select id, 1 as message from t2) y on x.id=y.id
+where message <> 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 /* select#1 */ select `x`.`id` AS `id`,`y`.`message` AS `message` from (/* select#2 */ select `test`.`t1`.`id` AS `id` from `test`.`t1`) `x` join (/* select#3 */ select `test`.`t2`.`id` AS `id`,1 AS `message` from `test`.`t2`) `y` where `y`.`id` = `x`.`id` and `y`.`message` <> 0
drop table t1,t2;
#
# MDEV-7827: Assertion `!table || (!table->read_set ||
diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test
index 8f3f265178c..beb361fd5b7 100644
--- a/mysql-test/main/derived.test
+++ b/mysql-test/main/derived.test
@@ -533,6 +533,10 @@ insert into t2 values(4),(5),(6);
select x.id, message from (select id from t1) x left join
(select id, 1 as message from t2) y on x.id=y.id
where coalesce(message,0) <> 0;
+explain extended
+select x.id, message from (select id from t1) x left join
+(select id, 1 as message from t2) y on x.id=y.id
+where message <> 0;
drop table t1,t2;
--echo #
diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result
index 67b9cb025b1..c4ba604d5c4 100644
--- a/mysql-test/main/derived_view.result
+++ b/mysql-test/main/derived_view.result
@@ -1624,7 +1624,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 't.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(1,<expr_cache><`test`.`t1`.`a`>(exists(/* select#3 */ select 28 from `test`.`t3` where 'j' < `test`.`t1`.`a`)))
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(1,<expr_cache><`test`.`t1`.`a`>(exists(/* select#3 */ select 28 from `test`.`t3` where 'j' < `test`.`t1`.`a` limit 1)))
SELECT * FROM (SELECT * FROM t1) AS t
WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a)
WHERE t2.b < t.a);
@@ -3422,3 +3422,60 @@ id select_type table type possible_keys key key_len ref rows Extra
7 DERIVED p9 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
7 DERIVED p10 ALL NULL NULL NULL NULL 550 Using where; Using join buffer (incremental, BNL join)
DROP TABLE t1, t2;
+#
+# MDEV-19778: equality condition for mergeable view returning constants
+# in its columns and used as inner table of outer join
+#
+create table t1 (pk int, a int);
+insert into t1 values (1,7), (2,3), (3,2), (4,3);
+create table t2 (b int);
+insert into t2 values (5), (1), (NULL), (3);
+create table t3 (c int);
+insert into t3 values (1), (8);
+create view v1 as
+select 3 as d, t2.b from t2;
+select * from t1 left join v1 on t1.pk <= 2 where t1.a=v1.d;
+pk a d b
+2 3 3 5
+2 3 3 1
+2 3 3 NULL
+2 3 3 3
+explain extended select * from t1 left join v1 on t1.pk <= 2 where t1.a=v1.d;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2
+select * from t1 left join (select 3 as d, t2.b from t2) dt on t1.pk <= 2
+where t1.a=dt.d;
+pk a d b
+2 3 3 5
+2 3 3 1
+2 3 3 NULL
+2 3 3 3
+explain extended select * from t1 left join (select 3 as d, t2.b from t2) dt on t1.pk <= 2
+where t1.a=dt.d;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2
+select * from t1 left join (v1,t3) on t1.pk <= 2 where t1.a=v1.d;
+pk a d b c
+2 3 3 5 1
+2 3 3 5 8
+2 3 3 1 1
+2 3 3 1 8
+2 3 3 NULL 1
+2 3 3 NULL 8
+2 3 3 3 1
+2 3 3 3 8
+explain extended select * from t1 left join (v1,t3) on t1.pk <= 2 where t1.a=v1.d;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,3 AS `d`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`c` AS `c` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t1`.`a` = 3 and `test`.`t1`.`pk` <= 2
+drop view v1;
+drop table t1,t2,t3;
diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test
index d303391204f..8adbcc8dfd4 100644
--- a/mysql-test/main/derived_view.test
+++ b/mysql-test/main/derived_view.test
@@ -2236,3 +2236,37 @@ JOIN
) gp_20 ON gp_20.id=t2.id ;
DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-19778: equality condition for mergeable view returning constants
+--echo # in its columns and used as inner table of outer join
+--echo #
+
+create table t1 (pk int, a int);
+insert into t1 values (1,7), (2,3), (3,2), (4,3);
+create table t2 (b int);
+insert into t2 values (5), (1), (NULL), (3);
+create table t3 (c int);
+insert into t3 values (1), (8);
+
+create view v1 as
+select 3 as d, t2.b from t2;
+
+let $q=
+select * from t1 left join v1 on t1.pk <= 2 where t1.a=v1.d;
+eval $q;
+eval explain extended $q;
+
+let $q=
+select * from t1 left join (select 3 as d, t2.b from t2) dt on t1.pk <= 2
+ where t1.a=dt.d;
+eval $q;
+eval explain extended $q;
+
+let $q=
+select * from t1 left join (v1,t3) on t1.pk <= 2 where t1.a=v1.d;
+eval $q;
+eval explain extended $q;
+
+drop view v1;
+drop table t1,t2,t3;
diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result
index c6daf2335a9..938acbae0e2 100644
--- a/mysql-test/main/func_group.result
+++ b/mysql-test/main/func_group.result
@@ -1982,6 +1982,7 @@ NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'j'
Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
EXPLAIN
SELECT MIN(t2.pk)
@@ -1996,6 +1997,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'j'
Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
#
# 2) Test that subquery materialization is setup for query with
diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result
index 95349ffecb9..c7e1ceb5077 100644
--- a/mysql-test/main/func_hybrid_type.result
+++ b/mysql-test/main/func_hybrid_type.result
@@ -3915,6 +3915,21 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
SET sql_mode=DEFAULT;
#
+# MDEV-18456 Assertion `item->maybe_null' failed in Type_handler_temporal_result::make_sort_key
+#
+CREATE TABLE t1 (t TIME NOT NULL);
+INSERT INTO t1 VALUES ('00:20:11'),('14:52:05');
+SELECT GREATEST('9999', t) FROM t1 ORDER BY 1;
+GREATEST('9999', t)
+NULL
+NULL
+Warnings:
+Warning 1292 Incorrect time value: '9999'
+Warning 1292 Incorrect time value: '9999'
+Warning 1292 Incorrect time value: '9999'
+Warning 1292 Incorrect time value: '9999'
+DROP TABLE t1;
+#
# End of 10.3 tests
#
#
diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test
index 93720bcde2e..df19e3c97ff 100644
--- a/mysql-test/main/func_hybrid_type.test
+++ b/mysql-test/main/func_hybrid_type.test
@@ -711,6 +711,16 @@ DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo #
+--echo # MDEV-18456 Assertion `item->maybe_null' failed in Type_handler_temporal_result::make_sort_key
+--echo #
+
+CREATE TABLE t1 (t TIME NOT NULL);
+INSERT INTO t1 VALUES ('00:20:11'),('14:52:05');
+SELECT GREATEST('9999', t) FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index f916aae7e9d..c637274e3cc 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -5068,6 +5068,90 @@ NULL
DROP TABLE t1;
#
+# MDEV-20292 REPEAT(x,-1) returns a wrong data type
+#
+CREATE OR REPLACE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE OR REPLACE TABLE t2 AS SELECT
+REPEAT(i,NULL) AS cn,
+REPEAT(i,0) AS c0,
+REPEAT(i,-1) AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cn` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c0` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c1` char(0) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+#
+# MDEV-20303 SPACE(-1) returns a wrong data type
+#
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+SPACE(NULL) AS cn,
+SPACE(0) AS c0,
+SPACE(-1) AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cn` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c0` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c1` char(0) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+LPAD(i,NULL,'a') AS cn,
+LPAD(i,0,'a') AS c0,
+LPAD(i,-1,'a') AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cn` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c0` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c1` char(0) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+RPAD(i,NULL,'a') AS cn,
+RPAD(i,0,'a') AS c0,
+RPAD(i,-1,'a') AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cn` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c0` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c1` char(0) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, t2;
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+LEFT(i,NULL) AS cn,
+LEFT(i,0) AS c0,
+LEFT(i,18446744073709551615) AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `cn` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c0` char(0) CHARACTER SET utf8 DEFAULT NULL,
+ `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT c1 FROM t2;
+c1
+42
+DROP TABLE t1, t2;
+#
# End of 10.3 tests
#
#
diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test
index 1abc36de910..bc4ab2396f6 100644
--- a/mysql-test/main/func_str.test
+++ b/mysql-test/main/func_str.test
@@ -2028,6 +2028,66 @@ SELECT LPAD( c, 0, '?' ) FROM t1;
SELECT RPAD( c, 0, '?' ) FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-20292 REPEAT(x,-1) returns a wrong data type
+--echo #
+
+CREATE OR REPLACE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE OR REPLACE TABLE t2 AS SELECT
+ REPEAT(i,NULL) AS cn,
+ REPEAT(i,0) AS c0,
+ REPEAT(i,-1) AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+
+--echo #
+--echo # MDEV-20303 SPACE(-1) returns a wrong data type
+--echo #
+
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+ SPACE(NULL) AS cn,
+ SPACE(0) AS c0,
+ SPACE(-1) AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+ LPAD(i,NULL,'a') AS cn,
+ LPAD(i,0,'a') AS c0,
+ LPAD(i,-1,'a') AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+ RPAD(i,NULL,'a') AS cn,
+ RPAD(i,0,'a') AS c0,
+ RPAD(i,-1,'a') AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (i BIGINT);
+INSERT INTO t1 VALUES (42);
+CREATE TABLE t2 AS SELECT
+ LEFT(i,NULL) AS cn,
+ LEFT(i,0) AS c0,
+ LEFT(i,18446744073709551615) AS c1
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT c1 FROM t2;
+DROP TABLE t1, t2;
+
--echo #
--echo # End of 10.3 tests
diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result
index c01eda308ba..5b198bb870d 100644
--- a/mysql-test/main/gis.result
+++ b/mysql-test/main/gis.result
@@ -816,11 +816,15 @@ POINT(1 1)
drop function fn3;
create table t1(pt POINT);
alter table t1 add primary key pti(pt);
+Warnings:
+Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1(pt GEOMETRY);
alter table t1 add primary key pti(pt);
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20));
+Warnings:
+Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result
index 59e3fc65501..a28cc418207 100644
--- a/mysql-test/main/group_min_max.result
+++ b/mysql-test/main/group_min_max.result
@@ -2449,7 +2449,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
-2 SUBQUERY t1 range a a 5 NULL 2 Using where; Using index for group-by
+2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result
index 837940a55ef..703f013c2da 100644
--- a/mysql-test/main/having.result
+++ b/mysql-test/main/having.result
@@ -864,4 +864,13 @@ x
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'x'
DROP TABLE t1,t2;
+#
+# MDEV-20200: AddressSanitizer: use-after-poison in
+# Item_direct_view_ref::get_null_ref_table
+#
+CREATE TABLE t (f VARCHAR(512));
+INSERT INTO t VALUES ('a'),('b');
+SELECT * FROM t HAVING f = 'foo';
+f
+DROP TABLE t;
# End of 10.4 tests
diff --git a/mysql-test/main/having.test b/mysql-test/main/having.test
index ed86b41a2c3..072f1a088dc 100644
--- a/mysql-test/main/having.test
+++ b/mysql-test/main/having.test
@@ -909,4 +909,17 @@ HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a';
DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-20200: AddressSanitizer: use-after-poison in
+--echo # Item_direct_view_ref::get_null_ref_table
+--echo #
+
+CREATE TABLE t (f VARCHAR(512));
+INSERT INTO t VALUES ('a'),('b');
+SELECT * FROM t HAVING f = 'foo';
+
+# Cleanup
+DROP TABLE t;
+
--echo # End of 10.4 tests
diff --git a/mysql-test/main/information_schema_parameters.result b/mysql-test/main/information_schema_parameters.result
index a215c86c388..02f97159f28 100644
--- a/mysql-test/main/information_schema_parameters.result
+++ b/mysql-test/main/information_schema_parameters.result
@@ -424,7 +424,7 @@ SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE P
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
-CREATE PROCEDURE testproc (OUT param1 INT)
+CREATE PROCEDURE testproc (IN param1 INT)
BEGIN
SELECT 2+2 as param1;
END;
@@ -432,7 +432,7 @@ END;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'testproc';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
-def i_s_parameters_test testproc 1 OUT param1 int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
+def i_s_parameters_test testproc 1 IN param1 int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# ========== parameters.5 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
diff --git a/mysql-test/main/information_schema_parameters.test b/mysql-test/main/information_schema_parameters.test
index bf25a6757f0..8ce6af478b6 100644
--- a/mysql-test/main/information_schema_parameters.test
+++ b/mysql-test/main/information_schema_parameters.test
@@ -92,7 +92,7 @@ CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
delimiter //;
-CREATE PROCEDURE testproc (OUT param1 INT)
+CREATE PROCEDURE testproc (IN param1 INT)
BEGIN
SELECT 2+2 as param1;
END;
diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result
index 1e880e1e442..edca2905380 100644
--- a/mysql-test/main/join.result
+++ b/mysql-test/main/join.result
@@ -1551,6 +1551,1390 @@ ERROR 23000: Column 'c' in field list is ambiguous
DROP PROCEDURE p1;
DROP TABLE t1,t2,t3,t4,t5;
#
+# MDEV-19421: Embedding inner joins
+#
+create table t1 (a int);
+insert into t1 values (7), (5), (3);
+create table s1 (b int);
+insert into s1 values (7), (5), (3);
+create table t2 (a int);
+insert into t2 values (5), (1), (7);
+create table s2 (b int);
+insert into s2 values (5), (1), (7);
+create table t3 (a int);
+insert into t3 values (2), (7), (3);
+create table t4 (a int);
+insert into t4 values (4), (7), (9), (5);
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t2.a=t3.a on t1.a=t2.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t3`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t2.a=t3.a on t1.a=t2.a;
+t1_a t2_a t3_a
+7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t2`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a;
+t1_a t2_a t3_a
+7 7 7
+5 5 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t2.a=t3.a on t1.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t3` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t2.a=t3.a on t1.a=t3.a;
+t1_a t2_a t3_a
+7 7 7
+3 NULL 3
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 using(a) using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t3`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 using(a) using(a);
+t1_a t2_a t3_a
+7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 using(a) using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where `test`.`t2`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 using(a) using(a);
+t1_a t2_a t3_a
+7 7 7
+5 5 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 using(a) using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t3` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) where `test`.`t3`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 using(a) using(a);
+t1_a t2_a t3_a
+7 7 7
+3 NULL 3
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t2.a=t3.a;
+t1_a t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t2.a=t3.a;
+t1_a t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+7 5 NULL
+5 5 NULL
+3 5 NULL
+7 1 NULL
+5 1 NULL
+3 1 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t2.a=t3.a;
+t1_a t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+NULL NULL 2
+NULL NULL 3
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t1.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t1.a=t3.a;
+t1_a t2_a t3_a
+7 5 7
+7 1 7
+7 7 7
+3 5 3
+3 1 3
+3 7 3
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t1.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t1`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t1.a=t3.a;
+t1_a t2_a t3_a
+7 5 7
+7 1 7
+7 7 7
+3 5 3
+3 1 3
+3 7 3
+5 5 NULL
+5 1 NULL
+5 7 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t1.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t1`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t1.a=t3.a;
+t1_a t2_a t3_a
+7 5 7
+3 5 3
+7 1 7
+3 1 3
+7 7 7
+3 7 3
+NULL NULL 2
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 join t3 on t2.a=t3.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 join t3 on t2.a=t3.a);
+t1_a t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 left join t3 on t2.a=t3.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 left join t3 on t2.a=t3.a);
+t1_a t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+7 5 NULL
+5 5 NULL
+3 5 NULL
+7 1 NULL
+5 1 NULL
+3 1 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 right join t3 on t2.a=t3.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t3` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 right join t3 on t2.a=t3.a);
+t1_a t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+7 NULL 2
+5 NULL 2
+3 NULL 2
+7 NULL 3
+5 NULL 3
+3 NULL 3
+explain extended select *
+from s1 join t2 join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select *
+from s1 join t2 join t3 using(a);
+a b
+7 7
+7 5
+7 3
+explain extended select *
+from s1 join t2 left join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1
+select *
+from s1 join t2 left join t3 using(a);
+a b
+7 7
+7 5
+7 3
+5 7
+5 5
+5 3
+1 7
+1 5
+1 3
+explain extended select *
+from s1 join t2 right join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select *
+from s1 join t2 right join t3 using(a);
+a b
+7 7
+7 5
+7 3
+2 NULL
+3 NULL
+explain extended select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`s1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 join t3 using(a);
+b t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+explain extended select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 left join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 left join t3 using(a);
+b t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+7 5 NULL
+5 5 NULL
+3 5 NULL
+7 1 NULL
+5 1 NULL
+3 1 NULL
+explain extended select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 right join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 right join t3 using(a);
+b t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+NULL NULL 2
+NULL NULL 3
+explain extended select s1.b, t2.a as t2_a, t3.a as t3_a
+from (s1 join t2) right join t3 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from (s1 join t2) right join t3 using(a);
+b t2_a t3_a
+7 7 7
+5 7 7
+3 7 7
+NULL NULL 2
+NULL NULL 3
+explain extended select *
+from s1 join t2 natural join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select *
+from s1 join t2 natural join t3;
+a b
+7 7
+7 5
+7 3
+explain extended select *
+from s1 join t2 natural left join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1
+select *
+from s1 join t2 natural left join t3;
+a b
+7 7
+7 5
+7 3
+5 7
+5 5
+5 3
+1 7
+1 5
+1 3
+explain extended select *
+from s1 join t2 natural right join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`s1`.`b` AS `b` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select *
+from s1 join t2 natural right join t3;
+a b
+7 7
+7 5
+7 3
+2 NULL
+3 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3;
+t1_a t2_a t3_a
+7 5 2
+5 5 2
+3 5 2
+7 1 2
+5 1 2
+3 1 2
+7 7 2
+5 7 2
+3 7 2
+7 5 7
+5 5 7
+3 5 7
+7 1 7
+5 1 7
+3 1 7
+7 7 7
+5 7 7
+3 7 7
+7 5 3
+5 5 3
+3 5 3
+7 1 3
+5 1 3
+3 1 3
+7 7 3
+5 7 3
+3 7 3
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3
+where t1.a=t2.a and t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`a` and `test`.`t3`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3
+where t1.a=t2.a and t2.a=t3.a;
+t1_a t2_a t3_a
+7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t4`.`a` = `test`.`t2`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(`test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t4`.`a` = `test`.`t2`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 NULL NULL
+5 5 NULL NULL
+3 5 NULL NULL
+7 1 NULL NULL
+5 1 NULL NULL
+3 1 NULL NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 left join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join (`test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t2`.`a`)) on(`test`.`t3`.`a` = `test`.`t2`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 left join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 NULL NULL
+5 5 NULL NULL
+3 5 NULL NULL
+7 1 NULL NULL
+5 1 NULL NULL
+3 1 NULL NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join (`test`.`t4` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t4`.`a` = `test`.`t2`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 NULL NULL
+5 5 NULL NULL
+3 5 NULL NULL
+7 1 NULL NULL
+5 1 NULL NULL
+3 1 NULL NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where `test`.`t4`.`a` = `test`.`t3`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 left join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 left join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL 2 NULL
+NULL NULL 3 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+7 5 7 7
+5 5 7 7
+3 5 7 7
+7 1 7 7
+5 1 7 7
+3 1 7 7
+7 7 7 7
+5 7 7 7
+3 7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 left join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 left join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+7 5 7 7
+5 5 7 7
+3 5 7 7
+7 1 7 7
+5 1 7 7
+3 1 7 7
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 2 NULL
+5 5 2 NULL
+3 5 2 NULL
+7 1 2 NULL
+5 1 2 NULL
+3 1 2 NULL
+7 7 2 NULL
+5 7 2 NULL
+3 7 2 NULL
+7 5 3 NULL
+5 5 3 NULL
+3 5 3 NULL
+7 1 3 NULL
+5 1 3 NULL
+3 1 3 NULL
+7 7 3 NULL
+5 7 3 NULL
+3 7 3 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 right join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t1` join `test`.`t2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 right join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+7 5 7 7
+5 5 7 7
+3 5 7 7
+7 1 7 7
+5 1 7 7
+3 1 7 7
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 join t4 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`s2` join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a`
+select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 join t4 using(a);
+s1_b s2_b t3_a t4_a
+7 5 7 7
+5 5 7 7
+3 5 7 7
+7 1 7 7
+5 1 7 7
+3 1 7 7
+7 7 7 7
+5 7 7 7
+3 7 7 7
+explain extended select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 left join t4 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`s2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1
+select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 left join t4 using(a);
+s1_b s2_b t3_a t4_a
+7 5 7 7
+5 5 7 7
+3 5 7 7
+7 1 7 7
+5 1 7 7
+3 1 7 7
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 2 NULL
+5 5 2 NULL
+3 5 2 NULL
+7 1 2 NULL
+5 1 2 NULL
+3 1 2 NULL
+7 7 2 NULL
+5 7 2 NULL
+3 7 2 NULL
+7 5 3 NULL
+5 5 3 NULL
+3 5 3 NULL
+7 1 3 NULL
+5 1 3 NULL
+3 1 3 NULL
+7 7 3 NULL
+5 7 3 NULL
+3 7 3 NULL
+explain extended select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 right join t4 using(a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`s1` join `test`.`s2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1
+select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 right join t4 using(a);
+s1_b s2_b t3_a t4_a
+7 5 7 7
+5 5 7 7
+3 5 7 7
+7 1 7 7
+5 1 7 7
+3 1 7 7
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 on t2.a=t3.a join t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 on t2.a=t3.a join t4;
+t1_a t2_a t3_a t4_a
+7 7 7 4
+5 7 7 4
+3 7 7 4
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 7 7 9
+5 7 7 9
+3 7 7 9
+7 7 7 5
+5 7 7 5
+3 7 7 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 on t2.a=t3.a join t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) join `test`.`t4` where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 on t2.a=t3.a join t4;
+t1_a t2_a t3_a t4_a
+7 7 7 4
+5 7 7 4
+3 7 7 4
+7 5 NULL 4
+5 5 NULL 4
+3 5 NULL 4
+7 1 NULL 4
+5 1 NULL 4
+3 1 NULL 4
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 NULL 7
+5 5 NULL 7
+3 5 NULL 7
+7 1 NULL 7
+5 1 NULL 7
+3 1 NULL 7
+7 7 7 9
+5 7 7 9
+3 7 7 9
+7 5 NULL 9
+5 5 NULL 9
+3 5 NULL 9
+7 1 NULL 9
+5 1 NULL 9
+3 1 NULL 9
+7 7 7 5
+5 7 7 5
+3 7 7 5
+7 5 NULL 5
+5 5 NULL 5
+3 5 NULL 5
+7 1 NULL 5
+5 1 NULL 5
+3 1 NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 on t2.a=t3.a join t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) join `test`.`t4` where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 on t2.a=t3.a join t4;
+t1_a t2_a t3_a t4_a
+7 7 7 4
+5 7 7 4
+3 7 7 4
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 7 7 9
+5 7 7 9
+3 7 7 9
+7 7 7 5
+5 7 7 5
+3 7 7 5
+NULL NULL 2 4
+NULL NULL 3 4
+NULL NULL 2 7
+NULL NULL 3 7
+NULL NULL 2 9
+NULL NULL 3 9
+NULL NULL 2 5
+NULL NULL 3 5
+explain extended select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 join t3 using(a) join t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t3`.`a` = `test`.`t2`.`a`
+select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 join t3 using(a) join t4;
+s1_b t2_a t3_a t4_a
+7 7 7 4
+5 7 7 4
+3 7 7 4
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 7 7 9
+5 7 7 9
+3 7 7 9
+7 7 7 5
+5 7 7 5
+3 7 7 5
+explain extended select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 left join t3 using(a) join t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t2` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t2`.`a`) join `test`.`t4` where 1
+select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 left join t3 using(a) join t4;
+s1_b t2_a t3_a t4_a
+7 7 7 4
+5 7 7 4
+3 7 7 4
+7 5 NULL 4
+5 5 NULL 4
+3 5 NULL 4
+7 1 NULL 4
+5 1 NULL 4
+3 1 NULL 4
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 5 NULL 7
+5 5 NULL 7
+3 5 NULL 7
+7 1 NULL 7
+5 1 NULL 7
+3 1 NULL 7
+7 7 7 9
+5 7 7 9
+3 7 7 9
+7 5 NULL 9
+5 5 NULL 9
+3 5 NULL 9
+7 1 NULL 9
+5 1 NULL 9
+3 1 NULL 9
+7 7 7 5
+5 7 7 5
+3 7 7 5
+7 5 NULL 5
+5 5 NULL 5
+3 5 NULL 5
+7 1 NULL 5
+5 1 NULL 5
+3 1 NULL 5
+explain extended select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 right join t3 using(a) join t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t3` left join (`test`.`s1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) join `test`.`t4` where 1
+select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 right join t3 using(a) join t4;
+s1_b t2_a t3_a t4_a
+7 7 7 4
+5 7 7 4
+3 7 7 4
+7 7 7 7
+5 7 7 7
+3 7 7 7
+7 7 7 9
+5 7 7 9
+3 7 7 9
+7 7 7 5
+5 7 7 5
+3 7 7 5
+NULL NULL 2 4
+NULL NULL 3 4
+NULL NULL 2 7
+NULL NULL 3 7
+NULL NULL 2 9
+NULL NULL 3 9
+NULL NULL 2 5
+NULL NULL 3 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` and `test`.`t2`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+5 5 7 7
+7 7 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` join `test`.`t2` join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where `test`.`t2`.`a` = `test`.`t1`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+5 5 7 7
+7 7 7 7
+5 5 2 NULL
+7 7 2 NULL
+5 5 3 NULL
+7 7 3 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t1` join `test`.`t2` join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a` and `test`.`t2`.`a` = `test`.`t1`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+5 5 7 7
+7 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+5 5 7 7
+7 7 7 7
+3 NULL 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+5 5 7 7
+7 7 7 7
+3 NULL 7 7
+5 5 2 NULL
+7 7 2 NULL
+3 NULL 2 NULL
+5 5 3 NULL
+7 7 3 NULL
+3 NULL 3 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t1`.`a`) join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+5 5 7 7
+7 7 7 7
+3 NULL 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a`
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 5 7 7
+NULL 1 7 7
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 5 7 7
+NULL 1 7 7
+7 7 2 NULL
+5 5 2 NULL
+NULL 1 2 NULL
+7 7 3 NULL
+5 5 3 NULL
+NULL 1 3 NULL
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3`) on(`test`.`t3`.`a` = `test`.`t4`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 5 7 7
+NULL 1 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 join t4 on t4.a=s1.b;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`s1`.`b`) join `test`.`t3` join `test`.`t4` where `test`.`t4`.`a` = `test`.`s1`.`b`
+select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 join t4 on t4.a=s1.b;
+s1_b t1_a t2_a t3_a t4_a
+7 7 7 2 7
+7 5 7 2 7
+7 3 7 2 7
+7 7 7 7 7
+7 5 7 7 7
+7 3 7 7 7
+7 7 7 3 7
+7 5 7 3 7
+7 3 7 3 7
+5 7 5 2 5
+5 5 5 2 5
+5 3 5 2 5
+5 7 5 7 5
+5 5 5 7 5
+5 3 5 7 5
+5 7 5 3 5
+5 5 5 3 5
+5 3 5 3 5
+explain extended select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 left join t4 on t4.a=s1.b;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`s1` join `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`s1`.`b`) join `test`.`t3` left join `test`.`t4` on(`test`.`t4`.`a` = `test`.`s1`.`b`) where 1
+select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 left join t4 on t4.a=s1.b;
+s1_b t1_a t2_a t3_a t4_a
+7 7 7 2 7
+7 5 7 2 7
+7 3 7 2 7
+7 7 7 7 7
+7 5 7 7 7
+7 3 7 7 7
+7 7 7 3 7
+7 5 7 3 7
+7 3 7 3 7
+5 7 5 2 5
+5 5 5 2 5
+5 3 5 2 5
+5 7 5 7 5
+5 5 5 7 5
+5 3 5 7 5
+5 7 5 3 5
+5 5 5 3 5
+5 3 5 3 5
+3 7 NULL 2 NULL
+3 5 NULL 2 NULL
+3 3 NULL 2 NULL
+3 7 NULL 7 NULL
+3 5 NULL 7 NULL
+3 3 NULL 7 NULL
+3 7 NULL 3 NULL
+3 5 NULL 3 NULL
+3 3 NULL 3 NULL
+explain extended select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 right join t4 on t4.a=s1.b;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join (`test`.`s1` join `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`a` = `test`.`t4`.`a`) join `test`.`t3`) on(`test`.`s1`.`b` = `test`.`t4`.`a`) where 1
+select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 right join t4 on t4.a=s1.b;
+s1_b t1_a t2_a t3_a t4_a
+5 7 5 2 5
+5 5 5 2 5
+5 3 5 2 5
+7 7 7 2 7
+7 5 7 2 7
+7 3 7 2 7
+5 7 5 7 5
+5 5 5 7 5
+5 3 5 7 5
+7 7 7 7 7
+7 5 7 7 7
+7 3 7 7 7
+5 7 5 3 5
+5 5 5 3 5
+5 3 5 3 5
+7 7 7 3 7
+7 5 7 3 7
+7 3 7 3 7
+NULL NULL NULL NULL 4
+NULL NULL NULL NULL 9
+explain extended select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t2` left join (`test`.`s1` join `test`.`s2` join `test`.`t1`) on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`s2`.`b` = `test`.`s1`.`b`) join `test`.`t3` where 1
+select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+s1_b s2_b t1_a t2_a t3_a
+5 5 7 7 2
+7 7 7 7 2
+5 5 5 5 2
+7 7 5 5 2
+5 5 7 7 7
+7 7 7 7 7
+5 5 5 5 7
+7 7 5 5 7
+5 5 7 7 3
+7 7 7 7 3
+5 5 5 5 3
+7 7 5 5 3
+NULL NULL NULL 1 2
+NULL NULL NULL 1 7
+NULL NULL NULL 1 3
+explain extended select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 left join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t2` left join (`test`.`s1` left join `test`.`s2` on(`test`.`s2`.`b` = `test`.`s1`.`b`) join `test`.`t1`) on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` where 1
+select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 left join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+s1_b s2_b t1_a t2_a t3_a
+5 5 7 7 2
+7 7 7 7 2
+3 NULL 7 7 2
+5 5 5 5 2
+7 7 5 5 2
+3 NULL 5 5 2
+5 5 7 7 7
+7 7 7 7 7
+3 NULL 7 7 7
+5 5 5 5 7
+7 7 5 5 7
+3 NULL 5 5 7
+5 5 7 7 3
+7 7 7 7 3
+3 NULL 7 7 3
+5 5 5 5 3
+7 7 5 5 3
+3 NULL 5 5 3
+NULL NULL NULL 1 2
+NULL NULL NULL 1 7
+NULL NULL NULL 1 3
+explain extended select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 right join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
+1 SIMPLE s2 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
+1 SIMPLE s1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`s1`.`b` AS `s1_b`,`test`.`s2`.`b` AS `s2_b`,`test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a` from `test`.`t2` left join (`test`.`s2` left join `test`.`s1` on(`test`.`s1`.`b` = `test`.`s2`.`b`) join `test`.`t1`) on(`test`.`t1`.`a` = `test`.`t2`.`a`) join `test`.`t3` where 1
+select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 right join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+s1_b s2_b t1_a t2_a t3_a
+7 7 7 7 2
+5 5 7 7 2
+NULL 1 7 7 2
+7 7 5 5 2
+5 5 5 5 2
+NULL 1 5 5 2
+7 7 7 7 7
+5 5 7 7 7
+NULL 1 7 7 7
+7 7 5 5 7
+5 5 5 5 7
+NULL 1 5 5 7
+7 7 7 7 3
+5 5 7 7 3
+NULL 1 7 7 3
+7 7 5 5 3
+5 5 5 5 3
+NULL 1 5 5 3
+NULL NULL NULL 1 2
+NULL NULL NULL 1 7
+NULL NULL NULL 1 3
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from (t1 join t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from (t1 join t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+explain extended select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from (t1, t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 4 100.00
+1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `t1_a`,`test`.`t2`.`a` AS `t2_a`,`test`.`t3`.`a` AS `t3_a`,`test`.`t4`.`a` AS `t4_a` from `test`.`t4` left join `test`.`t3` on(`test`.`t3`.`a` = `test`.`t4`.`a`) left join (`test`.`t1` join `test`.`t2`) on(`test`.`t2`.`a` = `test`.`t3`.`a`) where 1
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from (t1, t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+t1_a t2_a t3_a t4_a
+7 7 7 7
+5 7 7 7
+3 7 7 7
+NULL NULL NULL 4
+NULL NULL NULL 9
+NULL NULL NULL 5
+drop table t1,t2,t3,t4,s1,s2;
+#
# End of MariaDB 5.5 tests
#
#
diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test
index 223886b579c..b36b0ac8f35 100644
--- a/mysql-test/main/join.test
+++ b/mysql-test/main/join.test
@@ -1211,6 +1211,410 @@ DROP PROCEDURE p1;
DROP TABLE t1,t2,t3,t4,t5;
--echo #
+--echo # MDEV-19421: Embedding inner joins
+--echo #
+
+create table t1 (a int);
+insert into t1 values (7), (5), (3);
+create table s1 (b int);
+insert into s1 values (7), (5), (3);
+create table t2 (a int);
+insert into t2 values (5), (1), (7);
+create table s2 (b int);
+insert into s2 values (5), (1), (7);
+create table t3 (a int);
+insert into t3 values (2), (7), (3);
+create table t4 (a int);
+insert into t4 values (4), (7), (9), (5);
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t2.a=t3.a on t1.a=t2.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t2.a=t3.a on t1.a=t2.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t2.a=t3.a on t1.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 using(a) using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 using(a) using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 using(a) using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3 on t1.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 left join t3 on t1.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 right join t3 on t1.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 join t3 on t2.a=t3.a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 left join t3 on t2.a=t3.a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join (t2 right join t3 on t2.a=t3.a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select *
+from s1 join t2 join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select *
+from s1 join t2 left join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select *
+from s1 join t2 right join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 left join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from s1 join t2 right join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b, t2.a as t2_a, t3.a as t3_a
+from (s1 join t2) right join t3 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select *
+from s1 join t2 natural join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select *
+from s1 join t2 natural left join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select *
+from s1 join t2 natural right join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from t1 join t2 join t3
+where t1.a=t2.a and t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 left join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 left join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 left join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 right join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 join t4 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 left join t4 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, s2.b as s2_b, t3.a as t3_a, t4.a as t4_a
+from s1 join s2 join t3 right join t4 using(a);
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 join t3 on t2.a=t3.a join t4;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 left join t3 on t2.a=t3.a join t4;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 on t2.a=t3.a join t4;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 join t3 using(a) join t4;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 left join t3 using(a) join t4;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t2 right join t3 using(a) join t4;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 left join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 left join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 right join t2 on t1.a=t2.a join t3 right join t4 on t3.a=t4.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 join t4 on t4.a=s1.b;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 left join t4 on t4.a=s1.b;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from s1 join t1 left join t2 on s1.b=t2.a join t3 right join t4 on t4.a=s1.b;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 left join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select s1.b as s1_b, s2.b as s2_b, t1.a as t1_a, t2.a as t2_a, t3.a as t3_a
+from s1 right join s2 on s1.b=s2.b join t1 right join t2 on t1.a=t2.a join t3;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from t1 join t2 right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from (t1 join t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+let $q=
+select t1.a as t1_a, t2.a as t2_a, t3.a as t3_a, t4.a as t4_a
+from (t1, t2) right join t3 right join t4 on t3.a=t4.a on t2.a=t3.a;
+eval explain extended $q;
+eval $q;
+
+drop table t1,t2,t3,t4,s1,s2;
+
+--echo #
--echo # End of MariaDB 5.5 tests
--echo #
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result
index cc536126332..0aad061f299 100644
--- a/mysql-test/main/join_cache.result
+++ b/mysql-test/main/join_cache.result
@@ -3108,6 +3108,8 @@ CREATE TABLE t2 (
a2 int, b2 int, filler2 char(64) default ' ',
PRIMARY KEY idx(a2,b2,filler2)
) ;
+Warnings:
+Warning 1280 Name 'idx' ignored for PRIMARY key.
CREATE TABLE t3 (b3 int, c3 int, INDEX idx(b3));
INSERT INTO t1(a1) VALUES
(4), (7), (1), (9), (8), (5), (3), (6), (2);
diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result
index 9026a32e356..ccd73ec955f 100644
--- a/mysql-test/main/join_outer_innodb.result
+++ b/mysql-test/main/join_outer_innodb.result
@@ -486,7 +486,7 @@ Note 1051 Unknown table 'test.t2'
Note 1051 Unknown table 'test.t3'
create table t2(a int,unique key (a)) engine=innodb;
create table t3(b int) engine=innodb;
-create table t1(a int,b int)engine=innodb;
+create table t1(c int,b int)engine=innodb;
set @mdev4270_opl= @@optimizer_prune_level;
set @mdev4270_osd= @@optimizer_search_depth;
set optimizer_prune_level=0;
diff --git a/mysql-test/main/join_outer_innodb.test b/mysql-test/main/join_outer_innodb.test
index fe08689c80b..67e9965a475 100644
--- a/mysql-test/main/join_outer_innodb.test
+++ b/mysql-test/main/join_outer_innodb.test
@@ -358,7 +358,7 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
drop table if exists t1,t2,t3;
create table t2(a int,unique key (a)) engine=innodb;
create table t3(b int) engine=innodb;
-create table t1(a int,b int)engine=innodb;
+create table t1(c int,b int)engine=innodb;
set @mdev4270_opl= @@optimizer_prune_level;
set @mdev4270_osd= @@optimizer_search_depth;
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result
index b521447c37c..e315b0212f7 100644
--- a/mysql-test/main/opt_trace.result
+++ b/mysql-test/main/opt_trace.result
@@ -136,7 +136,9 @@ select * from v1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 1,
+ "cost_for_plan": 2.4044
}
]
},
@@ -269,7 +271,9 @@ select * from (select * from t1 where t1.a=1)q {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 1,
+ "cost_for_plan": 2.4044
}
]
},
@@ -408,7 +412,9 @@ select * from v2 {
"use_tmp_table": true
}
]
- }
+ },
+ "rows_for_plan": 1,
+ "cost_for_plan": 2.4044
}
]
},
@@ -462,7 +468,9 @@ select * from v2 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 2,
+ "cost_for_plan": 2.4
}
]
},
@@ -589,7 +597,9 @@ explain select * from v2 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 4.022
}
]
},
@@ -696,7 +706,9 @@ explain select * from v1 {
"use_tmp_table": true
}
]
- }
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 4.022
}
]
},
@@ -750,7 +762,9 @@ explain select * from v1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 12
}
]
},
@@ -910,6 +924,8 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
}
]
},
+ "rows_for_plan": 100,
+ "cost_for_plan": 22.317,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -932,7 +948,9 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
"chosen": false
}
]
- }
+ },
+ "rows_for_plan": 100,
+ "cost_for_plan": 242.32
}
]
},
@@ -949,6 +967,8 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
}
]
},
+ "rows_for_plan": 100,
+ "cost_for_plan": 22.317,
"rest_of_plan": [
{
"plan_prefix": ["t2"],
@@ -972,6 +992,8 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
}
]
},
+ "rows_for_plan": 100,
+ "cost_for_plan": 242.32,
"pruned_by_cost": true
}
]
@@ -1130,7 +1152,9 @@ EXPLAIN SELECT DISTINCT a FROM t1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 5,
+ "cost_for_plan": 7.75
}
]
},
@@ -1308,7 +1332,9 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a {
"use_tmp_table": true
}
]
- }
+ },
+ "rows_for_plan": 0.5849,
+ "cost_for_plan": 3.4291
}
]
},
@@ -1497,7 +1523,9 @@ EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id {
"use_tmp_table": true
}
]
- }
+ },
+ "rows_for_plan": 16,
+ "cost_for_plan": 5.2313
}
]
},
@@ -1675,7 +1703,9 @@ EXPLAIN SELECT * FROM t1 WHERE a = 20010104e0 GROUP BY id {
"use_tmp_table": true
}
]
- }
+ },
+ "rows_for_plan": 16,
+ "cost_for_plan": 5.2313
}
]
},
@@ -1943,7 +1973,9 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
"cause": "cost"
}
]
- }
+ },
+ "rows_for_plan": 21,
+ "cost_for_plan": 26.2
}
]
},
@@ -2171,7 +2203,9 @@ select t1.a from t1 left join t2 on t1.a=t2.a {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 4,
+ "cost_for_plan": 2.8068
}
]
},
@@ -2286,6 +2320,8 @@ explain select * from t1 left join t2 on t2.a=t1.a {
}
]
},
+ "rows_for_plan": 4,
+ "cost_for_plan": 2.8068,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -2306,7 +2342,9 @@ explain select * from t1 left join t2 on t2.a=t1.a {
"chosen": false
}
]
- }
+ },
+ "rows_for_plan": 4,
+ "cost_for_plan": 7.6068
}
]
}
@@ -2454,7 +2492,9 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 4,
+ "cost_for_plan": 2.8068
}
]
},
@@ -2639,7 +2679,9 @@ explain extended select * from t1 where a in (select pk from t10) {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 4.022
}
]
}
@@ -2661,6 +2703,8 @@ explain extended select * from t1 where a in (select pk from t10) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6066,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -2674,7 +2718,9 @@ explain extended select * from t1 where a in (select pk from t10) {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 30,
+ "cost_for_plan": 10.629
}
]
},
@@ -2691,6 +2737,8 @@ explain extended select * from t1 where a in (select pk from t10) {
}
]
},
+ "rows_for_plan": 10,
+ "cost_for_plan": 4.022,
"pruned_by_heuristic": true
}
]
@@ -3031,7 +3079,9 @@ explain select * from t1 where pk = 2 and a=5 and b=1 {
"cause": "cost"
}
]
- }
+ },
+ "rows_for_plan": 1,
+ "cost_for_plan": 1.2043
}
]
},
@@ -3143,7 +3193,9 @@ select f1(a) from t1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 4,
+ "cost_for_plan": 2.8068
}
]
},
@@ -3229,7 +3281,9 @@ select f2(a) from t1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 4,
+ "cost_for_plan": 2.8068
}
]
},
@@ -3273,7 +3327,7 @@ a
2
select length(trace) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
length(trace)
-1754
+1831
set optimizer_trace_max_mem_size=100;
select * from t1;
a
@@ -3287,7 +3341,7 @@ select * from t1 {
"join_preparation": {
"select_id": 1,
"steps": [
- 1654 0
+ 1731 0
set optimizer_trace_max_mem_size=0;
select * from t1;
a
@@ -3295,7 +3349,7 @@ a
2
select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
-select * from t1 1754 0
+select * from t1 1831 0
drop table t1;
set optimizer_trace='enabled=off';
set @@optimizer_trace_max_mem_size= @save_optimizer_trace_max_mem_size;
@@ -3600,6 +3654,8 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.007,
"rest_of_plan": [
{
"plan_prefix": ["t0"],
@@ -3621,7 +3677,9 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"cause": "cost"
}
]
- }
+ },
+ "rows_for_plan": 3,
+ "cost_for_plan": 5.614
}
]
},
@@ -3638,6 +3696,8 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.007,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -3660,6 +3720,8 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
}
]
},
+ "rows_for_plan": 6,
+ "cost_for_plan": 6.2211,
"pruned_by_cost": true
}
]
@@ -3787,7 +3849,9 @@ explain select * from (select rand() from t1)q {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051
}
]
},
@@ -3841,7 +3905,9 @@ explain select * from (select rand() from t1)q {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 3,
+ "cost_for_plan": 3.6
}
]
},
@@ -4033,6 +4099,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"rest_of_plan": [
{
"plan_prefix": ["t_inner_1"],
@@ -4046,7 +4114,9 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103
}
]
},
@@ -4063,6 +4133,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
}
]
@@ -4085,6 +4157,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"rest_of_plan": [
{
"plan_prefix": ["t1"],
@@ -4099,6 +4173,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103,
"rest_of_plan": [
{
"plan_prefix": ["t1", "t_inner_1"],
@@ -4112,7 +4188,9 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 27,
+ "cost_for_plan": 13.815
}
]
},
@@ -4129,6 +4207,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103,
"pruned_by_heuristic": true
}
]
@@ -4146,6 +4226,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
},
{
@@ -4161,6 +4243,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
}
]
@@ -4447,6 +4531,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1"],
@@ -4461,6 +4547,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1"],
@@ -4475,6 +4563,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 24.626,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
@@ -4489,6 +4579,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 34.174,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4508,6 +4600,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 52.379,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4527,7 +4621,9 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 729,
+ "cost_for_plan": 200.19
}
]
},
@@ -4549,6 +4645,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 84.79,
"pruned_by_heuristic": true
}
]
@@ -4566,6 +4664,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 30.564,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4585,6 +4685,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 48.779,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4605,6 +4707,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 729,
+ "cost_for_plan": 196.59,
"pruned_by_cost": true
}
]
@@ -4627,6 +4731,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 48.779,
"pruned_by_heuristic": true
}
]
@@ -4644,6 +4750,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 34.174,
"pruned_by_heuristic": true
}
]
@@ -4661,6 +4769,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 24.626,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1", "t_outer_2"],
@@ -4675,6 +4785,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 729,
+ "cost_for_plan": 172.44,
"pruned_by_cost": true
},
{
@@ -4690,6 +4802,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 75.231,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4709,6 +4823,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 514.65,
"pruned_by_cost": true
},
{
@@ -4729,6 +4845,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 514.65,
"pruned_by_cost": true
}
]
@@ -4746,6 +4864,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 729,
+ "cost_for_plan": 172.44,
"pruned_by_heuristic": true
}
]
@@ -4763,6 +4883,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 13.815,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_4"],
@@ -4777,6 +4899,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 64.431,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4796,6 +4920,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 503.85,
"pruned_by_cost": true
},
{
@@ -4816,6 +4942,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 503.85,
"pruned_by_cost": true
}
]
@@ -4833,6 +4961,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 64.431,
"pruned_by_heuristic": true
},
{
@@ -4848,6 +4978,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 64.431,
"pruned_by_heuristic": true
}
]
@@ -4865,6 +4997,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 24.626,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_3"],
@@ -4879,6 +5013,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 729,
+ "cost_for_plan": 172.44,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4898,6 +5034,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 611.85,
"pruned_by_cost": true
},
{
@@ -4918,6 +5056,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 6561,
+ "cost_for_plan": 1486.7,
"pruned_by_cost": true
}
]
@@ -4935,6 +5075,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 75.231,
"rest_of_plan": [
{
"plan_prefix": [
@@ -4954,6 +5096,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 514.65,
"pruned_by_cost": true
},
{
@@ -4974,6 +5118,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 2187,
+ "cost_for_plan": 514.65,
"pruned_by_cost": true
}
]
@@ -4991,6 +5137,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 729,
+ "cost_for_plan": 172.44,
"pruned_by_heuristic": true
}
]
@@ -5010,6 +5158,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021,
"pruned_by_heuristic": true
},
{
@@ -5025,6 +5175,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021,
"pruned_by_heuristic": true
},
{
@@ -5040,6 +5192,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103,
"pruned_by_heuristic": true
},
{
@@ -5055,6 +5209,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021,
"pruned_by_heuristic": true
}
]
@@ -5072,6 +5228,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
},
{
@@ -5087,6 +5245,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
},
{
@@ -5102,6 +5262,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
},
{
@@ -5117,6 +5279,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
},
{
@@ -5132,6 +5296,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
}
]
@@ -5473,6 +5639,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"rest_of_plan": [
{
"plan_prefix": ["t_inner_1"],
@@ -5486,7 +5654,9 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021
}
]
},
@@ -5503,6 +5673,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
}
]
@@ -5522,6 +5694,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"rest_of_plan": [
{
"plan_prefix": ["t_inner_4"],
@@ -5535,7 +5709,9 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021
}
]
},
@@ -5552,6 +5728,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
}
]
@@ -5574,6 +5752,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1"],
@@ -5588,6 +5768,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1"],
@@ -5602,6 +5784,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 24.626,
"rest_of_plan": [
{
"plan_prefix": ["t_outer_1", "t_inner_1", "t_inner_2"],
@@ -5616,6 +5800,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 15.541,
"rest_of_plan": [
{
"plan_prefix": [
@@ -5635,6 +5821,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 33.746,
"rest_of_plan": [
{
"plan_prefix": [
@@ -5654,7 +5842,9 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 729,
+ "cost_for_plan": 181.56
}
]
},
@@ -5676,6 +5866,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 243,
+ "cost_for_plan": 66.156,
"pruned_by_cost": true
}
]
@@ -5693,6 +5885,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 11.931,
"rest_of_plan": [
{
"plan_prefix": [
@@ -5712,6 +5906,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 30.146,
"pruned_by_cost": true
},
{
@@ -5732,6 +5928,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 30.146,
"pruned_by_cost": true
}
]
@@ -5749,6 +5947,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 15.541,
"pruned_by_heuristic": true
}
]
@@ -5766,6 +5966,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 24.626,
"pruned_by_cost": true
},
{
@@ -5781,6 +5983,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 13.815,
"pruned_by_heuristic": true
},
{
@@ -5796,6 +6000,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 81,
+ "cost_for_plan": 24.626,
"pruned_by_cost": true
}
]
@@ -5813,6 +6019,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021,
"pruned_by_heuristic": true
},
{
@@ -5828,6 +6036,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021,
"pruned_by_heuristic": true
},
{
@@ -5843,6 +6053,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 6.4103,
"pruned_by_heuristic": true
},
{
@@ -5858,6 +6070,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 27,
+ "cost_for_plan": 10.021,
"pruned_by_heuristic": true
}
]
@@ -5875,6 +6089,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
},
{
@@ -5890,6 +6106,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
},
{
@@ -5905,6 +6123,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
},
{
@@ -5920,6 +6140,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051,
"pruned_by_heuristic": true
},
{
@@ -5935,6 +6157,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) {
}
]
},
+ "rows_for_plan": 9,
+ "cost_for_plan": 3.8154,
"pruned_by_heuristic": true
}
]
@@ -6562,4 +6786,202 @@ INSERT INTO t1 VALUES ('a'),('b');
SET optimizer_trace = 'enabled=on';
DELETE FROM t1 WHERE f = 'x';
DROP TABLE t1;
+#
+# Print cost_for_plan and rows_for_plan for join prefix
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table one_k (a int, b int, key(b));
+insert into one_k select A.a + B.a*10 + C.a*100, A.a + B.a*10 + C.a*100 from t0 A, t0 B, t0 C;
+analyze table t0, one_k persistent for all;
+Table Op Msg_type Msg_text
+test.t0 analyze status Engine-independent statistics collected
+test.t0 analyze status OK
+test.one_k analyze status Engine-independent statistics collected
+test.one_k analyze status Table is already up to date
+set @tmp_jcl=@@join_cache_level;
+set join_cache_level=0;
+set optimizer_trace=1;
+# Check cost/row numbers when multiple tables are joined
+# (cost_for_plan is the same as best_access_path.cost for single-table SELECTs
+# but for joins using condition selectivity it is not as trivial. So,
+# now we are printing it)
+explain select * from t0 A, one_k B where A.a<5 and B.a<800;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 10 Using where
+1 SIMPLE B ALL NULL NULL NULL NULL 1000 Using where
+select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
+[
+
+ [
+
+ {
+ "plan_prefix":
+ [
+ ],
+ "table": "A",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 5.9375,
+ "cost": 2.8296,
+ "chosen": true
+ }
+ ]
+ },
+ "rows_for_plan": 5.9375,
+ "cost_for_plan": 4.0171,
+ "rest_of_plan":
+ [
+
+ {
+ "plan_prefix":
+ [
+ "A"
+ ],
+ "table": "B",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 804.69,
+ "cost": 256.85,
+ "chosen": true
+ }
+ ]
+ },
+ "rows_for_plan": 4777.8,
+ "cost_for_plan": 1216.4
+ }
+ ]
+ },
+
+ {
+ "plan_prefix":
+ [
+ ],
+ "table": "B",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 804.69,
+ "cost": 43.26,
+ "chosen": true
+ }
+ ]
+ },
+ "rows_for_plan": 804.69,
+ "cost_for_plan": 204.2,
+ "pruned_by_heuristic": true
+ }
+ ]
+]
+set join_cache_level=@tmp_jcl;
+# This shows post-join selectivity
+explain select * from t0 A, one_k B where A.a=B.b and B.a<800;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE A ALL NULL NULL NULL NULL 10 Using where
+1 SIMPLE B ref b b 5 test.A.a 1 Using where
+select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
+[
+
+ [
+
+ {
+ "plan_prefix":
+ [
+ ],
+ "table": "A",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 10,
+ "cost": 2.0171,
+ "chosen": true
+ }
+ ]
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 4.0171,
+ "rest_of_plan":
+ [
+
+ {
+ "plan_prefix":
+ [
+ "A"
+ ],
+ "table": "B",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "ref",
+ "index": "b",
+ "used_range_estimates": false,
+ "cause": "not available",
+ "rows": 1,
+ "cost": 20,
+ "chosen": true
+ },
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 804.69,
+ "cost": 43.26,
+ "chosen": false
+ }
+ ]
+ },
+ "rows_for_plan": 10,
+ "cost_for_plan": 26.017,
+ "selectivity": 0.8047
+ }
+ ]
+ },
+
+ {
+ "plan_prefix":
+ [
+ ],
+ "table": "B",
+ "best_access_path":
+ {
+ "considered_access_paths":
+ [
+
+ {
+ "access_type": "scan",
+ "resulting_rows": 804.69,
+ "cost": 43.26,
+ "chosen": true
+ }
+ ]
+ },
+ "rows_for_plan": 804.69,
+ "cost_for_plan": 204.2,
+ "pruned_by_cost": true
+ }
+ ]
+]
+drop table t0, one_k;
set optimizer_trace='enabled=off';
diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test
index c1ed050062b..e5d635db042 100644
--- a/mysql-test/main/opt_trace.test
+++ b/mysql-test/main/opt_trace.test
@@ -508,4 +508,32 @@ SET optimizer_trace = 'enabled=on';
DELETE FROM t1 WHERE f = 'x';
DROP TABLE t1;
+--echo #
+--echo # Print cost_for_plan and rows_for_plan for join prefix
+--echo #
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table one_k (a int, b int, key(b));
+insert into one_k select A.a + B.a*10 + C.a*100, A.a + B.a*10 + C.a*100 from t0 A, t0 B, t0 C;
+
+analyze table t0, one_k persistent for all;
+
+set @tmp_jcl=@@join_cache_level;
+set join_cache_level=0;
+set optimizer_trace=1;
+
+--echo # Check cost/row numbers when multiple tables are joined
+--echo # (cost_for_plan is the same as best_access_path.cost for single-table SELECTs
+--echo # but for joins using condition selectivity it is not as trivial. So,
+--echo # now we are printing it)
+explain select * from t0 A, one_k B where A.a<5 and B.a<800;
+select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+
+set join_cache_level=@tmp_jcl;
+
+--echo # This shows post-join selectivity
+explain select * from t0 A, one_k B where A.a=B.b and B.a<800;
+select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+drop table t0, one_k;
+
set optimizer_trace='enabled=off';
diff --git a/mysql-test/main/opt_trace_index_merge.result b/mysql-test/main/opt_trace_index_merge.result
index b5e68d04615..5697e3a771a 100644
--- a/mysql-test/main/opt_trace_index_merge.result
+++ b/mysql-test/main/opt_trace_index_merge.result
@@ -213,7 +213,9 @@ explain select * from t1 where a=1 or b=1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 2,
+ "cost_for_plan": 4.5484
}
]
},
diff --git a/mysql-test/main/opt_trace_index_merge_innodb.result b/mysql-test/main/opt_trace_index_merge_innodb.result
index 6a245cc83da..23a500b0720 100644
--- a/mysql-test/main/opt_trace_index_merge_innodb.result
+++ b/mysql-test/main/opt_trace_index_merge_innodb.result
@@ -209,7 +209,9 @@ explain select * from t1 where pk1 != 0 and key1 = 1 {
"cause": "cost"
}
]
- }
+ },
+ "rows_for_plan": 1,
+ "cost_for_plan": 2.2
}
]
},
diff --git a/mysql-test/main/opt_trace_security.result b/mysql-test/main/opt_trace_security.result
index 9f5bacd6aa7..c8112fd5f6c 100644
--- a/mysql-test/main/opt_trace_security.result
+++ b/mysql-test/main/opt_trace_security.result
@@ -99,7 +99,9 @@ select * from db1.t1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051
}
]
},
@@ -210,7 +212,9 @@ select * from db1.v1 {
"chosen": true
}
]
- }
+ },
+ "rows_for_plan": 3,
+ "cost_for_plan": 2.6051
}
]
},
diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result
index 49342705289..6fbbc0a880a 100644
--- a/mysql-test/main/plugin.result
+++ b/mysql-test/main/plugin.result
@@ -318,6 +318,15 @@ UNUSABLE
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
plugin_name
+set names utf8;
+select convert('admin𝌆' using utf8);
+convert('admin𝌆' using utf8)
+admin????
+Warnings:
+Warning 1300 Invalid utf8 character string: '\xF0\x9D\x8C\x86'
+install plugin foo soname 'admin𝌆';
+ERROR HY000: No paths allowed for shared library
+# End of 5.5 test
#
# MDEV-5309 - RENAME TABLE does not check for existence of the table's
# engine
@@ -331,6 +340,7 @@ UNINSTALL PLUGIN example;
RENAME TABLE t1 TO t2;
ERROR 42S02: Table 'test.t1' doesn't exist
DROP TABLE t1;
+# End of 10.1 test
#
# MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
#
diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test
index 0990cb206d8..5a855a1276e 100644
--- a/mysql-test/main/plugin.test
+++ b/mysql-test/main/plugin.test
@@ -252,6 +252,15 @@ select plugin_name from information_schema.plugins where plugin_library like 'ha
uninstall soname 'ha_example';
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+#
+#
+#
+set names utf8;
+select convert('admin𝌆' using utf8);
+--error ER_UDF_NO_PATHS
+install plugin foo soname 'admin𝌆';
+
+--echo # End of 5.5 test
--echo #
--echo # MDEV-5309 - RENAME TABLE does not check for existence of the table's
@@ -266,6 +275,8 @@ UNINSTALL PLUGIN example;
RENAME TABLE t1 TO t2;
DROP TABLE t1;
+--echo # End of 10.1 test
+
--source include/install_plugin_if_exists.inc
diff --git a/mysql-test/main/plugin_not_embedded.result b/mysql-test/main/plugin_not_embedded.result
index 2edf6c496d3..a9ac5735137 100644
--- a/mysql-test/main/plugin_not_embedded.result
+++ b/mysql-test/main/plugin_not_embedded.result
@@ -16,3 +16,7 @@ connection default;
DROP USER bug51770@localhost;
INSTALL PLUGIN example SONAME '../ha_example.so';
ERROR HY000: No paths allowed for shared library
+insert mysql.plugin values ();
+# restart
+delete from mysql.plugin where name = '';
+# End of 5.5 tests
diff --git a/mysql-test/main/plugin_not_embedded.test b/mysql-test/main/plugin_not_embedded.test
index 3b4129b6b6b..a9126053f18 100644
--- a/mysql-test/main/plugin_not_embedded.test
+++ b/mysql-test/main/plugin_not_embedded.test
@@ -30,3 +30,12 @@ let $path = `select CONCAT_WS('/', '..', '$HA_EXAMPLE_SO')`;
--replace_regex /\.dll/.so/
--error ER_UDF_NO_PATHS
eval INSTALL PLUGIN example SONAME '$path';
+
+#
+# Bug#27302459: EMPTY VALUE IN MYSQL.PLUGIN TABLE CAUSES SERVER TO EXIT ON STARTUP
+#
+insert mysql.plugin values ();
+source include/restart_mysqld.inc;
+delete from mysql.plugin where name = '';
+
+--echo # End of 5.5 tests
diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result
index 1e846180429..b3b295842cd 100644
--- a/mysql-test/main/ps.result
+++ b/mysql-test/main/ps.result
@@ -4393,6 +4393,69 @@ LINE1 1
LINE2 2
LINE3 3
drop table t1;
+#
+# MDEV-17042: prepared statement does not return error with
+# SQL_MODE STRICT_TRANS_TABLES. (Part 1)
+#
+set @save_sql_mode=@@sql_mode;
+set sql_mode='STRICT_ALL_TABLES';
+CREATE TABLE t1 (id int, count int);
+insert into t1 values (1,1),(0,2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (id decimal(10,5), count int);
+insert into t1 values (1,1),(0,2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect DECIMAL value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect DECIMAL value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect DECIMAL value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (id double, count int);
+insert into t1 values (1,1),(0,2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (id date, count int);
+insert into t1 values ("2019-06-11",1),("2019-06-12",2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect datetime value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect datetime value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect datetime value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+set sql_mode=@save_sql_mode;
# End of 5.5 tests
#
# End of 10.0 tests
diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test
index f701716e4f4..a9d588a02c0 100644
--- a/mysql-test/main/ps.test
+++ b/mysql-test/main/ps.test
@@ -3864,6 +3864,83 @@ FROM
FROM t1 A, (SELECT @cnt := 0) C) T
) X;
drop table t1;
+
+--echo #
+--echo # MDEV-17042: prepared statement does not return error with
+--echo # SQL_MODE STRICT_TRANS_TABLES. (Part 1)
+--echo #
+
+set @save_sql_mode=@@sql_mode;
+set sql_mode='STRICT_ALL_TABLES';
+
+CREATE TABLE t1 (id int, count int);
+insert into t1 values (1,1),(0,2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+
+CREATE TABLE t1 (id decimal(10,5), count int);
+insert into t1 values (1,1),(0,2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+
+CREATE TABLE t1 (id double, count int);
+insert into t1 values (1,1),(0,2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+
+CREATE TABLE t1 (id date, count int);
+insert into t1 values ("2019-06-11",1),("2019-06-12",2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+set sql_mode=@save_sql_mode;
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/main/ps_innodb.result b/mysql-test/main/ps_innodb.result
new file mode 100644
index 00000000000..4a5819e4072
--- /dev/null
+++ b/mysql-test/main/ps_innodb.result
@@ -0,0 +1,64 @@
+#
+# MDEV-17042: prepared statement does not return error with
+# SQL_MODE STRICT_TRANS_TABLES. (Part 2)
+#
+set @save_sql_mode=@@sql_mode;
+set sql_mode='STRICT_TRANS_TABLES';
+CREATE TABLE t1 (id int, count int) engine=innodb;
+insert into t1 values (1,1),(0,2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (id decimal(10,5), count int) engine=innodb;
+insert into t1 values (1,1),(0,2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect DECIMAL value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect DECIMAL value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect DECIMAL value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (id double, count int) engine=innodb;
+insert into t1 values (1,1),(0,2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect DOUBLE value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+CREATE TABLE t1 (id date, count int) engine=innodb;
+insert into t1 values ("2019-06-11",1),("2019-06-12",2);
+update t1 set count = count + 1 where id = '1bad';
+ERROR 22007: Truncated incorrect datetime value: '1bad'
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+execute stmt;
+ERROR 22007: Truncated incorrect datetime value: '1bad'
+deallocate prepare stmt;
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+execute stmt using @a;
+ERROR 22007: Truncated incorrect datetime value: '1bad'
+deallocate prepare stmt;
+drop table t1;
+set sql_mode=@save_sql_mode;
+# End of 5.5 tests
diff --git a/mysql-test/main/ps_innodb.test b/mysql-test/main/ps_innodb.test
new file mode 100644
index 00000000000..6f56af35271
--- /dev/null
+++ b/mysql-test/main/ps_innodb.test
@@ -0,0 +1,80 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-17042: prepared statement does not return error with
+--echo # SQL_MODE STRICT_TRANS_TABLES. (Part 2)
+--echo #
+
+set @save_sql_mode=@@sql_mode;
+set sql_mode='STRICT_TRANS_TABLES';
+
+CREATE TABLE t1 (id int, count int) engine=innodb;
+insert into t1 values (1,1),(0,2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+
+CREATE TABLE t1 (id decimal(10,5), count int) engine=innodb;
+insert into t1 values (1,1),(0,2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+
+CREATE TABLE t1 (id double, count int) engine=innodb;
+insert into t1 values (1,1),(0,2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+
+CREATE TABLE t1 (id date, count int) engine=innodb;
+insert into t1 values ("2019-06-11",1),("2019-06-12",2);
+--error ER_TRUNCATED_WRONG_VALUE
+update t1 set count = count + 1 where id = '1bad';
+
+prepare stmt from "update t1 set count = count + 1 where id = '1bad'";
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+deallocate prepare stmt;
+
+prepare stmt from 'update t1 set count = count + 1 where id = ?';
+set @a = '1bad';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt using @a;
+deallocate prepare stmt;
+drop table t1;
+set sql_mode=@save_sql_mode;
+
+--echo # End of 5.5 tests
diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result
index 087faef284d..33c7c9be47a 100644
--- a/mysql-test/main/selectivity.result
+++ b/mysql-test/main/selectivity.result
@@ -402,7 +402,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey` limit 1))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -443,7 +443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey` limit 1))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -987,7 +987,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2`))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2` limit 1))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index b6fed1bb41d..92091f0d6db 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 100.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey` limit 1))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -446,7 +446,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY customer ALL NULL NULL NULL NULL 150 91.00 Using where
Warnings:
Note 1276 Field or reference 'dbt3_s001.customer.c_custkey' of SELECT #4 was resolved in SELECT #2
-Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey`))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
+Note 1003 /* select#1 */ select substr(`dbt3_s001`.`customer`.`c_phone`,1,2) AS `cntrycode`,count(0) AS `numcust`,sum(`dbt3_s001`.`customer`.`c_acctbal`) AS `totacctbal` from `dbt3_s001`.`customer` where substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25') and `dbt3_s001`.`customer`.`c_acctbal` > (/* select#3 */ select avg(`dbt3_s001`.`customer`.`c_acctbal`) from `dbt3_s001`.`customer` where `dbt3_s001`.`customer`.`c_acctbal` > 0.00 and substr(`dbt3_s001`.`customer`.`c_phone`,1,2) in ('10','20','14','19','11','28','25')) and !<in_optimizer>(1,<expr_cache><`dbt3_s001`.`customer`.`c_custkey`>(exists(/* select#4 */ select 1 from `dbt3_s001`.`orders` where `dbt3_s001`.`orders`.`o_custkey` = `dbt3_s001`.`customer`.`c_custkey` limit 1))) group by substr(`dbt3_s001`.`customer`.`c_phone`,1,2) order by substr(`dbt3_s001`.`customer`.`c_phone`,1,2)
select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
from (
select substr(c_phone, 1, 2) as cntrycode, c_acctbal
@@ -997,7 +997,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 SUBQUERY t2 ALL NULL NULL NULL NULL 7 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 14 100.00 Using join buffer (flat, BNL join)
Warnings:
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2`))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where <cache>(<in_optimizer>(1,exists(/* select#2 */ select 1 from `test`.`t1` join `test`.`t2` limit 1))) and `test`.`t1`.`a` <> `test`.`t2`.`b` or `test`.`t1`.`a` <= 4
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result
index 1fdf8d19ba6..fc0049db997 100644
--- a/mysql-test/main/subselect.result
+++ b/mysql-test/main/subselect.result
@@ -1894,7 +1894,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null)))
+Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1)))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -4462,7 +4462,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) limit 1))
DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7264,6 +7264,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
+#
+# MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+#
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+a
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+set @l=1;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=2;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=0;
+execute stmt1 using @l;
+a
+deallocate prepare stmt1;
+drop table t10, t12;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test
index 82823b418ef..7ed423edf96 100644
--- a/mysql-test/main/subselect.test
+++ b/mysql-test/main/subselect.test
@@ -6104,6 +6104,30 @@ explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
drop table t1,t2;
+
+--echo #
+--echo # MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+--echo #
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+
+set @l=1;
+execute stmt1 using @l;
+set @l=2;
+execute stmt1 using @l;
+set @l=0;
+execute stmt1 using @l;
+
+deallocate prepare stmt1;
+
+drop table t10, t12;
+
--echo End of 5.5 tests
--echo # End of 10.0 tests
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 783542c7dbf..3dc019cc6c1 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -2565,9 +2565,8 @@ explain
select * from t1
where exists (select * from t2 where t2.a=t1.a order by t2.b limit 0);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 100
-1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
-2 MATERIALIZED t2 ALL NULL NULL NULL NULL 100
+1 PRIMARY t1 ALL NULL NULL NULL NULL 100 Using where
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
# LIMIT+OFFSET prevents the conversion:
explain
select * from t1
diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result
index 813d668c88c..abd978de9a5 100644
--- a/mysql-test/main/subselect_cache.result
+++ b/mysql-test/main/subselect_cache.result
@@ -3387,6 +3387,7 @@ WHERE table1 .`col_varchar_key` ) field10
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
SET @@optimizer_switch = 'subquery_cache=on';
/* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
SELECT SUBQUERY2_t1 .`col_int_key`
@@ -3403,6 +3404,7 @@ WHERE table1 .`col_varchar_key` ) field10
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
drop table t1,t2,t3,t4;
set @@optimizer_switch= default;
#launchpad BUG#611625
diff --git a/mysql-test/main/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result
index 029ac22a486..950538ad114 100644
--- a/mysql-test/main/subselect_exists2in.result
+++ b/mysql-test/main/subselect_exists2in.result
@@ -94,7 +94,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a`)
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(/* select#2 */ select `test`.`t3`.`a` from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a` limit 1)
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
drop table t1,t2,t3;
@@ -361,7 +361,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
-Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !exists(/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1)) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !exists(/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` = 1 limit 1)) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1
@@ -432,7 +432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(/* select#2 */ select 1 from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`b1` = `test`.`t1`.`a1`)
+Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(/* select#2 */ select 1 from `test`.`t3` where `test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`b1` = `test`.`t1`.`a1` limit 1)
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
drop table t1,t3;
@@ -908,7 +908,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'sq1.pk' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'sq1.f1' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select straight_join `test`.`t1`.`f2` AS `f2` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`,`test`.`t1`.`pk`>(exists(/* select#3 */ select 1 from `test`.`t1` `sq2` semi join (`test`.`t1`) where `test`.`sq2`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`pk` = `test`.`t1`.`f1`))
+Note 1003 /* select#1 */ select straight_join `test`.`t1`.`f2` AS `f2` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`,`test`.`t1`.`pk`>(exists(/* select#3 */ select 1 from `test`.`t1` `sq2` semi join (`test`.`t1`) where `test`.`sq2`.`f1` = `test`.`t1`.`f1` and `test`.`t1`.`pk` = `test`.`t1`.`f1` limit 1))
SELECT STRAIGHT_JOIN sq1.f2
FROM ( SELECT * FROM t1 ) AS sq1
WHERE EXISTS ( SELECT * FROM t1 AS sq2
diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result
index 781b94b689b..4cf28638484 100644
--- a/mysql-test/main/subselect_innodb.result
+++ b/mysql-test/main/subselect_innodb.result
@@ -458,7 +458,7 @@ EXPLAIN
SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-2 SUBQUERY t2 index PRIMARY PRIMARY 4 NULL 1 Using where; Using index; Using temporary
+2 SUBQUERY t2 index NULL PRIMARY 4 NULL 1 Using index; Using temporary
2 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join)
SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
a
diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result
index 64bdfb499b4..4e03d9663ef 100644
--- a/mysql-test/main/subselect_mat.result
+++ b/mysql-test/main/subselect_mat.result
@@ -2284,7 +2284,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(/* select#2 */ select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3`))
+Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(/* select#2 */ select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3` limit 1))
# this checks the result set above
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result
index 613a0d8dd6c..cffe195d3de 100644
--- a/mysql-test/main/subselect_no_exists_to_in.result
+++ b/mysql-test/main/subselect_no_exists_to_in.result
@@ -351,7 +351,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(/* select#2 */ select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
+Note 1003 /* select#1 */ select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(/* select#2 */ select 1 from `test`.`t7` where `test`.`t7`.`uq` = `test`.`t6`.`clinic_uq` limit 1))
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
ERROR 23000: Column 'a' in field list is ambiguous
drop table t1,t2,t3;
@@ -1898,7 +1898,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null))
+Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -2434,7 +2434,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(/* select#2 */ select 1 from `test`.`t1` where `test`.`t1`.`a` = `test`.`up`.`a`))
+Note 1003 /* select#1 */ select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(/* select#2 */ select 1 from `test`.`t1` where `test`.`t1`.`a` = `test`.`up`.`a` limit 1))
drop table t1;
CREATE TABLE t1 (t1_a int);
INSERT INTO t1 VALUES (1);
@@ -4452,7 +4452,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` limit 1))
EXPLAIN EXTENDED
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@@ -4464,7 +4464,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) limit 1))
DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7264,6 +7264,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
+#
+# MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+#
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+a
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+set @l=1;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=2;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=0;
+execute stmt1 using @l;
+a
+deallocate prepare stmt1;
+drop table t10, t12;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result
index 982e701231d..4ebf04b1f55 100644
--- a/mysql-test/main/subselect_no_mat.result
+++ b/mysql-test/main/subselect_no_mat.result
@@ -1901,7 +1901,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null)))
+Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1)))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -4464,7 +4464,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) limit 1))
DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7257,6 +7257,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
+#
+# MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+#
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+a
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+set @l=1;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=2;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=0;
+execute stmt1 using @l;
+a
+deallocate prepare stmt1;
+drop table t10, t12;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result
index 1937f2af8f6..b4ee1ba6287 100644
--- a/mysql-test/main/subselect_no_opts.result
+++ b/mysql-test/main/subselect_no_opts.result
@@ -1897,7 +1897,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null))
+Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -4460,7 +4460,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) limit 1)
DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7255,6 +7255,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
+#
+# MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+#
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+a
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+set @l=1;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=2;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=0;
+execute stmt1 using @l;
+a
+deallocate prepare stmt1;
+drop table t10, t12;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result
index 929af9b4b1f..71d61e797f3 100644
--- a/mysql-test/main/subselect_no_scache.result
+++ b/mysql-test/main/subselect_no_scache.result
@@ -1900,7 +1900,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null))
+Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -4468,7 +4468,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) limit 1)
DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7270,6 +7270,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
+#
+# MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+#
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+a
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+set @l=1;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=2;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=0;
+execute stmt1 using @l;
+a
+deallocate prepare stmt1;
+drop table t10, t12;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result
index 52c81e58a49..f4eadbf46ce 100644
--- a/mysql-test/main/subselect_no_semijoin.result
+++ b/mysql-test/main/subselect_no_semijoin.result
@@ -1897,7 +1897,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null)))
+Note 1003 /* select#1 */ select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where !<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(/* select#2 */ select `test`.`t1`.`id` from `test`.`t1` where `test`.`t1`.`id` < 8 and `test`.`t1`.`id` = `test`.`tt`.`id` having `test`.`t1`.`id` is not null limit 1)))
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
@@ -4460,7 +4460,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
-Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`)))
+Note 1003 /* select#1 */ select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((/* select#2 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) union (/* select#3 */ select 1 from `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a`) limit 1))
DROP TABLE t1,t2;
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7255,6 +7255,37 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
drop table t1,t2;
+#
+# MDEV-19429: Wrong query result with EXISTS and LIMIT 0
+#
+create table t10 (a int);
+insert into t10 values (1),(2),(3);
+create table t12 (a int);
+insert into t12 values (1),(2),(3);
+select * from t10 where exists (select * from t12 order by a limit 0);
+a
+explain select * from t10 where exists (select * from t12 order by a limit 0);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Zero limit
+prepare stmt1 from "select * from t10 where exists (select * from t12 order by a limit ?)";
+set @l=1;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=2;
+execute stmt1 using @l;
+a
+1
+2
+3
+set @l=0;
+execute stmt1 using @l;
+a
+deallocate prepare stmt1;
+drop table t10, t12;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result
index 61caa0f1fbe..203dbee6374 100644
--- a/mysql-test/main/subselect_sj_mat.result
+++ b/mysql-test/main/subselect_sj_mat.result
@@ -2320,7 +2320,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
Warnings:
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
-Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(/* select#2 */ select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3`))
+Note 1003 /* select#1 */ select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(/* select#2 */ select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where `test`.`t3`.`i3` = `test`.`t2`.`i2` and `test`.`t1`.`f1` = `test`.`t3`.`f3` limit 1))
# this checks the result set above
set optimizer_switch= 'materialization=off,semijoin=off';
SELECT * FROM t1
diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result
index 6ec1e35b0b7..ad7341a2a5c 100644
--- a/mysql-test/main/system_mysql_db_fix40123.result
+++ b/mysql-test/main/system_mysql_db_fix40123.result
@@ -1,10 +1,16 @@
use test;
set storage_engine=myisam;
CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
@@ -15,10 +21,20 @@ CREATE TABLE help_category ( help_category_id smallint unsigned not null, name v
CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name varchar(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+Warnings:
+Warning 1280 Name 'Name' ignored for PRIMARY key.
CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+Warnings:
+Warning 1280 Name 'TzId' ignored for PRIMARY key.
CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+Warnings:
+Warning 1280 Name 'TzIdTranTime' ignored for PRIMARY key.
CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+Warnings:
+Warning 1280 Name 'TzIdTrTId' ignored for PRIMARY key.
CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+Warnings:
+Warning 1280 Name 'TranTime' ignored for PRIMARY key.
show tables;
Tables_in_db
column_stats
diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result
index 9f2729b86d1..842f9aca087 100644
--- a/mysql-test/main/system_mysql_db_fix50030.result
+++ b/mysql-test/main/system_mysql_db_fix50030.result
@@ -1,10 +1,16 @@
use test;
set storage_engine=myisam;
CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+Warnings:
+Warning 1280 Name 'Host' ignored for PRIMARY key.
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0, 0);
CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
@@ -15,10 +21,20 @@ CREATE TABLE help_category ( help_category_id smallint unsigned not null, name c
CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+Warnings:
+Warning 1280 Name 'Name' ignored for PRIMARY key.
CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+Warnings:
+Warning 1280 Name 'TzId' ignored for PRIMARY key.
CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+Warnings:
+Warning 1280 Name 'TzIdTranTime' ignored for PRIMARY key.
CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+Warnings:
+Warning 1280 Name 'TzIdTrTId' ignored for PRIMARY key.
CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+Warnings:
+Warning 1280 Name 'TranTime' ignored for PRIMARY key.
CREATE TABLE proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob DEFAULT '' NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob DEFAULT '' NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
CREATE TABLE servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result
index 08f334e9bcc..078cdcbbe03 100644
--- a/mysql-test/main/system_mysql_db_fix50117.result
+++ b/mysql-test/main/system_mysql_db_fix50117.result
@@ -1,24 +1,24 @@
use test;
-CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl char(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='MySQL plugins';
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
-CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
-CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
-CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
-CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
-CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
-CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
-CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
+CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
show tables;
Tables_in_db
column_stats
diff --git a/mysql-test/main/system_mysql_db_fix50117.test b/mysql-test/main/system_mysql_db_fix50117.test
index 9755415c6e4..28b8621a638 100644
--- a/mysql-test/main/system_mysql_db_fix50117.test
+++ b/mysql-test/main/system_mysql_db_fix50117.test
@@ -22,26 +22,26 @@ if (!$MYSQL_FIX_PRIVILEGE_TABLES)
use test;
# create system tables as in mysql-5.1.17
-CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
+CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
+CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl char(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='MySQL plugins';
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
-CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
+CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
-CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
+CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
-CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
-CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
-CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
-CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
-CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
+CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
+CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
+CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
+CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
+CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
+CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
+CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
-- disable_result_log
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result
index c5c892b5e4d..a9d17b8eb83 100644
--- a/mysql-test/main/type_date.result
+++ b/mysql-test/main/type_date.result
@@ -1025,5 +1025,20 @@ INSERT INTO t1 SELECT * FROM t2;
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
#
+# MDEV-19301 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed
+#
+SELECT NULLIF(CAST(1012.5 AS DATE), 1);
+NULLIF(CAST(1012.5 AS DATE), 1)
+2000-10-12
+Warnings:
+Note 1292 Truncated incorrect date value: '1012.5'
+Warning 1292 Truncated incorrect datetime value: '1'
+Note 1292 Truncated incorrect date value: '1012.5'
+SELECT CAST(1012.5 AS DATE) * 1.0;
+CAST(1012.5 AS DATE) * 1.0
+20001012.0
+Warnings:
+Note 1292 Truncated incorrect date value: '1012.5'
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test
index 4639c004740..d795a01fd36 100644
--- a/mysql-test/main/type_date.test
+++ b/mysql-test/main/type_date.test
@@ -692,5 +692,13 @@ SET sql_mode=DEFAULT;
--echo #
+--echo # MDEV-19301 Assertion `!is_valid_datetime() || fraction_remainder(((item->decimals) < (6) ? (item->decimals) : (6))) == 0' failed in Datetime_truncation_not_needed::Datetime_truncation_not_needed
+--echo #
+
+SELECT NULLIF(CAST(1012.5 AS DATE), 1);
+SELECT CAST(1012.5 AS DATE) * 1.0;
+
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result
index 1a76f438d48..dfdff29f083 100644
--- a/mysql-test/main/type_int.result
+++ b/mysql-test/main/type_int.result
@@ -236,6 +236,19 @@ DROP FUNCTION sint32;
DROP FUNCTION uint64;
DROP FUNCTION sint64;
#
+# MDEV-20285 Wrong result on INSERT..SELECT when converting from SIGNED to UNSIGNED
+#
+CREATE TABLE t1 (a TINYINT UNSIGNED);
+CREATE TABLE t2 (a TINYINT);
+INSERT INTO t1 VALUES (255);
+INSERT IGNORE INTO t2 SELECT a FROM t1;
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT * FROM t2;
+a
+127
+DROP TABLE t1, t2;
+#
# End of 10.3 tests
#
#
diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test
index 96b07bb8759..ea662254efb 100644
--- a/mysql-test/main/type_int.test
+++ b/mysql-test/main/type_int.test
@@ -177,6 +177,17 @@ DROP FUNCTION uint64;
DROP FUNCTION sint64;
--echo #
+--echo # MDEV-20285 Wrong result on INSERT..SELECT when converting from SIGNED to UNSIGNED
+--echo #
+
+CREATE TABLE t1 (a TINYINT UNSIGNED);
+CREATE TABLE t2 (a TINYINT);
+INSERT INTO t1 VALUES (255);
+INSERT IGNORE INTO t2 SELECT a FROM t1;
+SELECT * FROM t2;
+DROP TABLE t1, t2;
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/type_temporal_innodb.result b/mysql-test/main/type_temporal_innodb.result
index 55b398b3b02..2aad1e02d02 100644
--- a/mysql-test/main/type_temporal_innodb.result
+++ b/mysql-test/main/type_temporal_innodb.result
@@ -172,3 +172,16 @@ CREATE TABLE tbl SELECT * FROM t1 WHERE t1.c1 = (SELECT c2 FROM t2 WHERE pk = 6)
ERROR 22007: Truncated incorrect datetime value: '0000-00-00 00:00:00'
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
+#
+# MDEV-19166 Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv
+#
+CREATE TABLE t1 (f TIMESTAMP DEFAULT 0) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('2024-02-29');
+SELECT * FROM t1 WHERE SUBSTR(1 FROM BIT_LENGTH(f) FOR DEFAULT(f));
+f
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+DROP TABLE t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/type_temporal_innodb.test b/mysql-test/main/type_temporal_innodb.test
index 3debb798018..b8c7720f8b6 100644
--- a/mysql-test/main/type_temporal_innodb.test
+++ b/mysql-test/main/type_temporal_innodb.test
@@ -81,3 +81,18 @@ CREATE TABLE tbl SELECT * FROM t1 WHERE t1.c1 = (SELECT c2 FROM t2 WHERE pk = 6)
# ^^^ there is no column c2 in table t2
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
+
+
+--echo #
+--echo # MDEV-19166 Assertion `!is_zero_datetime()' failed in Timestamp_or_zero_datetime::tv
+--echo #
+
+CREATE TABLE t1 (f TIMESTAMP DEFAULT 0) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('2024-02-29');
+SELECT * FROM t1 WHERE SUBSTR(1 FROM BIT_LENGTH(f) FOR DEFAULT(f));
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index fdaf0baa02a..fe90989f3b0 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -5736,6 +5736,21 @@ t37, t38, t39, t40, t41, t42, t43, t44, t45,
t46, t47, t48, t49, t50, t51, t52, t53, t54,
t55, t56, t57, t58, t59,t60;
drop view v60;
+#
+# MDEV-15572: view.test, server crash with --big-tables=1
+#
+set @save_big_tables=@@big_tables;
+set big_tables=ON;
+CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int);
+CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int);
+CREATE VIEW v1 AS
+SELECT t2.f1, t1.f2, t2.f3, t2.f4 FROM (t1 JOIN t2);
+REPLACE INTO v1 (f1, f2, f3, f4)
+SELECT f1, f2, f3, f4 FROM t1;
+ERROR HY000: Can not modify more than one base table through a join view 'test.v1'
+drop view v1;
+drop table t1, t2;
+set big_tables=@save_big_tables;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index ce8ac8dec48..ccf9bcc8c9a 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -5624,6 +5624,26 @@ t46, t47, t48, t49, t50, t51, t52, t53, t54,
t55, t56, t57, t58, t59,t60;
drop view v60;
+--echo #
+--echo # MDEV-15572: view.test, server crash with --big-tables=1
+--echo #
+
+set @save_big_tables=@@big_tables;
+set big_tables=ON;
+CREATE TABLE t1 ( f1 int , f2 int , f3 int , f4 int);
+CREATE TABLE t2 ( f1 int , f2 int , f3 int , f4 int);
+
+CREATE VIEW v1 AS
+ SELECT t2.f1, t1.f2, t2.f3, t2.f4 FROM (t1 JOIN t2);
+
+--error ER_VIEW_MULTIUPDATE
+REPLACE INTO v1 (f1, f2, f3, f4)
+ SELECT f1, f2, f3, f4 FROM t1;
+
+drop view v1;
+drop table t1, t2;
+set big_tables=@save_big_tables;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/main/view_alias.result b/mysql-test/main/view_alias.result
index f3ae7aef3a6..384deeb2b99 100644
--- a/mysql-test/main/view_alias.result
+++ b/mysql-test/main/view_alias.result
@@ -90,23 +90,23 @@ CREATE TABLE t2 LIKE t1;
# Test alias in subquery
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0);
DROP VIEW v1;
-CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where `b`.`a` = 0);
+CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select 1 from `test`.`t2` `b` where `b`.`a` = 0 limit 1);
DROP VIEW v1;
# Test column alias in subquery
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias);
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select `t1`.`a` AS `alias` from `t1` group by `t1`.`a`) latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select `t1`.`a` AS `alias` from `t1` group by `t1`.`a` limit 1) latin1 latin1_swedish_ci
DROP VIEW v1;
-CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t1`.`a` AS `alias` from `test`.`t1` group by `test`.`t1`.`a`);
+CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t1`.`a` AS `alias` from `test`.`t1` group by `test`.`t1`.`a` limit 1);
DROP VIEW v1;
# Alias as the expression column name.
CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT ' a ' AS alias FROM t1 GROUP BY alias);
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select ' a ' AS `alias` from `t1` group by ' a ') latin1 latin1_swedish_ci
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where exists(select ' a ' AS `alias` from `t1` group by ' a ' limit 1) latin1 latin1_swedish_ci
DROP VIEW v1;
-CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select ' a ' AS `alias` from `test`.`t1` group by ' a ');
+CREATE VIEW v1 AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select ' a ' AS `alias` from `test`.`t1` group by ' a ' limit 1);
DROP VIEW v1;
DROP TABLE t1, t2;
create view v1 as select interval(55,10) as my_col;
diff --git a/mysql-test/main/warnings.result b/mysql-test/main/warnings.result
index db3ef5f17d2..aa4cab37741 100644
--- a/mysql-test/main/warnings.result
+++ b/mysql-test/main/warnings.result
@@ -115,6 +115,7 @@ insert ignore into t2 select b,c from t1;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2
+Warning 1264 Out of range value for column 'a' at row 3
Warning 1265 Data truncated for column 'b' at row 3
Warning 1048 Column 'a' cannot be null
Warning 1265 Data truncated for column 'b' at row 4
diff --git a/mysql-test/main/win_percentile.result b/mysql-test/main/win_percentile.result
index 4a918bad17f..a2ca775fcfb 100644
--- a/mysql-test/main/win_percentile.result
+++ b/mysql-test/main/win_percentile.result
@@ -36,23 +36,23 @@ Tata 4.0000000000
Tatiana 4.0000000000
select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
name c
-Chun 3.0000000000
-Chun 3.0000000000
-Kaolin 4.0000000000
-Kaolin 4.0000000000
-Kaolin 4.0000000000
-Tata 4.0000000000
-Tatiana 4.0000000000
+Chun 3.0000
+Chun 3.0000
+Kaolin 4.0000
+Kaolin 4.0000
+Kaolin 4.0000
+Tata 4.0000
+Tatiana 4.0000
# no partition clause
select name, percentile_disc(0.5) within group(order by score) over () from t1;
name percentile_disc(0.5) within group(order by score) over ()
-Chun 4.0000000000
-Chun 4.0000000000
-Kaolin 4.0000000000
-Kaolin 4.0000000000
-Kaolin 4.0000000000
-Tata 4.0000000000
-Tatiana 4.0000000000
+Chun 4.0000
+Chun 4.0000
+Kaolin 4.0000
+Kaolin 4.0000
+Kaolin 4.0000
+Tata 4.0000
+Tatiana 4.0000
select name, percentile_cont(0.5) within group(order by score) over () from t1;
name percentile_cont(0.5) within group(order by score) over ()
Chun 4.0000000000
@@ -79,13 +79,13 @@ Tata 4.0000000000
Tatiana 4.0000000000
select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t;
name percentile_disc(0.5) within group ( order by score) over (partition by name )
-Chun 3.0000000000
-Chun 3.0000000000
-Kaolin 4.0000000000
-Kaolin 4.0000000000
-Kaolin 4.0000000000
-Tata 4.0000000000
-Tatiana 4.0000000000
+Chun 3.0000
+Chun 3.0000
+Kaolin 4.0000
+Kaolin 4.0000
+Kaolin 4.0000
+Tata 4.0000
+Tatiana 4.0000
select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5;
name
Chun
@@ -118,13 +118,13 @@ ERROR HY000: percentile_disc function only accepts arguments that can be convert
#complete query with partition column
select name,cume_dist() over (partition by name order by score), percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
name cume_dist() over (partition by name order by score) c
-Chun 0.5000000000 3.0000000000
-Chun 1.0000000000 3.0000000000
-Kaolin 0.3333333333 4.0000000000
-Kaolin 0.6666666667 4.0000000000
-Kaolin 1.0000000000 4.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 3.0000
+Chun 1.0000000000 3.0000
+Kaolin 0.3333333333 4.0000
+Kaolin 0.6666666667 4.0000
+Kaolin 1.0000000000 4.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1;
name c
Chun 5.0000000000
@@ -136,94 +136,94 @@ Tata 4.0000000000
Tatiana 4.0000000000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.1) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 3.0000000000
-Chun 1.0000000000 3.0000000000
-Kaolin 0.3333333333 3.0000000000
-Kaolin 0.6666666667 3.0000000000
-Kaolin 1.0000000000 3.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 3.0000
+Chun 1.0000000000 3.0000
+Kaolin 0.3333333333 3.0000
+Kaolin 0.6666666667 3.0000
+Kaolin 1.0000000000 3.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.2) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 3.0000000000
-Chun 1.0000000000 3.0000000000
-Kaolin 0.3333333333 3.0000000000
-Kaolin 0.6666666667 3.0000000000
-Kaolin 1.0000000000 3.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 3.0000
+Chun 1.0000000000 3.0000
+Kaolin 0.3333333333 3.0000
+Kaolin 0.6666666667 3.0000
+Kaolin 1.0000000000 3.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.3) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 3.0000000000
-Chun 1.0000000000 3.0000000000
-Kaolin 0.3333333333 3.0000000000
-Kaolin 0.6666666667 3.0000000000
-Kaolin 1.0000000000 3.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 3.0000
+Chun 1.0000000000 3.0000
+Kaolin 0.3333333333 3.0000
+Kaolin 0.6666666667 3.0000
+Kaolin 1.0000000000 3.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.4) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 3.0000000000
-Chun 1.0000000000 3.0000000000
-Kaolin 0.3333333333 4.0000000000
-Kaolin 0.6666666667 4.0000000000
-Kaolin 1.0000000000 4.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 3.0000
+Chun 1.0000000000 3.0000
+Kaolin 0.3333333333 4.0000
+Kaolin 0.6666666667 4.0000
+Kaolin 1.0000000000 4.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 3.0000000000
-Chun 1.0000000000 3.0000000000
-Kaolin 0.3333333333 4.0000000000
-Kaolin 0.6666666667 4.0000000000
-Kaolin 1.0000000000 4.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 3.0000
+Chun 1.0000000000 3.0000
+Kaolin 0.3333333333 4.0000
+Kaolin 0.6666666667 4.0000
+Kaolin 1.0000000000 4.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.6) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 7.0000000000
-Chun 1.0000000000 7.0000000000
-Kaolin 0.3333333333 4.0000000000
-Kaolin 0.6666666667 4.0000000000
-Kaolin 1.0000000000 4.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 7.0000
+Chun 1.0000000000 7.0000
+Kaolin 0.3333333333 4.0000
+Kaolin 0.6666666667 4.0000
+Kaolin 1.0000000000 4.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.7) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 7.0000000000
-Chun 1.0000000000 7.0000000000
-Kaolin 0.3333333333 7.0000000000
-Kaolin 0.6666666667 7.0000000000
-Kaolin 1.0000000000 7.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 7.0000
+Chun 1.0000000000 7.0000
+Kaolin 0.3333333333 7.0000
+Kaolin 0.6666666667 7.0000
+Kaolin 1.0000000000 7.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.8) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 7.0000000000
-Chun 1.0000000000 7.0000000000
-Kaolin 0.3333333333 7.0000000000
-Kaolin 0.6666666667 7.0000000000
-Kaolin 1.0000000000 7.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 7.0000
+Chun 1.0000000000 7.0000
+Kaolin 0.3333333333 7.0000
+Kaolin 0.6666666667 7.0000
+Kaolin 1.0000000000 7.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.9) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 7.0000000000
-Chun 1.0000000000 7.0000000000
-Kaolin 0.3333333333 7.0000000000
-Kaolin 0.6666666667 7.0000000000
-Kaolin 1.0000000000 7.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 7.0000
+Chun 1.0000000000 7.0000
+Kaolin 0.3333333333 7.0000
+Kaolin 0.6666666667 7.0000
+Kaolin 1.0000000000 7.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select name,cume_dist() over (partition by name order by score) as b, percentile_disc(1) within group(order by score) over (partition by name) as c from t1;
name b c
-Chun 0.5000000000 7.0000000000
-Chun 1.0000000000 7.0000000000
-Kaolin 0.3333333333 7.0000000000
-Kaolin 0.6666666667 7.0000000000
-Kaolin 1.0000000000 7.0000000000
-Tata 1.0000000000 4.0000000000
-Tatiana 1.0000000000 4.0000000000
+Chun 0.5000000000 7.0000
+Chun 1.0000000000 7.0000
+Kaolin 0.3333333333 7.0000
+Kaolin 0.6666666667 7.0000
+Kaolin 1.0000000000 7.0000
+Tata 1.0000000000 4.0000
+Tatiana 1.0000000000 4.0000
select median(score) over (partition by name), percentile_cont(0) within group(order by score) over (partition by name) as c from t1;
median(score) over (partition by name) c
5.0000000000 3.0000000000
@@ -366,3 +366,102 @@ median(val) OVER ()
2.0000000000
drop table t1;
drop view v1;
+#
+# MDEV-20278 PERCENTILE_DISC() returns a wrong data type
+#
+# INT variants
+CREATE TABLE t1 (name CHAR(30), star_rating INT);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 5);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
+INSERT INTO t1 VALUES ('Lady of the Flies', 1);
+INSERT INTO t1 VALUES ('Lady of the Flies', 2);
+INSERT INTO t1 VALUES ('Lady of the Flies', 5);
+CREATE OR REPLACE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+WITHIN GROUP (ORDER BY star_rating)
+OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `name` char(30) DEFAULT NULL,
+ `pc` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2, t1;
+# UNSIGNED INT variants
+CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating BIGINT UNSIGNED);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 0x8000000000000005);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 0x8000000000000003);
+INSERT INTO t1 VALUES ('Lady of the Flies', 0x8000000000000001);
+INSERT INTO t1 VALUES ('Lady of the Flies', 0x8000000000000002);
+INSERT INTO t1 VALUES ('Lady of the Flies', 0x8000000000000003);
+CREATE OR REPLACE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+WITHIN GROUP (ORDER BY star_rating)
+OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `name` char(30) DEFAULT NULL,
+ `pc` bigint(20) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT name, pc, HEX(pc) FROM t2 ORDER BY name, pc;
+name pc HEX(pc)
+Lady of the Flies 9223372036854775810 8000000000000002
+Lady of the Flies 9223372036854775810 8000000000000002
+Lady of the Flies 9223372036854775810 8000000000000002
+Lord of the Ladybirds 9223372036854775811 8000000000000003
+Lord of the Ladybirds 9223372036854775811 8000000000000003
+DROP TABLE t2, t1;
+# FLOAT variants
+CREATE TABLE t1 (name CHAR(30), star_rating FLOAT);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 5);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
+INSERT INTO t1 VALUES ('Lady of the Flies', 1);
+INSERT INTO t1 VALUES ('Lady of the Flies', 2);
+INSERT INTO t1 VALUES ('Lady of the Flies', 5);
+CREATE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+WITHIN GROUP (ORDER BY star_rating)
+OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `name` char(30) DEFAULT NULL,
+ `pc` float DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2, t1;
+# DECIMAL variants
+CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating DECIMAL(30,2));
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 50000000000);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 30000000000);
+INSERT INTO t1 VALUES ('Lady of the Flies', 10000000000);
+INSERT INTO t1 VALUES ('Lady of the Flies', 20000000000);
+INSERT INTO t1 VALUES ('Lady of the Flies', 50000000000);
+CREATE OR REPLACE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+WITHIN GROUP (ORDER BY star_rating)
+OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `name` char(30) DEFAULT NULL,
+ `pc` decimal(30,2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2 ORDER BY name, pc;
+name pc
+Lady of the Flies 20000000000.00
+Lady of the Flies 20000000000.00
+Lady of the Flies 20000000000.00
+Lord of the Ladybirds 30000000000.00
+Lord of the Ladybirds 30000000000.00
+DROP TABLE t2, t1;
+#
+# MDEV-20272 PERCENTILE_DISC() crashes on a temporal type input
+#
+CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 5);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
+INSERT INTO t1 VALUES ('Lady of the Flies', 1);
+INSERT INTO t1 VALUES ('Lady of the Flies', 2);
+INSERT INTO t1 VALUES ('Lady of the Flies', 5);
+SELECT name, PERCENTILE_DISC(0.5)
+WITHIN GROUP (ORDER BY star_rating)
+OVER (PARTITION BY name) AS pc FROM t1;
+ERROR HY000: Numeric datatype is required for percentile_disc function
+DROP TABLE t1;
diff --git a/mysql-test/main/win_percentile.test b/mysql-test/main/win_percentile.test
index d36b365dd9b..8705be123ff 100644
--- a/mysql-test/main/win_percentile.test
+++ b/mysql-test/main/win_percentile.test
@@ -146,3 +146,83 @@ select * from v1;
select median(val) OVER () FROM t1;
drop table t1;
drop view v1;
+
+
+--echo #
+--echo # MDEV-20278 PERCENTILE_DISC() returns a wrong data type
+--echo #
+
+--echo # INT variants
+
+CREATE TABLE t1 (name CHAR(30), star_rating INT);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 5);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
+INSERT INTO t1 VALUES ('Lady of the Flies', 1);
+INSERT INTO t1 VALUES ('Lady of the Flies', 2);
+INSERT INTO t1 VALUES ('Lady of the Flies', 5);
+CREATE OR REPLACE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2, t1;
+
+--echo # UNSIGNED INT variants
+
+CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating BIGINT UNSIGNED);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 0x8000000000000005);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 0x8000000000000003);
+INSERT INTO t1 VALUES ('Lady of the Flies', 0x8000000000000001);
+INSERT INTO t1 VALUES ('Lady of the Flies', 0x8000000000000002);
+INSERT INTO t1 VALUES ('Lady of the Flies', 0x8000000000000003);
+CREATE OR REPLACE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+SELECT name, pc, HEX(pc) FROM t2 ORDER BY name, pc;
+DROP TABLE t2, t1;
+
+--echo # FLOAT variants
+
+CREATE TABLE t1 (name CHAR(30), star_rating FLOAT);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 5);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
+INSERT INTO t1 VALUES ('Lady of the Flies', 1);
+INSERT INTO t1 VALUES ('Lady of the Flies', 2);
+INSERT INTO t1 VALUES ('Lady of the Flies', 5);
+CREATE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2, t1;
+
+--echo # DECIMAL variants
+
+CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating DECIMAL(30,2));
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 50000000000);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 30000000000);
+INSERT INTO t1 VALUES ('Lady of the Flies', 10000000000);
+INSERT INTO t1 VALUES ('Lady of the Flies', 20000000000);
+INSERT INTO t1 VALUES ('Lady of the Flies', 50000000000);
+CREATE OR REPLACE TABLE t2 AS SELECT name, PERCENTILE_DISC(0.5)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2 ORDER BY name, pc;
+DROP TABLE t2, t1;
+
+
+--echo #
+--echo # MDEV-20272 PERCENTILE_DISC() crashes on a temporal type input
+--echo #
+
+CREATE OR REPLACE TABLE t1 (name CHAR(30), star_rating TIME);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 5);
+INSERT INTO t1 VALUES ('Lord of the Ladybirds', 3);
+INSERT INTO t1 VALUES ('Lady of the Flies', 1);
+INSERT INTO t1 VALUES ('Lady of the Flies', 2);
+INSERT INTO t1 VALUES ('Lady of the Flies', 5);
+--error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC
+SELECT name, PERCENTILE_DISC(0.5)
+ WITHIN GROUP (ORDER BY star_rating)
+ OVER (PARTITION BY name) AS pc FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/include/drop_temp_table.test b/mysql-test/suite/binlog/include/drop_temp_table.test
index 4241974d813..9139ac76017 100644
--- a/mysql-test/suite/binlog/include/drop_temp_table.test
+++ b/mysql-test/suite/binlog/include/drop_temp_table.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--disable_warnings
DROP DATABASE IF EXISTS `drop-temp+table-test`;
@@ -104,3 +105,72 @@ RESET MASTER;
DROP TABLE t1;
# End of 4.1 tests
+
+
+--echo #
+--echo # BUG#28642318: POINT IN TIME RECOVERY USING MYSQLBINLOG BROKEN
+--echo # WITH TEMPORARY TABLE -> ERRORS
+
+--echo # Test case for DELETE query.
+
+RESET MASTER;
+connect (con1,localhost,root,,);
+
+--echo # Set up.
+--connection default
+--disable_warnings
+SET @save_binlog_format= @@session.binlog_format;
+SET @@session.binlog_format=STATEMENT;
+let $MYSQLD_DATADIR= `select @@datadir`;
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+
+--connection con1
+SET @@session.binlog_format=STATEMENT;
+CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
+
+--connection default
+DELETE d1, d2 FROM t1 AS d1, t1 AS d2 WHERE d1.a<>d2.a;
+
+--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug28642318.sql
+
+--connection default
+DROP TABLE t1;
+
+--echo # DELETE query fails with table re-open error without patch.
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug28642318.sql
+
+--echo # Clean up.
+--connection con1
+DROP TABLE IF EXISTS t1;
+
+--connection default
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+
+--echo # Test case for DROP query.
+
+--connection default
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+
+--connection con1
+CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
+
+--connection default
+DROP TABLE t1;
+
+--connection con1
+DROP TABLE t1;
+
+--connection default
+--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug28642318.sql
+
+--echo # DROP table query fails with unknown table error without patch.
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug28642318.sql
+
+--echo # Clean up
+--connection default
+SET @@session.binlog_format= @save_binlog_format;
+RESET MASTER;
+
+--disconnect con1
+--enable_warnings
diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
index 831a1c8a9a3..60596be480f 100644
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
@@ -61,3 +61,44 @@ master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
RESET MASTER;
DROP TABLE t1;
+#
+# BUG#28642318: POINT IN TIME RECOVERY USING MYSQLBINLOG BROKEN
+# WITH TEMPORARY TABLE -> ERRORS
+# Test case for DELETE query.
+RESET MASTER;
+connect con1,localhost,root,,;
+# Set up.
+connection default;
+SET @save_binlog_format= @@session.binlog_format;
+SET @@session.binlog_format=STATEMENT;
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+connection con1;
+SET @@session.binlog_format=STATEMENT;
+CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
+connection default;
+DELETE d1, d2 FROM t1 AS d1, t1 AS d2 WHERE d1.a<>d2.a;
+connection default;
+DROP TABLE t1;
+# DELETE query fails with table re-open error without patch.
+# Clean up.
+connection con1;
+DROP TABLE IF EXISTS t1;
+connection default;
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+# Test case for DROP query.
+connection default;
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+connection con1;
+CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
+connection default;
+DROP TABLE t1;
+connection con1;
+DROP TABLE t1;
+connection default;
+# DROP table query fails with unknown table error without patch.
+# Clean up
+connection default;
+SET @@session.binlog_format= @save_binlog_format;
+RESET MASTER;
+disconnect con1;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
index 4bca7cbe298..ae7852be9e3 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
@@ -89,3 +89,44 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
RESET MASTER;
DROP TABLE t1;
+#
+# BUG#28642318: POINT IN TIME RECOVERY USING MYSQLBINLOG BROKEN
+# WITH TEMPORARY TABLE -> ERRORS
+# Test case for DELETE query.
+RESET MASTER;
+connect con1,localhost,root,,;
+# Set up.
+connection default;
+SET @save_binlog_format= @@session.binlog_format;
+SET @@session.binlog_format=STATEMENT;
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+connection con1;
+SET @@session.binlog_format=STATEMENT;
+CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
+connection default;
+DELETE d1, d2 FROM t1 AS d1, t1 AS d2 WHERE d1.a<>d2.a;
+connection default;
+DROP TABLE t1;
+# DELETE query fails with table re-open error without patch.
+# Clean up.
+connection con1;
+DROP TABLE IF EXISTS t1;
+connection default;
+DROP TABLE IF EXISTS t1;
+RESET MASTER;
+# Test case for DROP query.
+connection default;
+CREATE TABLE t1 (a INT) ENGINE=INNODB;
+connection con1;
+CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
+connection default;
+DROP TABLE t1;
+connection con1;
+DROP TABLE t1;
+connection default;
+# DROP table query fails with unknown table error without patch.
+# Clean up
+connection default;
+SET @@session.binlog_format= @save_binlog_format;
+RESET MASTER;
+disconnect con1;
diff --git a/mysql-test/suite/binlog_encryption/multisource.result b/mysql-test/suite/binlog_encryption/multisource.result
index d99a377f0c5..928c9799854 100644
--- a/mysql-test/suite/binlog_encryption/multisource.result
+++ b/mysql-test/suite/binlog_encryption/multisource.result
@@ -47,6 +47,8 @@ drop database if exists db1;
create database db1;
use db1;
create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
insert into t1 (f1) values ('one'),('two');
connection slave;
select * from db1.t1;
diff --git a/mysql-test/suite/compat/oracle/r/column_compression.result b/mysql-test/suite/compat/oracle/r/column_compression.result
index 4eb55f47e51..8f643ad2a06 100644
--- a/mysql-test/suite/compat/oracle/r/column_compression.result
+++ b/mysql-test/suite/compat/oracle/r/column_compression.result
@@ -515,7 +515,7 @@ CREATE TABLE t1 (a TEXT COMPRESSED BYTE);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "a" blob /*!100301 COMPRESSED*/ DEFAULT NULL
+ "a" blob(65535) /*!100301 COMPRESSED*/ DEFAULT NULL
)
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COMPRESSED ASCII);
@@ -547,7 +547,7 @@ CREATE TABLE t1 (a TEXT COMPRESSED BYTE DEFAULT '');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "a" blob /*!100301 COMPRESSED*/ DEFAULT ''
+ "a" blob(65535) /*!100301 COMPRESSED*/ DEFAULT ''
)
DROP TABLE t1;
CREATE TABLE t1 (a TEXT COMPRESSED BINARY DEFAULT '');
@@ -605,7 +605,7 @@ Warning 1287 '<data type> <character set clause> ... COMPRESSED...' is deprecate
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
- "a" blob /*!100301 COMPRESSED*/ DEFAULT NULL
+ "a" blob(65535) /*!100301 COMPRESSED*/ DEFAULT NULL
)
DROP TABLE t1;
#
diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result
index 1d088a98ab7..6bcdf520edb 100644
--- a/mysql-test/suite/compat/oracle/r/sp.result
+++ b/mysql-test/suite/compat/oracle/r/sp.result
@@ -2064,7 +2064,7 @@ t1 CREATE TABLE "t1" (
"tables_table_name" varchar(64) CHARACTER SET utf8 DEFAULT NULL,
"tables_table_rows" bigint(21) unsigned DEFAULT NULL,
"processlist_info" longtext CHARACTER SET utf8 DEFAULT NULL,
- "processlist_info_binary" blob DEFAULT NULL
+ "processlist_info_binary" blob(65535) DEFAULT NULL
)
DROP TABLE t1;
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/r/type_blob.result b/mysql-test/suite/compat/oracle/r/type_blob.result
index fe0a78e6ceb..27740947a10 100644
--- a/mysql-test/suite/compat/oracle/r/type_blob.result
+++ b/mysql-test/suite/compat/oracle/r/type_blob.result
@@ -6,3 +6,21 @@ t1 CREATE TABLE "t1" (
"a" longblob DEFAULT NULL
)
DROP TABLE t1;
+#
+# MDEV-20263 sql_mode=ORACLE: BLOB(65535) should not translate to LONGBLOB
+#
+CREATE TABLE t1 (
+c1 BLOB(100),
+c2 BLOB(65535),
+c3 BLOB(16777215),
+c4 BLOB(16777216)
+);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "c1" tinyblob DEFAULT NULL,
+ "c2" blob(65535) DEFAULT NULL,
+ "c3" mediumblob DEFAULT NULL,
+ "c4" longblob DEFAULT NULL
+)
+DROP TABLE t1;
diff --git a/mysql-test/suite/compat/oracle/t/type_blob.test b/mysql-test/suite/compat/oracle/t/type_blob.test
index 2bfaa77560d..989581ee4f6 100644
--- a/mysql-test/suite/compat/oracle/t/type_blob.test
+++ b/mysql-test/suite/compat/oracle/t/type_blob.test
@@ -2,3 +2,16 @@ SET sql_mode=ORACLE;
CREATE TABLE t1 (a BLOB);
SHOW CREATE TABLE t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20263 sql_mode=ORACLE: BLOB(65535) should not translate to LONGBLOB
+--echo #
+
+CREATE TABLE t1 (
+ c1 BLOB(100),
+ c2 BLOB(65535),
+ c3 BLOB(16777215),
+ c4 BLOB(16777216)
+);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/GAL-382.result b/mysql-test/suite/galera/r/GAL-382.result
index 137efe4efba..2150326757c 100644
--- a/mysql-test/suite/galera/r/GAL-382.result
+++ b/mysql-test/suite/galera/r/GAL-382.result
@@ -2,8 +2,12 @@ connection node_2;
connection node_1;
connection node_1;
create table t1 (i int, j int, k int, primary key pk(i)) engine=innodb;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
create table t2 (i int, j int, k int, primary key pk(i, j, k), index idx(i, k, j)) engine=innodb;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
replace into t2 (i, j, k) select /*!99997 */ i, k, j from t1;
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/suite/galera/t/MW-336.test b/mysql-test/suite/galera/t/MW-336.test
index b6df78ac7a6..ee57457b0e7 100644
--- a/mysql-test/suite/galera/t/MW-336.test
+++ b/mysql-test/suite/galera/t/MW-336.test
@@ -13,7 +13,7 @@ SET GLOBAL wsrep_slave_threads = 10;
# ensure that the threads have actually started running
--echo # Set slave threads to 10 step 1
---let $wait_condition = SELECT COUNT(*) = 10 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
+--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
@@ -29,14 +29,14 @@ SELECT COUNT(*) FROM t1;
SET GLOBAL wsrep_slave_threads = 10;
--echo # Set slave threads to 10 step 2
---let $wait_condition = SELECT COUNT(*) = 10 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
+--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
SET GLOBAL wsrep_slave_threads = 20;
--echo # Set slave threads to 20
---let $wait_condition = SELECT COUNT(*) = 20 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
+--let $wait_condition = SELECT VARIABLE_VALUE = 20 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--let $wait_condition_on_error_output = SELECT COUNT(*), 20 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
@@ -58,7 +58,7 @@ INSERT INTO t1 VALUES (10);
SET GLOBAL wsrep_slave_threads = 10;
SELECT COUNT(*) FROM t1;
--echo # Set slave threads to 10 step 3
---let $wait_condition = SELECT COUNT(*) = 10 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
+--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index a8271dabe6f..ebc5391dbea 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -621,6 +621,135 @@ c1 c2
3 3
4 4
DROP TABLE t1;
+#
+# Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS
+#
+# This test shows that the next record to be inserted is not affected
+# by a change in auto_increment_increment.
+# In addition, current value of auto_increment_increment by the client
+# that uses the existing autoinc value with be used to set next autoinc
+# value, which will be used by next client reguardless of its own session
+# setting for auto_increment_increment.
+#
+connection default;
+# Client 1: Insert a record with auto_increment_increment=2
+CREATE TABLE t(
+a SERIAL PRIMARY KEY,
+b VARCHAR(200)) ENGINE=InnoDB;
+SET SESSION auto_increment_increment=2;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S1');
+SELECT a,b FROM t;
+a b
+1 S1
+connect con1,localhost,root,,;
+connection con1;
+# Client 2: Insert records with auto_increment_increment 2,1
+SET SESSION auto_increment_increment=2;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S2');
+SELECT a,b FROM t;
+a b
+1 S1
+3 S2
+SET SESSION auto_increment_increment=1;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S2');
+SELECT a,b FROM t;
+a b
+1 S1
+3 S2
+4 S2
+disconnect con1;
+connection default;
+# Client 1: Insert a record with auto_increment_increment=1
+SET SESSION auto_increment_increment=1;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S1');
+SELECT a,b FROM t;
+a b
+1 S1
+3 S2
+4 S2
+5 S1
+DROP TABLE t;
+# Autoincrement behaviour with mixed insert.
+CREATE TABLE t(
+a TINYINT AUTO_INCREMENT PRIMARY KEY,
+b VARCHAR(200)) ENGINE=InnoDB;
+SET SESSION auto_increment_increment=10;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S0'),('S1');
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1
+INSERT INTO t(a,b) VALUES(28,'S2');
+SET SESSION auto_increment_increment=1;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S3');
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
+INSERT INTO t(b) VALUES('S4');
+SELECT * FROM t;
+a b
+1 S0
+11 S1
+22 S3
+23 S4
+28 S2
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `b` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
+DROP TABLE t;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
DROP TABLE IF EXISTS t1;
Warnings:
diff --git a/mysql-test/suite/innodb/r/innodb-index-online-fk.result b/mysql-test/suite/innodb/r/innodb-index-online-fk.result
index 47fc8e8b840..854afd95aaf 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online-fk.result
@@ -326,6 +326,8 @@ ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
ON DELETE SET NULL ON UPDATE CASCADE,
ALGORITHM = INPLACE;
+Warnings:
+Warning 1280 Name 'idx' ignored for PRIMARY key.
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/fk_1 test/child test/parent 1 6
@@ -363,6 +365,8 @@ ALTER TABLE child ADD PRIMARY KEY idx (a1),
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
ON DELETE SET NULL ON UPDATE CASCADE,
ALGORITHM = INPLACE;
+Warnings:
+Warning 1280 Name 'idx' ignored for PRIMARY key.
SELECT * from information_schema.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/fk_1 test/child test/parent 1 6
@@ -556,6 +560,8 @@ ADD CONSTRAINT fk_new_1 FOREIGN KEY (a1) REFERENCES parent(b),
ADD CONSTRAINT fk_new_2 FOREIGN KEY (a2) REFERENCES parent(a),
ADD CONSTRAINT fk_new_3 FOREIGN KEY (a3) REFERENCES parent(a),
ALGORITHM = INPLACE;
+Warnings:
+Warning 1280 Name 'idx' ignored for PRIMARY key.
SHOW CREATE TABLE child;
Table Create Table
child CREATE TABLE `child` (
diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
index bf21e352681..4b2df7eb287 100644
--- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result
+++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result
@@ -6,6 +6,8 @@ wdraw_rsn varchar(4) NOT NULL DEFAULT '',
admit_term char(4) NOT NULL DEFAULT '',
CONSTRAINT gso_grad_supr_pky PRIMARY KEY (uw_id, term)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1280 Name 'gso_grad_supr_pky' ignored for PRIMARY key.
INSERT INTO `gso_grad_supr` VALUES ('1031',2,'CSM','','1009');
INSERT INTO `gso_grad_supr` VALUES ('1035',2,'CSM','ACAD','1009');
CREATE TABLE IF NOT EXISTS grad_degree (
@@ -23,6 +25,8 @@ deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginn
deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1280 Name 'grad_degree_stu_plan_admit_pky' ignored for PRIMARY key.
SHOW CREATE TABLE grad_degree;
Table Create Table
grad_degree CREATE TABLE `grad_degree` (
@@ -129,6 +133,8 @@ deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginn
deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1280 Name 'grad_degree_stu_plan_admit_pky' ignored for PRIMARY key.
SHOW CREATE TABLE grad_degree;
Table Create Table
grad_degree CREATE TABLE `grad_degree` (
@@ -263,6 +269,8 @@ deg_start_term char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginn
deg_as_of_term char(4) NOT NULL COMMENT 'In most cases also end term',
CONSTRAINT grad_degree_stu_plan_admit_pky PRIMARY KEY (student_id, plan, admit_term)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+Warnings:
+Warning 1280 Name 'grad_degree_stu_plan_admit_pky' ignored for PRIMARY key.
SHOW CREATE TABLE grad_degree;
Table Create Table
grad_degree CREATE TABLE `grad_degree` (
diff --git a/mysql-test/suite/innodb/r/innodb_bug51378.result b/mysql-test/suite/innodb/r/innodb_bug51378.result
index 532fd703af6..2ffd533279b 100644
--- a/mysql-test/suite/innodb/r/innodb_bug51378.result
+++ b/mysql-test/suite/innodb/r/innodb_bug51378.result
@@ -28,6 +28,8 @@ bug51378 CREATE TABLE `bug51378` (
UNIQUE KEY `idx2` (`col1`,`col2`(31))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table bug51378 add primary key idx3(col1, col2(31));
+Warnings:
+Warning 1280 Name 'idx3' ignored for PRIMARY key.
SHOW CREATE TABLE bug51378;
Table Create Table
bug51378 CREATE TABLE `bug51378` (
diff --git a/mysql-test/suite/innodb/r/innodb_bug57252.result b/mysql-test/suite/innodb/r/innodb_bug57252.result
index 2e371cb74ee..66183c2c42d 100644
--- a/mysql-test/suite/innodb/r/innodb_bug57252.result
+++ b/mysql-test/suite/innodb/r/innodb_bug57252.result
@@ -1,5 +1,5 @@
cardinality
-10
+2
Table Op Msg_type Msg_text
test.bug57252 analyze status Engine-independent statistics collected
test.bug57252 analyze status OK
diff --git a/mysql-test/suite/innodb/r/innodb_bug60229.result b/mysql-test/suite/innodb/r/innodb_bug60229.result
index a3971876193..588f3855764 100644
--- a/mysql-test/suite/innodb/r/innodb_bug60229.result
+++ b/mysql-test/suite/innodb/r/innodb_bug60229.result
@@ -4,6 +4,8 @@ DOB VARCHAR(50) NOT NULL,
NAME NVARCHAR(255) NOT NULL,
CONSTRAINT PK_PERSON PRIMARY KEY (PERSON_ID, DOB)
)Engine=InnoDB;
+Warnings:
+Warning 1280 Name 'PK_PERSON' ignored for PRIMARY key.
CREATE TABLE PHOTO (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
@@ -11,6 +13,8 @@ PHOTO_DETAILS VARCHAR(50) NULL,
CONSTRAINT PK_PHOTO PRIMARY KEY (PERSON_ID, DOB),
CONSTRAINT FK_PHOTO_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB)
)Engine=InnoDB;
+Warnings:
+Warning 1280 Name 'PK_PHOTO' ignored for PRIMARY key.
CREATE TABLE ADDRESS (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
@@ -19,6 +23,8 @@ ADDRESS_DETAILS NVARCHAR(250) NULL,
CONSTRAINT PK_ADDRESS PRIMARY KEY (PERSON_ID, DOB, ADDRESS_ID),
CONSTRAINT FK_ADDRESS_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB) ON DELETE CASCADE
)Engine=InnoDB;
+Warnings:
+Warning 1280 Name 'PK_ADDRESS' ignored for PRIMARY key.
INSERT INTO PERSON VALUES("10", "11011999", "John");
INSERT INTO PHOTO VALUES("10", "11011999", "new photo");
DROP TABLE PHOTO;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index b8f2d75c876..74a52caba12 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -381,6 +381,66 @@ INSERT INTO t1 VALUES(NULL, 4);
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug#15851528 DUPLICATE KEY ERROR ON AUTO-INC PK WITH MIXED AUTO_INCREMENT_INCREMENT CLIENTS
+--echo #
+--echo # This test shows that the next record to be inserted is not affected
+--echo # by a change in auto_increment_increment.
+--echo # In addition, current value of auto_increment_increment by the client
+--echo # that uses the existing autoinc value with be used to set next autoinc
+--echo # value, which will be used by next client reguardless of its own session
+--echo # setting for auto_increment_increment.
+--echo #
+
+--connection default
+--echo # Client 1: Insert a record with auto_increment_increment=2
+CREATE TABLE t(
+ a SERIAL PRIMARY KEY,
+ b VARCHAR(200)) ENGINE=InnoDB;
+SET SESSION auto_increment_increment=2;
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S1');
+SELECT a,b FROM t;
+--connect(con1,localhost,root,,)
+
+--connection con1
+--echo # Client 2: Insert records with auto_increment_increment 2,1
+SET SESSION auto_increment_increment=2;
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S2');
+SELECT a,b FROM t;
+SET SESSION auto_increment_increment=1;
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S2');
+SELECT a,b FROM t;
+disconnect con1;
+
+--connection default
+--echo # Client 1: Insert a record with auto_increment_increment=1
+SET SESSION auto_increment_increment=1;
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S1');
+SELECT a,b FROM t;
+DROP TABLE t;
+
+--echo # Autoincrement behaviour with mixed insert.
+CREATE TABLE t(
+ a TINYINT AUTO_INCREMENT PRIMARY KEY,
+ b VARCHAR(200)) ENGINE=InnoDB;
+SET SESSION auto_increment_increment=10;
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S0'),('S1');
+SHOW CREATE TABLE t;
+INSERT INTO t(a,b) VALUES(28,'S2');
+SET SESSION auto_increment_increment=1;
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S3');
+SHOW CREATE TABLE t;
+INSERT INTO t(b) VALUES('S4');
+SELECT * FROM t;
+SHOW CREATE TABLE t;
+DROP TABLE t;
+
#
# Bug# 42714: AUTOINC column calculated next value not greater than highest
# value stored in table.
diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result
index 927e0b9ea62..e654bc4b498 100644
--- a/mysql-test/suite/innodb_gis/r/1.result
+++ b/mysql-test/suite/innodb_gis/r/1.result
@@ -796,11 +796,15 @@ POINT(1 1)
drop function fn3;
create table t1(pt POINT);
alter table t1 add primary key pti(pt);
+Warnings:
+Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1(pt GEOMETRY);
alter table t1 add primary key pti(pt);
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20));
+Warnings:
+Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1 select ST_GeomFromText('point(1 1)');
desc t1;
diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result
index ca8c878f2a6..a769f47bf7c 100644
--- a/mysql-test/suite/innodb_gis/r/gis.result
+++ b/mysql-test/suite/innodb_gis/r/gis.result
@@ -792,11 +792,15 @@ POINT(1 1)
drop function fn3;
create table t1(pt POINT);
alter table t1 add primary key pti(pt);
+Warnings:
+Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1(pt GEOMETRY);
alter table t1 add primary key pti(pt);
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20));
+Warnings:
+Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1 select ST_GeomFromText('point(1 1)');
desc t1;
diff --git a/mysql-test/suite/innodb_zip/r/page_size.result b/mysql-test/suite/innodb_zip/r/page_size.result
index 332a59ff656..e65a57326ec 100644
--- a/mysql-test/suite/innodb_zip/r/page_size.result
+++ b/mysql-test/suite/innodb_zip/r/page_size.result
@@ -515,6 +515,8 @@ pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Redundant ENGINE=InnoDB;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
@@ -546,6 +548,8 @@ pk09,pk10,pk11,pk12,pk13,pk14,pk15,pk16),
KEY pk(sk01,sk02,sk03,sk04,sk05,sk06,sk07,sk08,
sk09,sk10,sk11,sk12,sk13,sk14,sk15,sk16))
ROW_FORMAT=Compressed KEY_BLOCK_SIZE=4 ENGINE=InnoDB;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
SET @r = repeat('a', 48);
INSERT INTO t1 VALUES(@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,
@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
diff --git a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
index 96e51e506f2..f2bbd86e9c8 100644
--- a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
+++ b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result
@@ -1070,6 +1070,8 @@ CREATE TABLE worklog5743 (
col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) ,
PRIMARY KEY `prefix_primary` (col_1_varchar(3072))
) ROW_FORMAT=DYNAMIC, engine = innodb;
+Warnings:
+Warning 1280 Name 'prefix_primary' ignored for PRIMARY key.
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000));
CREATE INDEX prefix_idx ON worklog5743(col_1_varchar (3072));
INSERT INTO worklog5743 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000));
@@ -1101,6 +1103,8 @@ CREATE TABLE worklog5743 (
col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) ,
PRIMARY KEY `prefix_primary` (col_1_varchar(3072))
) ROW_FORMAT=DYNAMIC, engine = innodb;
+Warnings:
+Warning 1280 Name 'prefix_primary' ignored for PRIMARY key.
INSERT INTO worklog5743 VALUES(REPEAT("a", 4000) , REPEAT("o", 4000));
CREATE INDEX prefix_idx ON worklog5743(col_1_varchar (3072));
INSERT INTO worklog5743 VALUES(REPEAT("b", 4000) , REPEAT("p", 4000));
diff --git a/mysql-test/suite/multi_source/disabled.def b/mysql-test/suite/multi_source/disabled.def
index 45c8a6c8891..e69de29bb2d 100644
--- a/mysql-test/suite/multi_source/disabled.def
+++ b/mysql-test/suite/multi_source/disabled.def
@@ -1 +0,0 @@
-mdev-8874 : MDEV-20101 Assertion failure
diff --git a/mysql-test/suite/multi_source/multisource.result b/mysql-test/suite/multi_source/multisource.result
index d99a377f0c5..928c9799854 100644
--- a/mysql-test/suite/multi_source/multisource.result
+++ b/mysql-test/suite/multi_source/multisource.result
@@ -47,6 +47,8 @@ drop database if exists db1;
create database db1;
use db1;
create table t1 (i int auto_increment, f1 varchar(16), primary key pk (i,f1)) engine=MyISAM;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
insert into t1 (f1) values ('one'),('two');
connection slave;
select * from db1.t1;
diff --git a/mysql-test/suite/parts/r/alter_data_directory_innodb.result b/mysql-test/suite/parts/r/alter_data_directory_innodb.result
index d0ad8cd074c..8a43588ea52 100644
--- a/mysql-test/suite/parts/r/alter_data_directory_innodb.result
+++ b/mysql-test/suite/parts/r/alter_data_directory_innodb.result
@@ -18,6 +18,8 @@ t CREATE TABLE `t` (
(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB)
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
@@ -39,6 +41,8 @@ t CREATE TABLE `t` (
SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE;
SET GLOBAL INNODB_FILE_PER_TABLE=OFF;
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
diff --git a/mysql-test/suite/plugins/disabled.def b/mysql-test/suite/plugins/disabled.def
index 81cc9131335..e69de29bb2d 100644
--- a/mysql-test/suite/plugins/disabled.def
+++ b/mysql-test/suite/plugins/disabled.def
@@ -1 +0,0 @@
-auth_ed25519 : MDEV-20144 plugins.auth_ed25519 fails in buildbot with undefined symbol: inflate
diff --git a/mysql-test/suite/rpl/r/rpl_blackhole.result b/mysql-test/suite/rpl/r/rpl_blackhole.result
index 178c23b9f98..a87ba9a9d2d 100644
--- a/mysql-test/suite/rpl/r/rpl_blackhole.result
+++ b/mysql-test/suite/rpl/r/rpl_blackhole.result
@@ -42,6 +42,8 @@ COUNT(*)
>>> Something was written to binary log <<<
connection master;
ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
+Warnings:
+Warning 1280 Name 'pk_t1' ignored for PRIMARY key.
connection slave;
connection master;
INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);
diff --git a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result
index d92c3dce55b..3c5711855d8 100644
--- a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result
+++ b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result
@@ -47,6 +47,8 @@ COUNT(*)
>>> Something was written to binary log <<<
connection master;
ALTER TABLE t1 ADD PRIMARY KEY pk_t1 (a,b);
+Warnings:
+Warning 1280 Name 'pk_t1' ignored for PRIMARY key.
connection slave;
connection master;
INSERT INTO t1 VALUES (1,2,1),(2,2,2),(3,2,3),(4,2,4);
diff --git a/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result b/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result
index db97ce14c93..a1701635f0e 100644
--- a/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result
+++ b/mysql-test/suite/sys_vars/r/replicate_ignore_table_basic.result
@@ -46,3 +46,13 @@ SELECT @@GLOBAL.replicate_ignore_table;
# Cleanup.
SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table;
+#
+# MDEV-20101 Assertion failure on select @@global.'m2'.replicate_ignore_table
+#
+SET NAMES latin1;
+SELECT @@global.'m2'.replicate_ignore_table;
+@@global.'m2'.replicate_ignore_table
+NULL
+Warnings:
+Warning 1617 There is no master connection 'm2'
+Warning 1617 There is no master connection 'm2'
diff --git a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
index 56cf7f17c7f..1cf6f010eca 100644
--- a/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
+++ b/mysql-test/suite/sys_vars/t/replicate_ignore_table_basic.test
@@ -49,3 +49,10 @@ SELECT @@GLOBAL.replicate_ignore_table;
--echo # Cleanup.
SET @@GLOBAL.replicate_ignore_table = @save_replicate_ignore_table;
+
+--echo #
+--echo # MDEV-20101 Assertion failure on select @@global.'m2'.replicate_ignore_table
+--echo #
+
+SET NAMES latin1;
+SELECT @@global.'m2'.replicate_ignore_table;
diff --git a/mysql-test/suite/versioning/r/online.result b/mysql-test/suite/versioning/r/online.result
index 41a2556628a..36251ddd550 100644
--- a/mysql-test/suite/versioning/r/online.result
+++ b/mysql-test/suite/versioning/r/online.result
@@ -66,7 +66,9 @@ alter table t2
change a a int with system versioning,
add primary key pk (a);
affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
# restart
update t1 set a=2;
select count(*) from t1 for system_time all;
diff --git a/mysql-test/suite/versioning/r/truncate.result b/mysql-test/suite/versioning/r/truncate.result
index c7a90a2e726..88d38b18e1a 100644
--- a/mysql-test/suite/versioning/r/truncate.result
+++ b/mysql-test/suite/versioning/r/truncate.result
@@ -130,5 +130,28 @@ truncate t1;
truncate t2;
ERROR HY000: System-versioned tables do not support TRUNCATE TABLE
unlock tables;
+#
+# MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY
+#
+create or replace table t1 (
+f varchar(1),
+row_start SYS_TYPE as row start,
+row_end SYS_TYPE as row end,
+period for system_time (row_start, row_end))
+with system versioning;
+insert into t1 (f) values ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h');
+delete from t1;
+delete history from t1;
+drop table t1;
+#
+# MDEV-20186 Wrong result or Assertion on INSERT after DELETE HISTORY
+#
+create or replace table t1 (a int check (a > 0)) with system versioning;
+delete history from t1;
+insert into t1 values (1);
+select * from t1;
+a
+1
+drop table t1;
drop database test;
create database test;
diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result
index 333b8b3efa0..5d4669c46e2 100644
--- a/mysql-test/suite/versioning/r/trx_id.result
+++ b/mysql-test/suite/versioning/r/trx_id.result
@@ -437,7 +437,9 @@ ALTER TABLE t
CHANGE a a INT WITH SYSTEM VERSIONING,
ADD PRIMARY KEY pk(a);
affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+info: Records: 0 Duplicates: 0 Warnings: 1
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
SELECT c.prtype FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS AS c
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_TABLES AS t
ON c.table_id=t.table_id
diff --git a/mysql-test/suite/versioning/t/truncate.test b/mysql-test/suite/versioning/t/truncate.test
index 6b727e78e6b..b21956cc68f 100644
--- a/mysql-test/suite/versioning/t/truncate.test
+++ b/mysql-test/suite/versioning/t/truncate.test
@@ -145,5 +145,29 @@ truncate t2;
unlock tables;
+--echo #
+--echo # MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY
+--echo #
+--replace_result $sys_datatype_expl SYS_TYPE
+eval create or replace table t1 (
+ f varchar(1),
+ row_start $sys_datatype_expl as row start,
+ row_end $sys_datatype_expl as row end,
+ period for system_time (row_start, row_end))
+with system versioning;
+insert into t1 (f) values ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h');
+delete from t1;
+delete history from t1;
+drop table t1;
+
+--echo #
+--echo # MDEV-20186 Wrong result or Assertion on INSERT after DELETE HISTORY
+--echo #
+create or replace table t1 (a int check (a > 0)) with system versioning;
+delete history from t1;
+insert into t1 values (1);
+select * from t1;
+drop table t1;
+
drop database test;
create database test;
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 6e478a312ba..72f92e90d72 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,16 +23,19 @@
#
##############################################################################
#
-# Based on 10.4 11f3e2366282eb8cf1cb0062793d102067db6472
+# Based on 10.4 6dfa085fd5cfa9f4edd91b2a02ebeb8bd71d4966
main.alter_table_trans : MDEV-12084 - timeout
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
main.auth_named_pipe : MDEV-14724 - System error 2
+main.binary_to_hex : MDEV-20211 - Wrong result
+main.bootstrap : Modified in 10.1.41
main.charset_client_win : Added in 10.4.7
main.column_compression : Modified in 10.4.7
main.connect : MDEV-17282 - Wrong result
main.connect-abstract : MDEV-20162 - Could not execute 'check-testcase'
main.connect2 : MDEV-13885 - Server crash
+main.connect_debug : Modified in 10.4.7
main.count_distinct2 : MDEV-11768 - timeout
main.create_delayed : MDEV-10605 - failed with timeout
main.create_drop_event : MDEV-16271 - Wrong result
@@ -43,9 +46,10 @@ main.ctype_utf16le : MDEV-10675: timeout or extra warnings
main.ctype_utf8_def_upgrade : Added in 10.3.16
main.ctype_utf8mb4_innodb : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison
main.debug_sync : MDEV-10607 - internal error
-main.derived : Modified in 10.3.16
+main.derived : Modified in 10.4.7
+main.derived_cond_pushdown : Modified in 10.2.25
main.derived_opt : MDEV-11768 - timeout
-main.derived_view : Modified in 10.3.16
+main.derived_view : Modified in 10.4.7
main.dirty_close : MDEV-19368 - mysqltest failed but provided no output
main.distinct : MDEV-14194 - Crash
main.drop_bad_db_type : MDEV-15676 - Wrong result
@@ -58,15 +62,19 @@ main.flush : MDEV-19368 - mysqltest failed but provid
main.func_json : Modified in 10.3.16
main.func_time : Modified in 10.4.7
main.gis : MDEV-13411 - wrong result on P8; modified in 10.4.7
+main.grant : Modified in 10.4.7
+main.having : Modified in 10.4.7
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
main.index_intersect_innodb : MDEV-10643 - failed with timeout
main.index_merge_innodb : MDEV-7142 - Plan mismatch
+main.information_schema_parameters : Modified in 10.4.7
main.innodb_icp : MDEV-20168 - Wrong execution plans
main.innodb_mysql_lock : MDEV-7861 - Wrong result
-main.join : Modified in 10.3.16
+main.join : Modified in 10.4.7
main.join_cache : MDEV-17743 - Bad address from storage engine MyISAM; modified in 10.3.16
main.join_nested : Modified in 10.3.16
main.join_outer : Modified in 10.4.7
+main.join_outer_innodb : Modified in 10.4.7
main.keywords : Modified in 10.4.7
main.kill-2 : MDEV-13257 - Wrong result
main.kill_processlist-6619 : MDEV-10793 - Wrong result
@@ -88,7 +96,7 @@ main.mysql_upgrade_noengine : MDEV-14355 - Wrong result
main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error
main.mysql_upgrade_view : MDEV-20161 - Wrong result
main.mysqlcheck : MDEV-20164 - Wrong result
-main.mysqld--help : Modified in 10.3.17
+main.mysqld--help : Modified in 10.4.7
main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.3.16
main.mysqldump-compat-102 : Added in 10.4.7
main.mysqldump_restore : Modified in 10.4.7
@@ -106,14 +114,17 @@ main.partition_debug_sync : MDEV-15669 - Deadlock found when trying
main.partition_innodb : MDEV-20169 - Wrong result
main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings
main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1
+main.plugin : Modified in 10.4.7
main.plugin_auth : Modified in 10.3.17
main.plugin_auth_qa_2 : MDEV-20165 - Wrong result
+main.plugin_not_embedded : Modified in 10.4.7
main.pool_of_threads : MDEV-18135 - SSL error: key too small
-main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
+main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.4.7
+main.ps_innodb : Added in 10.4.7
main.query_cache : MDEV-16180 - Wrong result
main.query_cache_debug : MDEV-15281 - Query cache is disabled
main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away
-main.repair_symlink-5543 : Modified in 10.3.17
+main.repair_symlink-5543 : Modified in 10.4.7
main.rowid_filter_innodb : Modified in 10.4.7
main.set_statement : MDEV-13183 - Wrong result
main.set_statement_notembedded : MDEV-19414 - Wrong result
@@ -132,6 +143,7 @@ main.stat_tables : Modified in 10.3.16
main.stat_tables_par : MDEV-13266 - Wrong result
main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding
main.status : MDEV-13255 - Wrong result
+main.subselect : Modified in 10.4.7
main.subselect_innodb : MDEV-10614 - Wrong result
main.subselect_no_semijoin : Modified in 10.3.16
main.subselect_sj : Modified in 10.3.16
@@ -142,17 +154,19 @@ main.tls_version : MDEV-20170 - Unknown SSL error
main.tls_version1 : MDEV-20170 - Unknown SSL error; added in 10.4.7
main.trigger_null-8605 : Modified in 10.3.16
main.type_blob : MDEV-15195 - Wrong result
-main.type_datetime : Modified in 10.3.17
+main.type_datetime : Modified in 10.4.7
main.type_datetime_hires : MDEV-10687 - Timeout
main.type_float : Modified in 10.3.16
main.type_varchar : Modified in 10.4.7
main.userstat : MDEV-12904 - SSL errors
+main.view : Modified in 10.4.7
main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query
main.win : Modified in 10.3.16
main.xa : MDEV-11769 - lock wait timeout
#-----------------------------------------------------------------------
+archive.archive-big : MDEV-20167 - Wrong error code
archive.archive_bitfield : MDEV-11771 - table is marked as crashed
archive.archive_symlink : MDEV-12170 - unexpected error on rmdir
archive.discover : MDEV-10510 - Table is marked as crashed
@@ -164,21 +178,28 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
#-----------------------------------------------------------------------
-binlog.binlog_commit_wait : MDEV-10150 - Mismatch
-binlog.binlog_killed : MDEV-12925 - Wrong result
-binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown
-binlog.binlog_mysqlbinlog_stop_never : Added in 10.3.17
-binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
-binlog.flashback-largebinlog : MDEV-19764 - Out of memory; added in 10.3.16
-binlog.load_data_stm_view : MDEV-16948 - Wrong result
+binlog.binlog_commit_wait : MDEV-10150 - Mismatch
+binlog.binlog_killed : MDEV-12925 - Wrong result
+binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown
+binlog.binlog_mysqlbinlog_stop_never : Added in 10.4.7
+binlog.binlog_parallel_replication_marks_row : Include file modified in 10.4.7
+binlog.binlog_parallel_replication_marks_stm_mix : Include file modified in 10.4.7
+binlog.binlog_row_drop_tmp_tbl : Include file modified in 10.4.7
+binlog.binlog_stm_drop_tmp_tbl : MDEV-20188 - Unknown table on exec; include file modified in 10.4.7
+binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
+binlog.flashback-largebinlog : MDEV-19764 - Out of memory; added in 10.3.16
+binlog.load_data_stm_view : MDEV-16948 - Wrong result
+binlog.show_concurrent_rotate : MDEV-20215 - Wrong result
#-----------------------------------------------------------------------
+binlog_encryption.binlog_incident : MDEV-20213 - Server crash
binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint
binlog_encryption.encrypted_master : MDEV-14201 - Extra warnings
binlog_encryption.encrypted_master_switch_to_unencrypted : MDEV-14190 - Can't init tc log
binlog_encryption.encrypted_slave : MDEV-18135 - SSL error: key too small
binlog_encryption.encryption_combo : MDEV-14199 - Table is marked as crashed
+binlog_encryption.multisource : MDEV-20213 - Server crash
binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash
binlog_encryption.rpl_checksum : MDEV-16951 - Wrong result
binlog_encryption.rpl_corruption : MDEV-20159 - Assertion failure
@@ -220,7 +241,7 @@ disks.disks_notembedded : Added in 10.4.7
encryption.compressed_import_tablespace : Added in 10.3.16
encryption.corrupted_during_recovery : Modified in 10.3.16
-encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace
+encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace; include file modified in 10.4.7
encryption.debug_key_management : MDEV-13841 - Timeout
encryption.encrypt_and_grep : MDEV-13765 - Wrong result
encryption.innochecksum : MDEV-13644 - Assertion failure; modified in 10.4.7
@@ -305,32 +326,34 @@ gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion
gcol.innodb_virtual_debug : MDEV-19114 - Assertion failure
gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result
gcol.innodb_virtual_fk_restart : MDEV-17466 - Assertion failure
+gcol.innodb_virtual_purge : Modified in 10.2.25
#-----------------------------------------------------------------------
innodb.101_compatibility : MDEV-13891 - Wrong result
innodb.alter_copy : MDEV-16181 - Assertion failure
innodb.alter_crash : MDEV-16944 - The process cannot access the file
-innodb.alter_large_dml : MDEV-20148 - Debug sync point wait timed out; added in 10.3.17
+innodb.alter_large_dml : MDEV-20148 - Debug sync point wait timed out; added in 10.4.7
innodb.alter_missing_tablespace : Modified in 10.4.7
innodb.autoinc_persist : MDEV-15282 - Assertion failure
innodb.binlog_consistent : MDEV-10618 - Server fails to start
-innodb.blob-crash : Added in 10.4.7
-innodb.check_ibd_filesize : Added in 10.3.17
+innodb.blob-crash : MDEV-19298 - Assertion failure; added in 10.4.7
+innodb.check_ibd_filesize : Added in 10.4.7
innodb.corrupted_during_recovery : Modified in 10.3.16
-innodb.create_select : Added in 10.3.17
+innodb.create_select : Added in 10.4.7
innodb.doublewrite : MDEV-12905 - Server crash
innodb.foreign-keys : Modified in 10.4.7
innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed
innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure
innodb.ibuf_not_empty : MDEV-19021 - Wrong result
-innodb.innodb-16k : Modified in 10.3.17
-innodb.innodb-32k : Modified in 10.3.17
-innodb.innodb-32k-crash : MDEV-16953 - Corrupt log record found; modified in 10.3.17
-innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup; modified in 10.3.17
+innodb.innodb-16k : Modified in 10.4.7
+innodb.innodb-32k : Modified in 10.4.7
+innodb.innodb-32k-crash : MDEV-16953 - Corrupt log record found; modified in 10.4.7
+innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup; modified in 10.4.7
innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
innodb.innodb-alter-tempfile : MDEV-15285 - Table already exists
+innodb.innodb-autoinc : Modified in 10.4.7
innodb.innodb-bigblob : MDEV-18655 - ASAN unknown crash
innodb.innodb-blob : MDEV-12053 - Client crash
innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query
@@ -342,12 +365,12 @@ innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result
innodb.innodb-page_compression_snappy : MDEV-13644 - Assertion failure
innodb.innodb-page_compression_tables : MDEV-13644 - Assertion failure
innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem
-innodb.innodb-system-table-view : MDEV-20149 - Wrong result; added in 10.3.17
+innodb.innodb-system-table-view : MDEV-20149 - Wrong result; added in 10.4.7
innodb.innodb-table-online : MDEV-13894 - Wrong result
-innodb.innodb-virtual-columns-debug : MDEV-20143 - Wrong result; added in 10.3.17
+innodb.innodb-virtual-columns-debug : MDEV-20143 - Wrong result; added in 10.4.7
innodb.innodb-wl5522 : MDEV-13644 - Assertion failure
innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno
-innodb.innodb-wl5980-debug : Added in 10.3.17
+innodb.innodb-wl5980-debug : Added in 10.4.7
innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc; added in 10.4.7
innodb.innodb_buffer_pool_resize : MDEV-16964 - Assertion failure
innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure
@@ -359,8 +382,8 @@ innodb.innodb_bulk_create_index_replication : MDEV-15273 - Slave failed to star
innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full
innodb.innodb_force_recovery : Modified in 10.3.16
innodb.innodb_information_schema : MDEV-8851 - Wrong result
-innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed; modified in 10.3.17
-innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result; modified in 10.3.17
+innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed; modified in 10.4.7
+innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result; modified in 10.4.7
innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb_mysql : MDEV-19873 - Wrong result; modified in 10.4.7
innodb.innodb_stats : MDEV-10682 - wrong result
@@ -377,7 +400,7 @@ innodb.log_corruption : MDEV-13251 - Wrong result
innodb.log_data_file_size : MDEV-14204 - Server failed to start
innodb.log_file_name : MDEV-14193 - Exception
innodb.log_file_size : MDEV-15668 - Not found pattern
-innodb.max_record_size : Added in 10.3.17
+innodb.max_record_size : Added in 10.4.7
innodb.missing_tablespaces : Added in 10.4.7
innodb.monitor : MDEV-16179 - Wrong result
innodb.page_id_innochecksum : Added in 10.4.7
@@ -388,14 +411,14 @@ innodb.purge_thread_shutdown : MDEV-13792 - Wrong result
innodb.read_only_recovery : MDEV-13886 - Server crash
innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile
innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace
-innodb.strict_mode : Modified in 10.3.17
+innodb.strict_mode : Modified in 10.4.7
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning
innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start
innodb.temp_table_savepoint : MDEV-16182 - Wrong result
innodb.temporary_table : MDEV-13265 - Wrong result
innodb.truncate_missing : Modified in 10.4.7
-innodb.trx_id_future : MDEV-20138 - Table doesn't exist in engine; added in 10.3.17
-innodb.undo_log : Modified in 10.3.17
+innodb.trx_id_future : MDEV-20138 - Table doesn't exist in engine; added in 10.4.7
+innodb.undo_log : Modified in 10.4.7
innodb.undo_truncate : MDEV-17340 - Server hung
innodb.undo_truncate_recover : MDEV-17679 - Server has gone away; MDEV-19200 - Shutdown fails
innodb.update_time : MDEV-14804 - Wrong result
@@ -404,9 +427,8 @@ innodb.xa_recovery : MDEV-15279 - mysqld got exception
#-----------------------------------------------------------------------
innodb_fts.fulltext2 : Modified in 10.4.7
-innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure
innodb_fts.innodb_ft_aux_table : Added in 10.3.16
-innodb_fts.innodb_fts_misc : Modified in 10.3.17
+innodb_fts.innodb_fts_misc : Modified in 10.4.7
innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning
innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log
innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed
@@ -445,6 +467,7 @@ maria.insert_select : MDEV-12757 - Timeout
maria.insert_select-7314 : MDEV-16492 - Timeout
maria.kill : Added in 10.4.7
maria.maria : MDEV-14430 - Extra warning
+maria.maria-no-logging : MDEV-20196 - Crash on shutdown or server can't start
maria.temporary : Added in 10.4.7
#-----------------------------------------------------------------------
@@ -458,6 +481,7 @@ mariabackup.incremental_encrypted : MDEV-15667 - timeout
mariabackup.log_checksum_mismatch : MDEV-16571 - Wrong result
mariabackup.mdev-14447 : MDEV-15201 - Timeout
mariabackup.missing_ibd : Modified in 10.4.7
+mariabackup.partial : MDEV-19298 - Assertion failure
mariabackup.partial_exclude : MDEV-15270 - Error on exec
mariabackup.unencrypted_page_compressed : MDEV-18653 - Wrong error
mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
@@ -485,7 +509,7 @@ mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message
multi_source.gtid : MDEV-14202 - Crash
multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - wrong result
-multi_source.mdev-8874 : MDEV-20101 - Assertion failure; added in 10.3.17
+multi_source.mdev-8874 : MDEV-20101 - Assertion failure; added in 10.4.7
multi_source.mdev-9544 : MDEV-19415 - AddressSanitizer: heap-use-after-free
multi_source.multisource : MDEV-10417 - Fails on Mips
multi_source.reset_slave : MDEV-10690 - Wrong result
@@ -494,13 +518,14 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h
#-----------------------------------------------------------------------
-parts.fulltext : Added in 10.3.17
+parts.fulltext : Added in 10.4.7
parts.partition_alter1_1_2_innodb : MDEV-18655 - ASAN unknown crash
parts.partition_alter1_1_innodb : MDEV-18655 - ASAN unknown crash
parts.partition_alter1_2_innodb : MDEV-18655 - ASAN unknown crash
parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query
parts.partition_auto_increment_archive : MDEV-16491 - Marked as crashed and should be repaired
parts.partition_auto_increment_maria : MDEV-14430 - Extra warning
+parts.partition_basic_innodb : MDEV-20214 - ASAN error
parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist
parts.partition_exch_qa_10 : MDEV-11765 - wrong result
parts.partition_innodb_status_file : MDEV-12901 - Valgrind
@@ -543,7 +568,6 @@ period.versioning : MDEV-20159 - Assertion failure
#-----------------------------------------------------------------------
-plugins.auth_ed25519 : MDEV-20144 - Undefined symbol
plugins.feedback_plugin_load : Modified in 10.3.16
plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such
plugins.multiauth : MDEV-20163 - Plugin could not be loaded
@@ -622,10 +646,13 @@ roles.create_and_grant_role : MDEV-11772 - wrong result
rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free
rpl.create_or_replace2 : MDEV-19412 - Lost connection to MySQL server
+rpl.create_or_replace_mix : Include file modified in 10.4.7
+rpl.create_or_replace_row : Include file modified in 10.4.7
+rpl.create_or_replace_statement : Include file modified in 10.4.7
rpl.create_select : MDEV-14121 - Assertion failure
-rpl.kill_race_condition : Modified in 10.3.17
+rpl.kill_race_condition : Modified in 10.4.7
rpl.last_insert_id : MDEV-10625 - warnings in error log
-rpl.mdev_17588 : MDEV-20137 - Table doesn't exist; added in 10.3.17
+rpl.mdev_17588 : MDEV-20137 - Table doesn't exist; added in 10.4.7
rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
@@ -687,6 +714,7 @@ rpl.rpl_row_001 : MDEV-16653 - MTR's internal check fail
rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start
rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed
rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result
+rpl.rpl_row_drop_temp_table : Added in 10.4.7
rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed
rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed
rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed
@@ -779,6 +807,7 @@ sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu
sys_vars.delayed_insert_limit_func : MDEV-17683 - Wrong result
sys_vars.host_cache_size_auto : MDEV-20112 - Wrong result
sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error
+sys_vars.innodb_ft_result_cache_limit : Modified in 10.2.26
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash
sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion
@@ -866,6 +895,7 @@ versioning.partition : Modified in 10.4.7
versioning.replace : Modified in 10.3.16
versioning.rpl : Modified in 10.3.16
versioning.simple : Modified in 10.3.17
+versioning.truncate : Modified in 10.4.7
versioning.trx_id : Modified in 10.4.7
versioning.update-big : MDEV-15458 - Server crash; added in 10.3.16
@@ -875,7 +905,7 @@ wsrep.* : suite.pm modified in 10.4.7
wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node
wsrep.mdev_6832 : MDEV-14195 - Check testcase failed
wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use
-wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock; modified in 10.3.17
+wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock; modified in 10.4.7
#-----------------------------------------------------------------------
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 85d42d4fd0a..568ed3ecb46 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -237,6 +237,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
int error;
DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null",
(ulong) mp));
+
+ pthread_mutex_lock(&mp->global);
if (!mp->file)
{
fprintf(stderr,
@@ -245,8 +247,6 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
fflush(stderr);
abort();
}
-
- pthread_mutex_lock(&mp->global);
if (mp->count > 0)
{
/*
diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc
index fda909e6530..02770644259 100644
--- a/mysys_ssl/my_crypt.cc
+++ b/mysys_ssl/my_crypt.cc
@@ -88,24 +88,8 @@ public:
}
virtual int finish(uchar *dst, uint *dlen)
{
-#ifdef HAVE_WOLFSSL
- /*
- Bug in WolfSSL - sometimes EVP_CipherFinal_ex
- returns success without setting destination length
- when it should return error.
- We catch it by presetting invalid value for length,
- and checking if it has changed after the call.
-
- See https://github.com/wolfSSL/wolfssl/issues/2224
- */
- *dlen= UINT_MAX;
-#endif
if (EVP_CipherFinal_ex(ctx, dst, (int*)dlen) != 1)
return MY_AES_BAD_DATA;
-#ifdef HAVE_WOLFSSL
- if (*dlen == UINT_MAX)
- return MY_AES_BAD_DATA;
-#endif
return MY_AES_OK;
}
};
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index ec0096609ba..65d71a81080 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -40,7 +40,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
{
int p_to_c[2], c_to_p[2]; /* Parent-to-child and child-to-parent pipes. */
pid_t proc_id;
- int result= CR_ERROR, pkt_len;
+ int result= CR_ERROR, pkt_len= 0;
unsigned char field, *pkt;
PAM_DEBUG((stderr, "PAM: opening pipes.\n"));
diff --git a/plugin/auth_pam/auth_pam_tool.c b/plugin/auth_pam/auth_pam_tool.c
index 3ab2e00c142..3947091ec4a 100644
--- a/plugin/auth_pam/auth_pam_tool.c
+++ b/plugin/auth_pam/auth_pam_tool.c
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
int res;
char a_buf[MYSQL_USERNAME_LENGTH + 1 + 1024];
- setreuid(0, 0);
+ (void) setreuid(0, 0);
if (read(0, &field, 1) < 1)
return -1;
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 0832e7f390d..b371cb0e706 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -16,7 +16,7 @@
#define PLUGIN_VERSION 0x104
-#define PLUGIN_STR_VERSION "1.4.7"
+#define PLUGIN_STR_VERSION "1.4.8"
#define _my_thread_var loc_thread_var
@@ -2261,7 +2261,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
}
-int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
+int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len)
{
int db_off;
int db_len_off;
@@ -2288,7 +2288,7 @@ int get_db_mysql57(MYSQL_THD thd, char **name, int *len)
#ifdef __linux__
*name= *(char **) (((char *) thd) + db_off);
- *len= *((int *) (((char*) thd) + db_len_off));
+ *len= *((size_t *) (((char*) thd) + db_len_off));
if (*name && (*name)[*len] != 0)
return 1;
return 0;
diff --git a/plugin/server_audit/test_audit_v4.c b/plugin/server_audit/test_audit_v4.c
index 8cb24bc693b..f37d8c7c34a 100644
--- a/plugin/server_audit/test_audit_v4.c
+++ b/plugin/server_audit/test_audit_v4.c
@@ -16,7 +16,7 @@ enum enum_server_command{ SERVCOM_A, SERVCOM_B };
#include "plugin_audit_v4.h"
extern void auditing(MYSQL_THD thd, unsigned int event_class, const void *ev);
-extern int get_db_mysql57(MYSQL_THD thd, char **name, int *len);
+extern int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len);
struct mysql_event_general_302
@@ -35,7 +35,7 @@ struct mysql_event_general_302
unsigned long long general_rows;
unsigned long long query_id;
char *database;
- int database_length;
+ size_t database_length;
};
diff --git a/plugin/win_auth_client/common.cc b/plugin/win_auth_client/common.cc
index 4fbddd28c9d..8b7319252ac 100644
--- a/plugin/win_auth_client/common.cc
+++ b/plugin/win_auth_client/common.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index c68e34020cd..253cad72e0b 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -272,9 +272,16 @@ then
fi
if test -n "$srcdir"
then
+ # In an out-of-source build, builddir is not srcdir. Try to guess where
+ # builddir is by looking for my_print_defaults.
if test -z "$builddir"
then
- builddir="$srcdir"
+ if test -x "$dirname0/extra/my_print_defaults"
+ then
+ builddir="$dirname0"
+ else
+ builddir="$srcdir"
+ fi
fi
print_defaults="$builddir/extra/my_print_defaults"
elif test -n "$basedir"
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index 69dc00ccfba..8f442dd34a2 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -28,7 +28,7 @@ set system_versioning_alter_history=keep;
set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');
SET @innodb_or_aria=IF(@have_innodb <> 0, 'InnoDB', 'Aria');
-CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
+CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY /*Host */(Host,Db,User), KEY User (User) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-- Remember for later if db table already existed
set @had_db_table= @@warning_count != 0;
@@ -116,19 +116,19 @@ CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null r
CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=Aria transactional=0 CHARACTER SET utf8 comment='help keywords';
-CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zone names';
+CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY /*Name*/ (Name) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zone names';
-CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zones';
+CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY /*TzId*/ (Time_zone_id) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zones';
-CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zone transitions';
+CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY /*TzIdTranTime*/ (Time_zone_id, Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zone transitions';
-CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zone transition types';
+CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY /*TzIdTrTId*/ (Time_zone_id, Transition_type_id) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Time zone transition types';
-CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Leap seconds information for time zones';
+CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY /*TranTime*/ (Transition_time) ) engine=Aria transactional=1 CHARACTER SET utf8 comment='Leap seconds information for time zones';
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob NOT NULL, body longblob NOT NULL, definer char(141) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'IGNORE_BAD_TABLE_OPTIONS', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH', 'EMPTY_STRING_IS_NULL', 'SIMULTANEOUS_ASSIGNMENT', 'TIME_ROUND_FRACTIONAL') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, aggregate enum('NONE', 'GROUP') DEFAULT 'NONE' NOT NULL, PRIMARY KEY (db,name,type)) engine=Aria transactional=1 character set utf8 comment='Stored Procedures';
@@ -277,7 +277,7 @@ SET @str=CONCAT(@cmd, ' ENGINE=', @innodb_or_aria);
#EXECUTE stmt;
#DROP PREPARE stmt;
-CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(80) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
+CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(80) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY /*Host*/ (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
-- Remember for later if proxies_priv table already existed
set @had_proxies_priv_table= @@warning_count != 0;
diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c
index b15203cd9be..4faf05847d8 100644
--- a/sql-common/client_plugin.c
+++ b/sql-common/client_plugin.c
@@ -362,7 +362,13 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
mysql->options.extension && mysql->options.extension->plugin_dir ?
mysql->options.extension->plugin_dir : PLUGINDIR, "/",
name, SO_EXT, NullS);
-
+
+ if (strpbrk(name, "()[]!@#$%^&/*;.,'?\\"))
+ {
+ errmsg= "invalid plugin name";
+ goto err;
+ }
+
DBUG_PRINT ("info", ("dlopeninig %s", dlpath));
/* Open new dll handle */
if (!(dlhandle= dlopen(dlpath, RTLD_NOW)))
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index b8054aa2c23..22ea32e5076 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1728,7 +1728,11 @@ longlong number_to_datetime_or_date(longlong nr, ulong sec_part,
!check_date(time_res, nr || sec_part, flags, was_cut))
{
if (time_res->time_type == MYSQL_TIMESTAMP_DATE && sec_part != 0)
- *was_cut= MYSQL_TIME_NOTE_TRUNCATED;
+ {
+ /* Date format, but with fractional digits, e.g. 20010203.5 */
+ *was_cut= MYSQL_TIME_NOTE_TRUNCATED;
+ time_res->second_part= 0;
+ }
return nr;
}
diff --git a/sql/field.cc b/sql/field.cc
index 8f1efbefa38..746f418415c 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8568,7 +8568,11 @@ void Field_blob::sql_type(String &res) const
}
res.set_ascii(str,length);
if (charset() == &my_charset_bin)
+ {
res.append(STRING_WITH_LEN("blob"));
+ if (packlength == 2 && (get_thd()->variables.sql_mode & MODE_ORACLE))
+ res.append(STRING_WITH_LEN("(65535)"));
+ }
else
{
res.append(STRING_WITH_LEN("text"));
diff --git a/sql/field.h b/sql/field.h
index 27f7095c1d0..24a8a617657 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1852,13 +1852,6 @@ public:
{
return to->store(val_int(), MY_TEST(flags & UNSIGNED_FLAG));
}
- bool memcpy_field_possible(const Field *from) const
- {
- return real_type() == from->real_type() &&
- pack_length() == from->pack_length() &&
- !((flags & UNSIGNED_FLAG) && !(from->flags & UNSIGNED_FLAG)) &&
- decimals() == from->decimals();
- }
bool is_equal(const Column_definition &new_field) const;
uint row_pack_length() const { return pack_length(); }
uint32 pack_length_from_metadata(uint field_metadata) const
@@ -2053,7 +2046,10 @@ public:
e.g. a DOUBLE(53,10) into a DOUBLE(10,10).
But it should be OK the other way around.
*/
- return Field_num::memcpy_field_possible(from) &&
+ return real_type() == from->real_type() &&
+ pack_length() == from->pack_length() &&
+ is_unsigned() <= from->is_unsigned() &&
+ decimals() == from->decimals() &&
field_length >= from->field_length;
}
int store_decimal(const my_decimal *dec) { return store(dec->to_double()); }
@@ -2144,7 +2140,10 @@ public:
}
bool memcpy_field_possible(const Field *from) const
{
- return Field_num::memcpy_field_possible(from) &&
+ return real_type() == from->real_type() &&
+ pack_length() == from->pack_length() &&
+ is_unsigned() <= from->is_unsigned() &&
+ decimals() == from->decimals() &&
field_length == from->field_length;
}
enum_conv_type rpl_conv_type_from(const Conv_source &source,
@@ -2225,6 +2224,12 @@ public:
enum_conv_type rpl_conv_type_from(const Conv_source &source,
const Relay_log_info *rli,
const Conv_param &param) const;
+ bool memcpy_field_possible(const Field *from) const
+ {
+ return real_type() == from->real_type() &&
+ pack_length() == from->pack_length() &&
+ is_unsigned() == from->is_unsigned();
+ }
int store_decimal(const my_decimal *);
my_decimal *val_decimal(my_decimal *);
bool val_bool() { return val_int() != 0; }
diff --git a/sql/item.cc b/sql/item.cc
index 0ad394c61eb..162e82c57ea 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -9910,7 +9910,7 @@ Datetime Item_cache_timestamp::to_datetime(THD *thd)
null_value= true;
return Datetime();
}
- return Datetime(thd, Timestamp_or_zero_datetime(m_native).tv());
+ return m_native.to_datetime(thd);
}
@@ -10378,11 +10378,14 @@ table_map Item_direct_view_ref::used_tables() const
table_map Item_direct_view_ref::not_null_tables() const
{
- return get_depended_from() ?
- 0 :
- ((view->is_merged_derived() || view->merged || !view->table) ?
- (*ref)->not_null_tables() :
- view->table->map);
+ if (get_depended_from())
+ return 0;
+ if (!( view->merged || !view->table))
+ return view->table->map;
+ TABLE *tab= get_null_ref_table();
+ if (tab == NO_NULL_TABLE || (*ref)->used_tables())
+ return (*ref)->not_null_tables();
+ return get_null_ref_table()->map;
}
/*
diff --git a/sql/item.h b/sql/item.h
index db879e51077..5fb008b73f1 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2360,6 +2360,9 @@ public:
append(item->type_handler()->name().ptr());
append(')');
const_cast<Item*>(item)->print(this, QT_EXPLAIN);
+ /* Append end \0 to allow usage of c_ptr() */
+ append('\0');
+ str_length--;
}
};
#endif
@@ -5559,6 +5562,7 @@ public:
void update_used_tables();
table_map not_null_tables() const;
bool const_item() const { return used_tables() == 0; }
+ TABLE *get_null_ref_table() const { return null_ref_table; }
bool walk(Item_processor processor, bool walk_subquery, void *arg)
{
return (*ref)->walk(processor, walk_subquery, arg) ||
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index a302b205132..34c957cba19 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -659,7 +659,7 @@ public:
class Item_func_not_all :public Item_func_not
{
/* allow to check presence of values in max/min optimization */
- Item_sum_hybrid *test_sum_item;
+ Item_sum_min_max *test_sum_item;
Item_maxmin_subselect *test_sub_item;
public:
@@ -675,7 +675,7 @@ public:
bool fix_fields(THD *thd, Item **ref)
{return Item_func::fix_fields(thd, ref);}
virtual void print(String *str, enum_query_type query_type);
- void set_sum_test(Item_sum_hybrid *item) { test_sum_item= item; test_sub_item= 0; };
+ void set_sum_test(Item_sum_min_max *item) { test_sum_item= item; test_sub_item= 0; };
void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; test_sum_item= 0;};
bool empty_underlying_subquery();
Item *neg_transformer(THD *thd);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 882337870fc..089103e1047 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -360,6 +360,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
with_window_func= with_window_func || item->with_window_func;
with_field= with_field || item->with_field;
used_tables_and_const_cache_join(item);
+ not_null_tables_cache|= item->not_null_tables();
m_with_subquery|= item->with_subquery();
}
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index a03e8468ac3..b0eb8f4d158 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -58,6 +58,27 @@ C_MODE_END
size_t username_char_length= 80;
+
+class Repeat_count
+{
+ ulonglong m_count;
+public:
+ Repeat_count(Item *item)
+ :m_count(0)
+ {
+ Longlong_hybrid nr= item->to_longlong_hybrid();
+ if (!item->null_value && !nr.neg())
+ {
+ // Assume that the maximum length of a String is < INT_MAX32
+ m_count= (ulonglong) nr.value();
+ if (m_count > (ulonglong) INT_MAX32)
+ m_count= (ulonglong) INT_MAX32;
+ }
+ }
+ ulonglong count() const { return m_count; }
+};
+
+
/*
For the Items which have only val_str_ascii() method
and don't have their own "native" val_str(),
@@ -1633,13 +1654,10 @@ String *Item_func_left::val_str(String *str)
void Item_str_func::left_right_max_length()
{
uint32 char_length= args[0]->max_char_length();
- if (args[1]->const_item())
+ if (args[1]->const_item() && !args[1]->is_expensive())
{
- int length= (int) args[1]->val_int();
- if (args[1]->null_value || length <= 0)
- char_length=0;
- else
- set_if_smaller(char_length, (uint) length);
+ Repeat_count tmp(args[1]);
+ set_if_smaller(char_length, (uint) tmp.count());
}
fix_char_length(char_length);
}
@@ -2963,27 +2981,16 @@ bool Item_func_repeat::fix_length_and_dec()
if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE;
DBUG_ASSERT(collation.collation != NULL);
- if (args[1]->const_item())
+ if (args[1]->const_item() && !args[1]->is_expensive())
{
- /* must be longlong to avoid truncation */
- longlong count= args[1]->val_int();
-
- /* Assumes that the maximum length of a String is < INT_MAX32. */
- /* Set here so that rest of code sees out-of-bound value as such. */
- if (args[1]->null_value)
- count= 0;
- else if (count > INT_MAX32)
- count= INT_MAX32;
-
- ulonglong char_length= (ulonglong) args[0]->max_char_length() * count;
+ Repeat_count tmp(args[1]);
+ ulonglong char_length= (ulonglong) args[0]->max_char_length() * tmp.count();
fix_char_length_ulonglong(char_length);
+ return false;
}
- else
- {
- max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- return FALSE;
+ max_length= MAX_BLOB_WIDTH;
+ maybe_null= true;
+ return false;
}
/**
@@ -3048,26 +3055,14 @@ err:
bool Item_func_space::fix_length_and_dec()
{
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
- if (args[0]->const_item())
+ if (args[0]->const_item() && !args[0]->is_expensive())
{
- /* must be longlong to avoid truncation */
- longlong count= args[0]->val_int();
- if (args[0]->null_value)
- goto end;
- /*
- Assumes that the maximum length of a String is < INT_MAX32.
- Set here so that rest of code sees out-of-bound value as such.
- */
- if (count > INT_MAX32)
- count= INT_MAX32;
- fix_char_length_ulonglong(count);
- return FALSE;
+ fix_char_length_ulonglong(Repeat_count(args[0]).count());
+ return false;
}
-
-end:
max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- return FALSE;
+ maybe_null= true;
+ return false;
}
@@ -3178,24 +3173,15 @@ bool Item_func_pad::fix_length_and_dec()
pad_str.append(" ", 1);
}
- if (args[1]->const_item())
+ DBUG_ASSERT(collation.collation->mbmaxlen > 0);
+ if (args[1]->const_item() && !args[1]->is_expensive())
{
- ulonglong char_length= (ulonglong) args[1]->val_int();
- DBUG_ASSERT(collation.collation->mbmaxlen > 0);
- /* Assumes that the maximum length of a String is < INT_MAX32. */
- /* Set here so that rest of code sees out-of-bound value as such. */
- if (args[1]->null_value)
- char_length= 0;
- else if (char_length > INT_MAX32)
- char_length= INT_MAX32;
- fix_char_length_ulonglong(char_length);
- }
- else
- {
- max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
+ fix_char_length(Repeat_count(args[1]).count());
+ return false;
}
- return FALSE;
+ max_length= MAX_BLOB_WIDTH;
+ maybe_null= true;
+ return false;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 4e02d7edbe4..de49a54b54a 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1550,16 +1550,23 @@ bool Item_exists_subselect::fix_length_and_dec()
{
DBUG_ENTER("Item_exists_subselect::fix_length_and_dec");
init_length_and_dec();
- /*
- We need only 1 row to determine existence (i.e. any EXISTS that is not
- an IN always requires LIMIT 1)
- */
- Item *item= new (thd->mem_root) Item_int(thd, (int32) 1);
- if (!item)
- DBUG_RETURN(TRUE);
- thd->change_item_tree(&unit->global_parameters()->select_limit,
- item);
- DBUG_PRINT("info", ("Set limit to 1"));
+ // If limit is not set or it is constant more than 1
+ if (!unit->global_parameters()->select_limit ||
+ (unit->global_parameters()->select_limit->basic_const_item() &&
+ unit->global_parameters()->select_limit->val_int() > 1))
+ {
+ /*
+ We need only 1 row to determine existence (i.e. any EXISTS that is not
+ an IN always requires LIMIT 1)
+ */
+ Item *item= new (thd->mem_root) Item_int(thd, (int32) 1);
+ if (!item)
+ DBUG_RETURN(TRUE);
+ thd->change_item_tree(&unit->global_parameters()->select_limit,
+ item);
+ unit->global_parameters()->explicit_limit= 1; // we set the limit
+ DBUG_PRINT("info", ("Set limit to 1"));
+ }
DBUG_RETURN(FALSE);
}
@@ -1991,7 +1998,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
(!select_lex->ref_pointer_array[0]->maybe_null || /*4*/
substype() != Item_subselect::ALL_SUBS)) /*4*/
{
- Item_sum_hybrid *item;
+ Item_sum_min_max *item;
nesting_map save_allow_sum_func;
if (func->l_op())
{
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 3e915363c12..87f3e1d3345 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1151,9 +1151,9 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
bool
-Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
+Item_sum_min_max::fix_fields(THD *thd, Item **ref)
{
- DBUG_ENTER("Item_sum_hybrid::fix_fields");
+ DBUG_ENTER("Item_sum_min_max::fix_fields");
DBUG_ASSERT(fixed == 0);
if (init_sum_func_check(thd))
@@ -1183,10 +1183,72 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
}
-bool Item_sum_hybrid::fix_length_and_dec()
+bool Item_sum_hybrid::fix_length_and_dec_generic()
+{
+ Item *item= arguments()[0];
+ Type_std_attributes::set(item);
+ set_handler(item->type_handler());
+ return false;
+}
+
+
+/**
+ MAX/MIN for the traditional numeric types preserve the exact data type
+ from Fields, but do not preserve the exact type from Items:
+ MAX(float_field) -> FLOAT
+ MAX(smallint_field) -> LONGLONG
+ MAX(COALESCE(float_field)) -> DOUBLE
+ MAX(COALESCE(smallint_field)) -> LONGLONG
+ QQ: Items should probably be fixed to preserve the exact type.
+*/
+bool Item_sum_hybrid::fix_length_and_dec_numeric(const Type_handler *handler)
+{
+ Item *item= arguments()[0];
+ Item *item2= item->real_item();
+ Type_std_attributes::set(item);
+ if (item2->type() == Item::FIELD_ITEM)
+ set_handler(item2->type_handler());
+ else
+ set_handler(handler);
+ return false;
+}
+
+
+/**
+ MAX(str_field) converts ENUM/SET to CHAR, and preserve all other types
+ for Fields.
+ QQ: This works differently from UNION, which preserve the exact data
+ type for ENUM/SET if the joined ENUM/SET fields are equally defined.
+ Perhaps should be fixed.
+ MAX(str_item) chooses the best suitable string type.
+*/
+bool Item_sum_hybrid::fix_length_and_dec_string()
+{
+ Item *item= arguments()[0];
+ Item *item2= item->real_item();
+ Type_std_attributes::set(item);
+ if (item2->type() == Item::FIELD_ITEM)
+ {
+ // Fields: convert ENUM/SET to CHAR, preserve the type otherwise.
+ set_handler(item->type_handler());
+ }
+ else
+ {
+ // Items: choose VARCHAR/BLOB/MEDIUMBLOB/LONGBLOB, depending on length.
+ set_handler(type_handler_varchar.
+ type_handler_adjusted_to_max_octet_length(max_length,
+ collation.collation));
+ }
+ return false;
+}
+
+
+bool Item_sum_min_max::fix_length_and_dec()
{
DBUG_ASSERT(args[0]->field_type() == args[0]->real_item()->field_type());
DBUG_ASSERT(args[0]->result_type() == args[0]->real_item()->result_type());
+ /* MIN/MAX can return NULL for empty set indepedent of the used column */
+ maybe_null= null_value= true;
return args[0]->type_handler()->Item_sum_hybrid_fix_length_and_dec(this);
}
@@ -1208,9 +1270,9 @@ bool Item_sum_hybrid::fix_length_and_dec()
and Item_sum_min::add() to use different values!
*/
-void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg)
+void Item_sum_min_max::setup_hybrid(THD *thd, Item *item, Item *value_arg)
{
- DBUG_ENTER("Item_sum_hybrid::setup_hybrid");
+ DBUG_ENTER("Item_sum_min_max::setup_hybrid");
if (!(value= item->get_cache(thd)))
DBUG_VOID_RETURN;
value->setup(thd, item);
@@ -1231,10 +1293,10 @@ void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg)
}
-Field *Item_sum_hybrid::create_tmp_field(MEM_ROOT *root,
- bool group, TABLE *table)
+Field *Item_sum_min_max::create_tmp_field(MEM_ROOT *root,
+ bool group, TABLE *table)
{
- DBUG_ENTER("Item_sum_hybrid::create_tmp_field");
+ DBUG_ENTER("Item_sum_min_max::create_tmp_field");
if (args[0]->type() == Item::FIELD_ITEM)
{
@@ -2308,9 +2370,9 @@ Item *Item_sum_variance::result_item(THD *thd, Field *field)
/* min & max */
-void Item_sum_hybrid::clear()
+void Item_sum_min_max::clear()
{
- DBUG_ENTER("Item_sum_hybrid::clear");
+ DBUG_ENTER("Item_sum_min_max::clear");
value->clear();
null_value= 1;
DBUG_VOID_RETURN;
@@ -2318,7 +2380,7 @@ void Item_sum_hybrid::clear()
bool
-Item_sum_hybrid::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+Item_sum_min_max::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
DBUG_ASSERT(fixed == 1);
if (null_value)
@@ -2330,9 +2392,9 @@ Item_sum_hybrid::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
}
-void Item_sum_hybrid::direct_add(Item *item)
+void Item_sum_min_max::direct_add(Item *item)
{
- DBUG_ENTER("Item_sum_hybrid::direct_add");
+ DBUG_ENTER("Item_sum_min_max::direct_add");
DBUG_PRINT("info", ("item: %p", item));
direct_added= TRUE;
direct_item= item;
@@ -2340,9 +2402,9 @@ void Item_sum_hybrid::direct_add(Item *item)
}
-double Item_sum_hybrid::val_real()
+double Item_sum_min_max::val_real()
{
- DBUG_ENTER("Item_sum_hybrid::val_real");
+ DBUG_ENTER("Item_sum_min_max::val_real");
DBUG_ASSERT(fixed == 1);
if (null_value)
DBUG_RETURN(0.0);
@@ -2352,9 +2414,9 @@ double Item_sum_hybrid::val_real()
DBUG_RETURN(retval);
}
-longlong Item_sum_hybrid::val_int()
+longlong Item_sum_min_max::val_int()
{
- DBUG_ENTER("Item_sum_hybrid::val_int");
+ DBUG_ENTER("Item_sum_min_max::val_int");
DBUG_ASSERT(fixed == 1);
if (null_value)
DBUG_RETURN(0);
@@ -2365,9 +2427,9 @@ longlong Item_sum_hybrid::val_int()
}
-my_decimal *Item_sum_hybrid::val_decimal(my_decimal *val)
+my_decimal *Item_sum_min_max::val_decimal(my_decimal *val)
{
- DBUG_ENTER("Item_sum_hybrid::val_decimal");
+ DBUG_ENTER("Item_sum_min_max::val_decimal");
DBUG_ASSERT(fixed == 1);
if (null_value)
DBUG_RETURN(0);
@@ -2379,9 +2441,9 @@ my_decimal *Item_sum_hybrid::val_decimal(my_decimal *val)
String *
-Item_sum_hybrid::val_str(String *str)
+Item_sum_min_max::val_str(String *str)
{
- DBUG_ENTER("Item_sum_hybrid::val_str");
+ DBUG_ENTER("Item_sum_min_max::val_str");
DBUG_ASSERT(fixed == 1);
if (null_value)
DBUG_RETURN(0);
@@ -2392,7 +2454,7 @@ Item_sum_hybrid::val_str(String *str)
}
-bool Item_sum_hybrid::val_native(THD *thd, Native *to)
+bool Item_sum_min_max::val_native(THD *thd, Native *to)
{
DBUG_ASSERT(fixed == 1);
if (null_value)
@@ -2401,9 +2463,9 @@ bool Item_sum_hybrid::val_native(THD *thd, Native *to)
}
-void Item_sum_hybrid::cleanup()
+void Item_sum_min_max::cleanup()
{
- DBUG_ENTER("Item_sum_hybrid::cleanup");
+ DBUG_ENTER("Item_sum_min_max::cleanup");
Item_sum::cleanup();
if (cmp)
delete cmp;
@@ -2419,9 +2481,9 @@ void Item_sum_hybrid::cleanup()
DBUG_VOID_RETURN;
}
-void Item_sum_hybrid::no_rows_in_result()
+void Item_sum_min_max::no_rows_in_result()
{
- DBUG_ENTER("Item_sum_hybrid::no_rows_in_result");
+ DBUG_ENTER("Item_sum_min_max::no_rows_in_result");
/* We may be called here twice in case of ref field in function */
if (was_values)
{
@@ -2432,7 +2494,7 @@ void Item_sum_hybrid::no_rows_in_result()
DBUG_VOID_RETURN;
}
-void Item_sum_hybrid::restore_to_before_no_rows_in_result()
+void Item_sum_min_max::restore_to_before_no_rows_in_result()
{
if (!was_values)
{
@@ -2677,10 +2739,10 @@ bool Item_sum_and::add()
** reset result of a Item_sum with is saved in a tmp_table
*************************************************************************/
-void Item_sum_hybrid::reset_field()
+void Item_sum_min_max::reset_field()
{
Item *UNINIT_VAR(tmp_item), *arg0;
- DBUG_ENTER("Item_sum_hybrid::reset_field");
+ DBUG_ENTER("Item_sum_min_max::reset_field");
arg0= args[0];
if (unlikely(direct_added))
@@ -3018,9 +3080,9 @@ Item *Item_sum_avg::result_item(THD *thd, Field *field)
}
-void Item_sum_hybrid::update_field()
+void Item_sum_min_max::update_field()
{
- DBUG_ENTER("Item_sum_hybrid::update_field");
+ DBUG_ENTER("Item_sum_min_max::update_field");
Item *UNINIT_VAR(tmp_item);
if (unlikely(direct_added))
{
@@ -3050,9 +3112,9 @@ void Item_sum_hybrid::update_field()
void
-Item_sum_hybrid::min_max_update_str_field()
+Item_sum_min_max::min_max_update_str_field()
{
- DBUG_ENTER("Item_sum_hybrid::min_max_update_str_field");
+ DBUG_ENTER("Item_sum_min_max::min_max_update_str_field");
DBUG_ASSERT(cmp);
String *res_str=args[0]->val_str(&cmp->value1);
@@ -3073,11 +3135,11 @@ Item_sum_hybrid::min_max_update_str_field()
void
-Item_sum_hybrid::min_max_update_real_field()
+Item_sum_min_max::min_max_update_real_field()
{
double nr,old_nr;
- DBUG_ENTER("Item_sum_hybrid::min_max_update_real_field");
+ DBUG_ENTER("Item_sum_min_max::min_max_update_real_field");
old_nr=result_field->val_real();
nr= args[0]->val_real();
if (!args[0]->null_value)
@@ -3095,11 +3157,11 @@ Item_sum_hybrid::min_max_update_real_field()
void
-Item_sum_hybrid::min_max_update_int_field()
+Item_sum_min_max::min_max_update_int_field()
{
longlong nr,old_nr;
- DBUG_ENTER("Item_sum_hybrid::min_max_update_int_field");
+ DBUG_ENTER("Item_sum_min_max::min_max_update_int_field");
old_nr=result_field->val_int();
nr=args[0]->val_int();
if (!args[0]->null_value)
@@ -3130,9 +3192,9 @@ Item_sum_hybrid::min_max_update_int_field()
optimize: do not get result_field in case of args[0] is NULL
*/
void
-Item_sum_hybrid::min_max_update_decimal_field()
+Item_sum_min_max::min_max_update_decimal_field()
{
- DBUG_ENTER("Item_sum_hybrid::min_max_update_decimal_field");
+ DBUG_ENTER("Item_sum_min_max::min_max_update_decimal_field");
my_decimal old_val, nr_val;
const my_decimal *old_nr;
const my_decimal *nr= args[0]->val_decimal(&nr_val);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index cc25a2543d1..4e3241d9594 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1045,10 +1045,35 @@ class Item_sum_std :public Item_sum_variance
{ return get_item_copy<Item_sum_std>(thd, this); }
};
+
+class Item_sum_hybrid: public Item_sum,
+ public Type_handler_hybrid_field_type
+{
+public:
+ Item_sum_hybrid(THD *thd, Item *item_par):
+ Item_sum(thd, item_par),
+ Type_handler_hybrid_field_type(&type_handler_longlong)
+ { collation.set(&my_charset_bin); }
+ Item_sum_hybrid(THD *thd, Item *a, Item *b):
+ Item_sum(thd, a, b),
+ Type_handler_hybrid_field_type(&type_handler_longlong)
+ { collation.set(&my_charset_bin); }
+ Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
+ :Item_sum(thd, item),
+ Type_handler_hybrid_field_type(item)
+ { }
+ const Type_handler *type_handler() const
+ { return Type_handler_hybrid_field_type::type_handler(); }
+ bool fix_length_and_dec_generic();
+ bool fix_length_and_dec_numeric(const Type_handler *h);
+ bool fix_length_and_dec_string();
+};
+
+
// This class is a string or number function depending on num_func
class Arg_comparator;
class Item_cache;
-class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type
+class Item_sum_min_max :public Item_sum_hybrid
{
protected:
bool direct_added;
@@ -1059,16 +1084,14 @@ protected:
bool was_values; // Set if we have found at least one row (for max/min only)
bool was_null_value;
- public:
- Item_sum_hybrid(THD *thd, Item *item_par,int sign):
- Item_sum(thd, item_par),
- Type_handler_hybrid_field_type(&type_handler_longlong),
+public:
+ Item_sum_min_max(THD *thd, Item *item_par,int sign):
+ Item_sum_hybrid(thd, item_par),
direct_added(FALSE), value(0), arg_cache(0), cmp(0),
cmp_sign(sign), was_values(TRUE)
{ collation.set(&my_charset_bin); }
- Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
- :Item_sum(thd, item),
- Type_handler_hybrid_field_type(item),
+ Item_sum_min_max(THD *thd, Item_sum_min_max *item)
+ :Item_sum_hybrid(thd, item),
direct_added(FALSE), value(item->value), arg_cache(0),
cmp_sign(item->cmp_sign), was_values(item->was_values)
{ }
@@ -1088,8 +1111,6 @@ protected:
{
return get_arg(0)->real_type_handler();
}
- const Type_handler *type_handler() const
- { return Type_handler_hybrid_field_type::type_handler(); }
const TYPELIB *get_typelib() const { return args[0]->get_typelib(); }
void update_field();
void min_max_update_str_field();
@@ -1105,11 +1126,11 @@ protected:
};
-class Item_sum_min :public Item_sum_hybrid
+class Item_sum_min :public Item_sum_min_max
{
public:
- Item_sum_min(THD *thd, Item *item_par): Item_sum_hybrid(thd, item_par, 1) {}
- Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_hybrid(thd, item) {}
+ Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {}
+ Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_min_max(thd, item) {}
enum Sumfunctype sum_func () const {return MIN_FUNC;}
bool add();
@@ -1120,11 +1141,11 @@ public:
};
-class Item_sum_max :public Item_sum_hybrid
+class Item_sum_max :public Item_sum_min_max
{
public:
- Item_sum_max(THD *thd, Item *item_par): Item_sum_hybrid(thd, item_par, -1) {}
- Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_hybrid(thd, item) {}
+ Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {}
+ Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_min_max(thd, item) {}
enum Sumfunctype sum_func () const {return MAX_FUNC;}
bool add();
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 97961a5e378..0057ed45c7d 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1220,7 +1220,7 @@ bool Item_func_unix_timestamp::get_timestamp_value(my_time_t *seconds,
Timestamp_or_zero_datetime_native_null native(current_thd, args[0], true);
if ((null_value= native.is_null() || native.is_zero_datetime()))
return true;
- Timestamp_or_zero_datetime tm(native);
+ Timestamp tm(native);
*seconds= tm.tv().tv_sec;
*second_part= tm.tv().tv_usec;
return false;
diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
index 8eb4692b36e..f20d20c81d6 100644
--- a/sql/item_windowfunc.cc
+++ b/sql/item_windowfunc.cc
@@ -171,7 +171,8 @@ void Item_window_func::split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
bool Item_window_func::check_result_type_of_order_item()
{
- if (only_single_element_order_list())
+ switch (window_func()->sum_func()) {
+ case Item_sum::PERCENTILE_CONT_FUNC:
{
Item_result rtype= window_spec->order_list->first->item[0]->cmp_type();
// TODO (varun) : support date type in percentile_cont function
@@ -179,9 +180,29 @@ bool Item_window_func::check_result_type_of_order_item()
rtype != DECIMAL_RESULT && rtype != TIME_RESULT)
{
my_error(ER_WRONG_TYPE_FOR_PERCENTILE_FUNC, MYF(0), window_func()->func_name());
- return TRUE;
+ return true;
+ }
+ return false;
+ }
+ case Item_sum::PERCENTILE_DISC_FUNC:
+ {
+ Item *src_item= window_spec->order_list->first->item[0];
+ Item_result rtype= src_item->cmp_type();
+ // TODO-10.5: Fix MDEV-20280 PERCENTILE_DISC() rejects temporal and string input
+ if (rtype != REAL_RESULT && rtype != INT_RESULT && rtype != DECIMAL_RESULT)
+ {
+ my_error(ER_WRONG_TYPE_FOR_PERCENTILE_FUNC, MYF(0), window_func()->func_name());
+ return true;
}
- setting_handler_for_percentile_functions(rtype);
+ Item_sum_percentile_disc *func=
+ static_cast<Item_sum_percentile_disc*>(window_func());
+ func->set_handler(src_item->type_handler());
+ func->Type_std_attributes::set(src_item);
+ Type_std_attributes::set(src_item);
+ return false;
+ }
+ default:
+ break;
}
return FALSE;
}
@@ -331,39 +352,15 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
if (args[i]->fix_fields_if_needed_for_scalar(thd, &args[i]))
return TRUE;
}
- Type_std_attributes::set(args[0]);
+
for (uint i= 0; i < arg_count && !m_with_subquery; i++)
m_with_subquery|= args[i]->with_subquery();
- Item *item2= args[0]->real_item();
- if (item2->type() == Item::FIELD_ITEM)
- set_handler(item2->type_handler());
- else if (args[0]->cmp_type() == TIME_RESULT)
- set_handler(item2->type_handler());
- else
- set_handler_by_result_type(item2->result_type(),
- max_length, collation.collation);
+ if (fix_length_and_dec())
+ return true;
- switch (result_type()) {
- case INT_RESULT:
- case DECIMAL_RESULT:
- case STRING_RESULT:
- break;
- case REAL_RESULT:
- max_length= float_length(decimals);
- break;
- case ROW_RESULT:
- case TIME_RESULT:
- DBUG_ASSERT(0); // XXX(cvicentiu) Should this never happen?
- return TRUE;
- };
setup_hybrid(thd, args[0]);
- /* MIN/MAX can return NULL for empty set indepedent of the used column */
- maybe_null= 1;
result_field=0;
- null_value=1;
- if (fix_length_and_dec())
- return TRUE;
if (check_sum_func(thd, ref))
return TRUE;
@@ -375,6 +372,14 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
return FALSE;
}
+
+bool Item_sum_hybrid_simple::fix_length_and_dec()
+{
+ maybe_null= null_value= true;
+ return args[0]->type_handler()->Item_sum_hybrid_fix_length_and_dec(this);
+}
+
+
bool Item_sum_hybrid_simple::add()
{
value->store(args[0]);
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index f858378de25..ab0e914a4c4 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -291,24 +291,22 @@ class Item_sum_dense_rank: public Item_sum_int
{ return get_item_copy<Item_sum_dense_rank>(thd, this); }
};
-class Item_sum_hybrid_simple : public Item_sum,
- public Type_handler_hybrid_field_type
+class Item_sum_hybrid_simple : public Item_sum_hybrid
{
public:
Item_sum_hybrid_simple(THD *thd, Item *arg):
- Item_sum(thd, arg),
- Type_handler_hybrid_field_type(&type_handler_longlong),
+ Item_sum_hybrid(thd, arg),
value(NULL)
- { collation.set(&my_charset_bin); }
+ { }
Item_sum_hybrid_simple(THD *thd, Item *arg1, Item *arg2):
- Item_sum(thd, arg1, arg2),
- Type_handler_hybrid_field_type(&type_handler_longlong),
+ Item_sum_hybrid(thd, arg1, arg2),
value(NULL)
- { collation.set(&my_charset_bin); }
+ { }
bool add();
bool fix_fields(THD *, Item **);
+ bool fix_length_and_dec();
void setup_hybrid(THD *thd, Item *item);
double val_real();
longlong val_int();
@@ -1103,17 +1101,6 @@ public:
}
}
- void setting_handler_for_percentile_functions(Item_result rtype) const
- {
- switch (window_func()->sum_func()){
- case Item_sum::PERCENTILE_DISC_FUNC:
- ((Item_sum_percentile_disc* ) window_func())->set_handler_by_cmp_type(rtype);
- break;
- default:
- return;
- }
- }
-
bool check_result_type_of_order_item();
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 42ed6a3addf..d320b51879a 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+/* Copyright (c) 2005, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 9a0f1d53609..ce34697d9bd 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -1,8 +1,7 @@
#ifndef ITEM_XMLFUNC_INCLUDED
#define ITEM_XMLFUNC_INCLUDED
-/* Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 78287c8e04c..695616f9269 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5786,7 +5786,7 @@ int mysqld_main(int argc, char **argv)
/* Signal threads waiting for server to be started */
mysql_mutex_lock(&LOCK_server_started);
mysqld_server_started= 1;
- mysql_cond_signal(&COND_server_started);
+ mysql_cond_broadcast(&COND_server_started);
mysql_mutex_unlock(&LOCK_server_started);
MYSQL_SET_STAGE(0 ,__FILE__, __LINE__);
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 6ab216188ee..a159434f14b 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -874,7 +874,7 @@ rpl_slave_state::gtid_delete_pending(THD *thd,
Query_tables_list lex_backup;
TABLE_LIST tlist;
TABLE *table;
- handler::Table_flags direct_pos;
+ handler::Table_flags direct_pos= 0;
list_element *cur, **cur_ptr_ptr;
bool table_opened= false;
bool index_inited= false;
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 1aca3243f2b..5ba0c73e042 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -380,11 +380,15 @@ bool Session_sysvars_tracker::enable(THD *thd)
bool Session_sysvars_tracker::update(THD *thd, set_var *var)
{
vars_list tool_list;
- void *copy= var->save_result.string_value.str ?
- my_memdup(var->save_result.string_value.str,
- var->save_result.string_value.length + 1,
- MYF(MY_WME | MY_THREAD_SPECIFIC)) :
- my_strdup("", MYF(MY_WME | MY_THREAD_SPECIFIC));
+ void *copy;
+ size_t length= 1;
+
+ if (var->save_result.string_value.str)
+ copy= my_memdup(var->save_result.string_value.str,
+ (length= var->save_result.string_value.length + 1),
+ MYF(MY_WME | MY_THREAD_SPECIFIC));
+ else
+ copy= my_strdup("", MYF(MY_WME | MY_THREAD_SPECIFIC));
if (!copy)
return true;
@@ -402,7 +406,7 @@ bool Session_sysvars_tracker::update(THD *thd, set_var *var)
m_parsed= true;
orig_list.copy(&tool_list, thd);
orig_list.construct_var_list(thd->variables.session_track_system_variables,
- var->save_result.string_value.length + 1);
+ length);
return false;
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e934183c1d6..6537f5ad1bc 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -4315,7 +4315,7 @@ static int replace_user_table(THD *thd, const User_table &user_table,
bool handle_as_role= combo->is_role();
LEX *lex= thd->lex;
TABLE *table= user_table.table();
- ACL_USER new_acl_user, *old_acl_user;
+ ACL_USER new_acl_user, *old_acl_user= 0;
DBUG_ENTER("replace_user_table");
mysql_mutex_assert_owner(&acl_cache->lock);
@@ -12650,6 +12650,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin;
DBUG_EXECUTE_IF("auth_disconnect", { DBUG_RETURN(1); });
+ DBUG_EXECUTE_IF("auth_invalid_plugin", client_auth_plugin="foo/bar"; );
DBUG_ASSERT(client_auth_plugin);
/*
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 9a646ebb822..9078396a575 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2480,7 +2480,6 @@ bool THD::check_string_for_wellformedness(const char *str,
size_t length,
CHARSET_INFO *cs) const
{
- DBUG_ASSERT(charset_is_system_charset);
size_t wlen= Well_formed_prefix(cs, str, length).length();
if (wlen < length)
{
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 26646d5c73f..a965a7115d2 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
@@ -351,8 +351,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
THD_STAGE_INFO(thd, stage_init_update);
- bool truncate_history= table_list->vers_conditions.is_set();
- if (truncate_history)
+ bool delete_history= table_list->vers_conditions.is_set();
+ if (delete_history)
{
DBUG_ASSERT(!table_list->period_conditions.is_set());
@@ -401,7 +401,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
select_lex->item_list, &conds,
&delete_while_scanning))
DBUG_RETURN(TRUE);
-
+
+ if (delete_history)
+ table->vers_write= false;
+
if (with_select)
(void) result->prepare(select_lex->item_list, NULL);
@@ -752,7 +755,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
while (!(error=info.read_record()) && !thd->killed &&
! thd->is_error())
{
- if (record_should_be_deleted(thd, table, select, explain, truncate_history))
+ if (record_should_be_deleted(thd, table, select, explain, delete_history))
{
table->file->position(table->record[0]);
if (unlikely((error=
@@ -801,10 +804,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{
if (delete_while_scanning)
delete_record= record_should_be_deleted(thd, table, select, explain,
- truncate_history);
+ delete_history);
if (delete_record)
{
- if (!truncate_history && table->triggers &&
+ if (!delete_history && table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))
{
@@ -840,7 +843,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (likely(!error))
{
deleted++;
- if (!truncate_history && table->triggers &&
+ if (!delete_history && table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE))
{
@@ -1633,6 +1636,7 @@ bool multi_delete::send_eof()
thd->clear_error();
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
+ thd->thread_specific_used= TRUE;
if (unlikely(thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
transactional_tables, FALSE, FALSE,
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index bb35949884c..7d399464e4c 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -4065,8 +4065,12 @@ void select_insert::abort_result_set() {
example), no table will have been opened and therefore 'table'
will be NULL. In that case, we still need to execute the rollback
and the end of the function.
+
+ If it fail due to inability to insert in multi-table view for example,
+ table will be assigned with view table structure, but that table will
+ not be opened really (it is dummy to check fields types & Co).
*/
- if (table)
+ if (table && table->file->get_table())
{
bool changed, transactional_table;
/*
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 0ff4d5f7684..15d83b15ac9 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -3075,14 +3075,13 @@ void st_select_lex::print_limit(THD *thd,
if (item && unit->global_parameters() == this)
{
Item_subselect::subs_type subs_type= item->substype();
- if (subs_type == Item_subselect::EXISTS_SUBS ||
- subs_type == Item_subselect::IN_SUBS ||
+ if (subs_type == Item_subselect::IN_SUBS ||
subs_type == Item_subselect::ALL_SUBS)
{
return;
}
}
- if (explicit_limit)
+ if (explicit_limit && select_limit)
{
str->append(STRING_WITH_LEN(" limit "));
if (offset_limit)
@@ -5519,6 +5518,19 @@ bool LEX::push_context(Name_resolution_context *context)
}
+Name_resolution_context *LEX::pop_context()
+{
+ DBUG_ENTER("LEX::pop_context");
+ Name_resolution_context *context= context_stack.pop();
+ DBUG_PRINT("info", ("Context: %p Select: %p (%d)",
+ context, context->select_lex,
+ (context->select_lex ?
+ context->select_lex->select_number:
+ 0)));
+ DBUG_RETURN(context);
+}
+
+
SELECT_LEX *LEX::create_priority_nest(SELECT_LEX *first_in_nest)
{
DBUG_ENTER("LEX::create_priority_nest");
@@ -7894,8 +7906,9 @@ bool st_select_lex::collect_grouping_fields(THD *thd)
Item *item= *ord->item;
if (item->type() != Item::FIELD_ITEM &&
!(item->type() == Item::REF_ITEM &&
- ((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) ||
- (((Item_ref *) item)->ref_type() == Item_ref::REF))))
+ item->real_type() == Item::FIELD_ITEM &&
+ ((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) ||
+ (((Item_ref *) item)->ref_type() == Item_ref::REF))))
continue;
Field_pair *grouping_tmp_field=
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index bff6d921d7a..b916d07ba7c 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
@@ -1350,6 +1350,8 @@ public:
TABLE_LIST *end_nested_join(THD *thd);
TABLE_LIST *nest_last_join(THD *thd);
void add_joined_table(TABLE_LIST *table);
+ bool add_cross_joined_table(TABLE_LIST *left_op, TABLE_LIST *right_op,
+ bool straight_fl);
TABLE_LIST *convert_right_join();
List<Item>* get_item_list();
ulong get_table_join_options();
@@ -3586,22 +3588,7 @@ public:
bool push_context(Name_resolution_context *context);
- void pop_context()
- {
- DBUG_ENTER("LEX::pop_context");
-#ifndef DBUG_OFF
- Name_resolution_context *context=
-#endif
- context_stack.pop();
-
- DBUG_PRINT("info", ("Pop context %p Select: %p (%d)",
- context, context->select_lex,
- (context->select_lex ?
- context->select_lex->select_number:
- 0)));
-
- DBUG_VOID_RETURN;
- }
+ Name_resolution_context *pop_context();
SELECT_LEX *select_stack_head()
{
@@ -4592,15 +4579,18 @@ public:
class Yacc_state
{
public:
- Yacc_state()
- {
- reset();
- }
+ Yacc_state() : yacc_yyss(NULL), yacc_yyvs(NULL) { reset(); }
void reset()
{
- yacc_yyss= NULL;
- yacc_yyvs= NULL;
+ if (yacc_yyss != NULL) {
+ my_free(yacc_yyss);
+ yacc_yyss = NULL;
+ }
+ if (yacc_yyvs != NULL) {
+ my_free(yacc_yyvs);
+ yacc_yyvs = NULL;
+ }
m_set_signal_info.clear();
m_lock_type= TL_READ_DEFAULT;
m_mdl_type= MDL_SHARED_READ;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 869ece6a398..a030f547d59 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -8299,6 +8299,13 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd)
List<TABLE_LIST> *embedded_list;
DBUG_ENTER("nest_last_join");
+ TABLE_LIST *head= join_list->head();
+ if (head->nested_join && head->nested_join->nest_type & REBALANCED_NEST)
+ {
+ join_list->empty();
+ DBUG_RETURN(head);
+ }
+
if (unlikely(!(ptr= (TABLE_LIST*) thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST))+
sizeof(NESTED_JOIN)))))
DBUG_RETURN(0);
@@ -8311,6 +8318,7 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd)
ptr->alias.length= sizeof("(nest_last_join)")-1;
embedded_list= &nested_join->join_list;
embedded_list->empty();
+ nested_join->nest_type= JOIN_OP_NEST;
for (uint i=0; i < 2; i++)
{
@@ -8361,6 +8369,232 @@ void st_select_lex::add_joined_table(TABLE_LIST *table)
/**
+ @brief
+ Create a node for JOIN/INNER JOIN/CROSS JOIN/STRAIGHT_JOIN operation
+
+ @param left_op the node for the left operand constructed by the parser
+ @param right_op the node for the right operand constructed by the parser
+ @param straight_fl TRUE if STRAIGHT_JOIN is used
+
+ @retval
+ false on success
+ true otherwise
+
+ @details
+
+ JOIN operator can be left-associative with other join operators in one
+ context and right-associative in another context.
+
+ In this query
+ SELECT * FROM t1 JOIN t2 LEFT JOIN t3 ON t2.a=t3.a (Q1)
+ JOIN is left-associative and the query Q1 is interpreted as
+ SELECT * FROM (t1 JOIN t2) LEFT JOIN t3 ON t2.a=t3.a.
+ While in this query
+ SELECT * FROM t1 JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.b=t2.b (Q2)
+ JOIN is right-associative and the query Q2 is interpreted as
+ SELECT * FROM t1 JOIN (t2 LEFT JOIN t3 ON t2.a=t3.a) ON t1.b=t2.b
+
+ JOIN is right-associative if it is used with ON clause or with USING clause.
+ Otherwise it is left-associative.
+ When parsing a join expression with JOIN operator we can't determine
+ whether this operation left or right associative until either we read the
+ corresponding ON clause or we reach the end of the expression. This creates
+ a problem for the parser to build a proper internal representation of the
+ used join expression.
+
+ For Q1 and Q2 the trees representing the used join expressions look like
+
+ LJ - ON J - ON
+ / \ / \
+ J t3 (TQ1) t1 LJ - ON (TQ2)
+ / \ / \
+ t1 t2 t2 t3
+
+ To build TQ1 the parser has to reduce the expression for JOIN right after
+ it has read the reference to t2. To build TQ2 the parser reduces JOIN
+ when he has read the whole join expression. There is no way to determine
+ whether an early reduction is needed until the whole join expression is
+ read.
+ A solution here is always to do a late reduction. In this case the parser
+ first builds an incorrect tree TQ1* that has to be rebalanced right after
+ it has been constructed.
+
+ J LJ - ON
+ / \ / \
+ t1 LJ - ON (TQ1*) => J t3
+ / \ / \
+ t2 t3 t1 t2
+
+ Actually the transformation is performed over the nodes t1 and LJ before the
+ node for J is created in the function st_select_lex::add_cross_joined_table.
+ The function creates a node for J which replaces the node t2. Then it
+ attaches the nodes t1 and t2 to this newly created node. The node LJ becomes
+ the top node of the tree.
+
+ For the query
+ SELECT * FROM t1 JOIN t2 RIGHT JOIN t3 ON t2.a=t3.a (Q3)
+ the transformation looks slightly differently because the parser
+ replaces the RIGHT JOIN tree for an equivalent LEFT JOIN tree.
+
+ J LJ - ON
+ / \ / \
+ t1 LJ - ON (TQ3*) => J t2
+ / \ / \
+ t3 t2 t1 t3
+
+ With several left associative JOINs
+ SELECT * FROM t1 JOIN t2 JOIN t3 LEFT JOIN t4 ON t3.a=t4.a (Q4)
+ the newly created node for JOIN replaces the left most node of the tree:
+
+ J1 LJ - ON
+ / \ / \
+ t1 LJ - ON J2 t4
+ / \ => / \
+ J2 t4 J1 t3
+ / \ / \
+ t2 t3 t1 t2
+
+ Here's another example:
+ SELECT *
+ FROM t1 JOIN t2 LEFT JOIN t3 JOIN t4 ON t3.a=t4.a ON t2.b=t3.b (Q5)
+
+ J LJ - ON
+ / \ / \
+ t1 LJ - ON J J - ON
+ / \ => / \ / \
+ t2 J - ON t1 t2 t3 t4
+ / \
+ t3 t4
+
+ If the transformed nested join node node is a natural join node like in
+ the following query
+ SELECT * FROM t1 JOIN t2 LEFT JOIN t3 USING(a) (Q6)
+ the transformation additionally has to take care about setting proper
+ references in the field natural_join for both operands of the natural
+ join operation.
+ The function also has to change the name resolution context for ON
+ expressions used in the transformed join expression to take into
+ account the tables of the left_op node.
+*/
+
+bool st_select_lex::add_cross_joined_table(TABLE_LIST *left_op,
+ TABLE_LIST *right_op,
+ bool straight_fl)
+{
+ DBUG_ENTER("add_cross_joined_table");
+ THD *thd= parent_lex->thd;
+ if (!(right_op->nested_join &&
+ (right_op->nested_join->nest_type & JOIN_OP_NEST)))
+ {
+ /*
+ This handles the cases when the right operand is not a nested join.
+ like in queries
+ SELECT * FROM t1 JOIN t2;
+ SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a JOIN t3
+ */
+ add_joined_table(left_op);
+ add_joined_table(right_op);
+ right_op->straight= straight_fl;
+ DBUG_RETURN(false);
+ }
+
+ TABLE_LIST *tbl;
+ List<TABLE_LIST> *jl= &right_op->nested_join->join_list;
+ TABLE_LIST *cj_nest;
+
+ add_joined_table(right_op);
+
+ /*
+ Create the node NJ for a new nested join for the future inclusion
+ of left_op in it. Initially the nest is empty.
+ */
+ if (unlikely(!(cj_nest=
+ (TABLE_LIST*) thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST))+
+ sizeof(NESTED_JOIN)))))
+ DBUG_RETURN(true);
+ cj_nest->nested_join=
+ ((NESTED_JOIN*) ((uchar*) cj_nest + ALIGN_SIZE(sizeof(TABLE_LIST))));
+ cj_nest->nested_join->nest_type= JOIN_OP_NEST;
+ List<TABLE_LIST> *cjl= &cj_nest->nested_join->join_list;
+ cjl->empty();
+
+ /* Look for the left most node tbl of the right_op tree */
+ for ( ; ; )
+ {
+ TABLE_LIST *pair_tbl= 0; /* useful only for operands of natural joins */
+
+ List_iterator<TABLE_LIST> li(*jl);
+ tbl= li++;
+
+ /* Expand name resolution context */
+ Name_resolution_context *on_context;
+ if ((on_context= tbl->on_context))
+ {
+ on_context->first_name_resolution_table=
+ left_op->first_leaf_for_name_resolution();
+ }
+
+ if (!(tbl->outer_join & JOIN_TYPE_RIGHT))
+ {
+ pair_tbl= tbl;
+ tbl= li++;
+ }
+ if (tbl->nested_join &&
+ tbl->nested_join->nest_type & JOIN_OP_NEST)
+ {
+ jl= &tbl->nested_join->join_list;
+ continue;
+ }
+
+ /* Replace the tbl node in the tree for the newly created NJ node */
+ cj_nest->outer_join= tbl->outer_join;
+ cj_nest->on_expr= tbl->on_expr;
+ cj_nest->embedding= tbl->embedding;
+ cj_nest->join_list= jl;
+ cj_nest->alias.str= "(nest_last_join)";
+ cj_nest->alias.length= sizeof("(nest_last_join)")-1;
+ li.replace(cj_nest);
+
+ /*
+ If tbl is an operand of a natural join set properly the references
+ in the fields natural_join for both operands of the operation.
+ */
+ if(tbl->embedding && tbl->embedding->is_natural_join)
+ {
+ if (!pair_tbl)
+ pair_tbl= li++;
+ pair_tbl->natural_join= cj_nest;
+ cj_nest->natural_join= pair_tbl;
+ }
+ break;
+ }
+
+ /* Attach tbl as the right operand of NJ */
+ if (unlikely(cjl->push_back(tbl, thd->mem_root)))
+ DBUG_RETURN(true);
+ tbl->outer_join= 0;
+ tbl->on_expr= 0;
+ tbl->straight= straight_fl;
+ tbl->natural_join= 0;
+ tbl->embedding= cj_nest;
+ tbl->join_list= cjl;
+
+ /* Add left_op as the left operand of NJ */
+ if (unlikely(cjl->push_back(left_op, thd->mem_root)))
+ DBUG_RETURN(true);
+ left_op->embedding= cj_nest;
+ left_op->join_list= cjl;
+
+ /*
+ Mark right_op as a rebalanced nested join in order not to
+ create a new top level nested join node.
+ */
+ right_op->nested_join->nest_type|= REBALANCED_NEST;
+ DBUG_RETURN(false);
+}
+
+
+/**
Convert a right join into equivalent left join.
The function takes the current join list t[0],t[1] ... and
@@ -8681,7 +8915,7 @@ void add_join_on(THD *thd, TABLE_LIST *b, Item *expr)
SELECT * FROM t1, t2 WHERE (t1.j=t2.j and <some_cond>)
@endverbatim
- @param a Left join argument
+ @param a Left join argumentex
@param b Right join argument
@param using_fields Field names from USING clause
*/
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 4279cc25010..5fd3d0f0f6b 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -729,9 +729,9 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, myf MyFlags)
This is done to ensure that only approved libraries from the
plugin directory are used (to make this even remotely secure).
*/
- if (check_valid_path(dl->str, dl->length) ||
- check_string_char_length((LEX_CSTRING *) dl, 0, NAME_CHAR_LEN,
+ if (check_string_char_length((LEX_CSTRING *) dl, 0, NAME_CHAR_LEN,
system_charset_info, 1) ||
+ check_valid_path(dl->str, dl->length) ||
plugin_dir_len + dl->length + 1 >= FN_REFLEN)
{
my_error(ER_UDF_NO_PATHS, MyFlags);
@@ -1846,6 +1846,9 @@ static void plugin_load(MEM_ROOT *tmp_root)
LEX_CSTRING name= {str_name.ptr(), str_name.length()};
LEX_CSTRING dl= {str_dl.ptr(), str_dl.length()};
+ if (!name.length || !dl.length)
+ continue;
+
/*
there're no other threads running yet, so we don't need a mutex.
but plugin_add() before is designed to work in multi-threaded
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b09f8256e9c..3977dd9017b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1812,7 +1812,6 @@ JOIN::optimize_inner()
DBUG_RETURN(1); /* purecov: inspected */
/* dump_TABLE_LIST_graph(select_lex, select_lex->leaf_tables); */
select_lex->update_used_tables();
-
}
eval_select_list_used_tables();
@@ -1882,6 +1881,8 @@ JOIN::optimize_inner()
sel->where= conds;
+ select_lex->update_used_tables();
+
if (arena)
thd->restore_active_arena(arena, &backup);
}
@@ -9386,6 +9387,11 @@ best_extension_by_limited_search(JOIN *join,
current_record_count /
(double) TIME_FOR_COMPARE));
+ if (unlikely(thd->trace_started()))
+ {
+ trace_one_table.add("rows_for_plan", current_record_count);
+ trace_one_table.add("cost_for_plan", current_read_time);
+ }
advance_sj_state(join, remaining_tables, idx, &current_record_count,
&current_read_time, &loose_scan_pos);
@@ -9444,6 +9450,10 @@ best_extension_by_limited_search(JOIN *join,
remaining_tables &
~real_table_bit);
join->positions[idx].cond_selectivity= pushdown_cond_selectivity;
+
+ if (unlikely(thd->trace_started()) && pushdown_cond_selectivity < 1.0)
+ trace_one_table.add("selectivity", pushdown_cond_selectivity);
+
double partial_join_cardinality= current_record_count *
pushdown_cond_selectivity;
if ( (search_depth > 1) && (remaining_tables & ~real_table_bit) & allowed_tables )
@@ -14336,21 +14346,38 @@ bool check_simple_equality(THD *thd, const Item::Context &ctx,
{
Item *orig_left_item= left_item;
Item *orig_right_item= right_item;
- if (left_item->type() == Item::REF_ITEM &&
- (((Item_ref*)left_item)->ref_type() == Item_ref::VIEW_REF ||
- ((Item_ref*)left_item)->ref_type() == Item_ref::REF))
+ if (left_item->type() == Item::REF_ITEM)
{
- if (((Item_ref*)left_item)->get_depended_from())
- return FALSE;
- left_item= left_item->real_item();
+ Item_ref::Ref_Type left_ref= ((Item_ref*)left_item)->ref_type();
+
+ if (left_ref == Item_ref::VIEW_REF ||
+ left_ref == Item_ref::REF)
+ {
+ if (((Item_ref*)left_item)->get_depended_from())
+ return FALSE;
+ if (left_ref == Item_ref::VIEW_REF &&
+ ((Item_direct_view_ref*)left_item)->get_null_ref_table() !=
+ NO_NULL_TABLE &&
+ !left_item->real_item()->used_tables())
+ return FALSE;
+ left_item= left_item->real_item();
+ }
}
- if (right_item->type() == Item::REF_ITEM &&
- (((Item_ref*)right_item)->ref_type() == Item_ref::VIEW_REF ||
- ((Item_ref*)right_item)->ref_type() == Item_ref::REF))
+ if (right_item->type() == Item::REF_ITEM)
{
- if (((Item_ref*)right_item)->get_depended_from())
- return FALSE;
- right_item= right_item->real_item();
+ Item_ref::Ref_Type right_ref= ((Item_ref*)right_item)->ref_type();
+ if (right_ref == Item_ref::VIEW_REF ||
+ (right_ref == Item_ref::REF))
+ {
+ if (((Item_ref*)right_item)->get_depended_from())
+ return FALSE;
+ if (right_ref == Item_ref::VIEW_REF &&
+ ((Item_direct_view_ref*)right_item)->get_null_ref_table() !=
+ NO_NULL_TABLE &&
+ !right_item->real_item()->used_tables())
+ return FALSE;
+ right_item= right_item->real_item();
+ }
}
if (left_item->type() == Item::FIELD_ITEM &&
right_item->type() == Item::FIELD_ITEM &&
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 1cf1050983f..34c0e0abc6c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2419,7 +2419,7 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
packet->append(STRING_WITH_LEN(" USING BTREE"));
if (key_info->algorithm == HA_KEY_ALG_HASH ||
- key_info->algorithm == HA_KEY_ALG_LONG_HASH)
+ key_info->algorithm == HA_KEY_ALG_LONG_HASH)
packet->append(STRING_WITH_LEN(" USING HASH"));
/* send USING only in non-default case: non-spatial rtree */
@@ -6531,6 +6531,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
{
show_table->file->info(HA_STATUS_VARIABLE |
HA_STATUS_NO_LOCK |
+ HA_STATUS_CONST |
HA_STATUS_TIME);
set_statistics_for_table(thd, show_table);
}
@@ -6565,18 +6566,23 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
"D" : "A"), 1, cs);
table->field[8]->set_notnull();
}
- KEY *key=show_table->key_info+i;
- if (key->rec_per_key[j] && key->algorithm != HA_KEY_ALG_LONG_HASH)
- {
- ha_rows records= (ha_rows) ((double) show_table->stat_records() /
- key->actual_rec_per_key(j));
- table->field[9]->store((longlong) records, TRUE);
- table->field[9]->set_notnull();
- }
- if (key->algorithm == HA_KEY_ALG_LONG_HASH)
+ if (key_info->algorithm == HA_KEY_ALG_LONG_HASH)
table->field[13]->store(STRING_WITH_LEN("HASH"), cs);
else
{
+ /*
+ We have to use table key information to get the key statistics
+ from table as key_info points to TABLE_SHARE which has no
+ statistics.
+ */
+ KEY *key_info= show_table->key_info + i;
+ if (key_info->rec_per_key[j])
+ {
+ ha_rows records= (ha_rows) ((double) show_table->stat_records() /
+ key_info->actual_rec_per_key(j));
+ table->field[9]->store((longlong) records, TRUE);
+ table->field[9]->set_notnull();
+ }
const char *tmp= show_table->file->index_type(i);
table->field[13]->store(tmp, strlen(tmp), cs);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7d73ed83beb..bdf1d043e71 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
@@ -2563,8 +2563,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
table->table ? table->table->s : NULL));
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
- thd->thread_specific_used|= (trans_tmp_table_deleted ||
- non_trans_tmp_table_deleted);
+ thd->thread_specific_used= TRUE;
error= 0;
err:
if (wrong_tables.length())
@@ -3775,6 +3774,17 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str);
DBUG_RETURN(TRUE);
}
+ if (key->type == Key::PRIMARY && key->name.str &&
+ my_strcasecmp(system_charset_info, key->name.str, primary_key_name) != 0)
+ {
+ bool sav_abort_on_warning= thd->abort_on_warning;
+ thd->abort_on_warning= FALSE; /* Don't make an error out of this. */
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_NAME_FOR_INDEX,
+ "Name '%-.100s' ignored for PRIMARY key.",
+ key->name.str);
+ thd->abort_on_warning= sav_abort_on_warning;
+ }
}
tmp=file->max_keys();
if (*key_count > tmp)
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 289a3d4d98d..f9a16e72f0f 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -4458,53 +4458,24 @@ bool Type_handler_real_result::
/*************************************************************************/
-/**
- MAX/MIN for the traditional numeric types preserve the exact data type
- from Fields, but do not preserve the exact type from Items:
- MAX(float_field) -> FLOAT
- MAX(smallint_field) -> LONGLONG
- MAX(COALESCE(float_field)) -> DOUBLE
- MAX(COALESCE(smallint_field)) -> LONGLONG
- QQ: Items should probably be fixed to preserve the exact type.
-*/
-bool Type_handler_numeric::
- Item_sum_hybrid_fix_length_and_dec_numeric(Item_sum_hybrid *func,
- const Type_handler *handler)
- const
-{
- Item *item= func->arguments()[0];
- Item *item2= item->real_item();
- func->Type_std_attributes::set(item);
- /* MIN/MAX can return NULL for empty set indepedent of the used column */
- func->maybe_null= func->null_value= true;
- if (item2->type() == Item::FIELD_ITEM)
- func->set_handler(item2->type_handler());
- else
- func->set_handler(handler);
- return false;
-}
-
-
bool Type_handler_int_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- return Item_sum_hybrid_fix_length_and_dec_numeric(func,
- &type_handler_longlong);
+ return func->fix_length_and_dec_numeric(&type_handler_longlong);
}
bool Type_handler_bool::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- return Item_sum_hybrid_fix_length_and_dec_numeric(func, &type_handler_bool);
+ return func->fix_length_and_dec_numeric(&type_handler_bool);
}
bool Type_handler_real_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- (void) Item_sum_hybrid_fix_length_and_dec_numeric(func,
- &type_handler_double);
+ (void) func->fix_length_and_dec_numeric(&type_handler_double);
func->max_length= func->float_length(func->decimals);
return false;
}
@@ -4513,53 +4484,21 @@ bool Type_handler_real_result::
bool Type_handler_decimal_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- return Item_sum_hybrid_fix_length_and_dec_numeric(func,
- &type_handler_newdecimal);
+ return func->fix_length_and_dec_numeric(&type_handler_newdecimal);
}
-/**
- MAX(str_field) converts ENUM/SET to CHAR, and preserve all other types
- for Fields.
- QQ: This works differently from UNION, which preserve the exact data
- type for ENUM/SET if the joined ENUM/SET fields are equally defined.
- Perhaps should be fixed.
- MAX(str_item) chooses the best suitable string type.
-*/
bool Type_handler_string_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- Item *item= func->arguments()[0];
- Item *item2= item->real_item();
- func->Type_std_attributes::set(item);
- func->maybe_null= func->null_value= true;
- if (item2->type() == Item::FIELD_ITEM)
- {
- // Fields: convert ENUM/SET to CHAR, preserve the type otherwise.
- func->set_handler(item->type_handler());
- }
- else
- {
- // Items: choose VARCHAR/BLOB/MEDIUMBLOB/LONGBLOB, depending on length.
- func->set_handler(type_handler_varchar.
- type_handler_adjusted_to_max_octet_length(func->max_length,
- func->collation.collation));
- }
- return false;
+ return func->fix_length_and_dec_string();
}
-/**
- Traditional temporal types always preserve the type of the argument.
-*/
bool Type_handler_temporal_result::
Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *func) const
{
- Item *item= func->arguments()[0];
- func->Type_std_attributes::set(item);
- func->maybe_null= func->null_value= true;
- func->set_handler(item->type_handler());
- return false;
+ return func->fix_length_and_dec_generic();
}
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 677fac75bc8..a696ada93df 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -2462,6 +2462,10 @@ public:
}
bool to_TIME(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) const;
bool to_native(Native *to, uint decimals) const;
+ Datetime to_datetime(THD *thd) const
+ {
+ return Datetime(thd, *this);
+ }
long fraction_remainder(uint dec) const
{
return my_time_fraction_remainder(tv_usec, dec);
@@ -2502,7 +2506,7 @@ public:
- real TIMESTAMP (seconds and microseconds since epoch), or
- zero datetime '0000-00-00 00:00:00.000000'
*/
-class Timestamp_or_zero_datetime: public Timestamp
+class Timestamp_or_zero_datetime: protected Timestamp
{
bool m_is_zero_datetime;
public:
@@ -2519,14 +2523,11 @@ public:
Timestamp_or_zero_datetime(THD *thd, const MYSQL_TIME *ltime, uint *err_code);
Datetime to_datetime(THD *thd) const
{
- return Datetime(thd, *this);
+ if (is_zero_datetime())
+ return Datetime();
+ return Timestamp::to_datetime(thd);
}
bool is_zero_datetime() const { return m_is_zero_datetime; }
- const struct timeval &tv() const
- {
- DBUG_ASSERT(!is_zero_datetime());
- return Timestamp::tv();
- }
void trunc(uint decimals)
{
if (!is_zero_datetime())
@@ -2572,7 +2573,7 @@ public:
{
return is_zero_datetime() ?
Datetime() :
- Datetime(thd, Timestamp_or_zero_datetime(*this).tv());
+ Datetime(thd, Timestamp(*this).tv());
}
bool is_zero_datetime() const
{
@@ -4295,10 +4296,6 @@ public:
*/
class Type_handler_numeric: public Type_handler
{
-protected:
- bool Item_sum_hybrid_fix_length_and_dec_numeric(Item_sum_hybrid *func,
- const Type_handler *handler)
- const;
public:
const Name &default_value() const override;
String *print_item_value(THD *thd, Item *item, String *str) const override;
@@ -6810,10 +6807,6 @@ public:
{
return (m_type_handler= Type_handler::get_handler_by_result_type(type));
}
- const Type_handler *set_handler_by_cmp_type(Item_result type)
- {
- return (m_type_handler= Type_handler::get_handler_by_cmp_type(type));
- }
const Type_handler *set_handler_by_result_type(Item_result type,
uint max_octet_length,
CHARSET_INFO *cs)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index d70a124aa23..8fce24bfc3e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -829,10 +829,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 48 shift/reduce conflicts.
+ Currently there are 46 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 47
+%expect 46
/*
Comments for TOKENS.
@@ -1612,10 +1612,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> YEAR_SYM /* SQL-2003-R */
-%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
-/* A dummy token to force the priority of table_ref production in a join. */
-%left TABLE_REF_PRIORITY
-
/*
Give ESCAPE (in LIKE) a very low precedence.
This allows the concatenation operator || to be used on the right
@@ -1625,6 +1621,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left PREC_BELOW_ESCAPE
%left ESCAPE_SYM
+/* A dummy token to force the priority of table_ref production in a join. */
+%left CONDITIONLESS_JOIN
+%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT ON_SYM USING
+
%left SET_VAR
%left OR_SYM OR2_SYM
%left XOR
@@ -7004,7 +7004,12 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_blob, $2);
}
- | BLOB_ORACLE_SYM opt_field_length opt_compressed
+ | BLOB_ORACLE_SYM field_length opt_compressed
+ {
+ Lex->charset=&my_charset_bin;
+ $$.set(&type_handler_blob, $2);
+ }
+ | BLOB_ORACLE_SYM opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
@@ -11845,18 +11850,18 @@ join_table_list:
and are ignored.
*/
esc_table_ref:
- table_ref { $$=$1; }
- | '{' ident table_ref '}' { $$=$3; }
- ;
+ table_ref { $$=$1; }
+ | '{' ident table_ref '}' { $$=$3; }
+ ;
/* Equivalent to <table reference list> in the SQL:2003 standard. */
/* Warning - may return NULL in case of incomplete SELECT */
derived_table_list:
esc_table_ref
- {
- $$=$1;
- Select->add_joined_table($1);
- }
+ {
+ $$=$1;
+ Select->add_joined_table($1);
+ }
| derived_table_list ',' esc_table_ref
{
MYSQL_YYABORT_UNLESS($1 && ($$=$3));
@@ -11865,25 +11870,17 @@ derived_table_list:
;
/*
- Notice that JOIN is a left-associative operation, and it must be parsed
- as such, that is, the parser must process first the left join operand
- then the right one. Such order of processing ensures that the parser
- produces correct join trees which is essential for semantic analysis
- and subsequent optimization phases.
+ Notice that JOIN can be a left-associative operator in one context and
+ a right-associative operator in another context (see the comment for
+ st_select_lex::add_cross_joined_table).
*/
join_table:
/* INNER JOIN variants */
- /*
- Use %prec to evaluate production 'table_ref' before 'normal_join'
- so that [INNER | CROSS] JOIN is properly nested as other
- left-associative joins.
- */
- table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
+ table_ref normal_join table_ref %prec CONDITIONLESS_JOIN
{
MYSQL_YYABORT_UNLESS($1 && ($$=$3));
- Select->add_joined_table($1);
- Select->add_joined_table($3);
- $3->straight=$2;
+ if (unlikely(Select->add_cross_joined_table($1, $3, $2)))
+ MYSQL_YYABORT;
}
| table_ref normal_join table_ref
ON
@@ -11898,9 +11895,9 @@ join_table:
}
expr
{
- $3->straight=$2;
+ $3->straight=$2;
add_join_on(thd, $3, $6);
- Lex->pop_context();
+ $3->on_context= Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
| table_ref normal_join table_ref
@@ -11940,7 +11937,7 @@ join_table:
expr
{
add_join_on(thd, $5, $8);
- Lex->pop_context();
+ $5->on_context= Lex->pop_context();
$5->outer_join|=JOIN_TYPE_LEFT;
$$=$5;
Select->parsing_place= NO_MATTER;
@@ -11985,7 +11982,7 @@ join_table:
if (unlikely(!($$= lex->current_select->convert_right_join())))
MYSQL_YYABORT;
add_join_on(thd, $$, $8);
- Lex->pop_context();
+ $1->on_context= Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
| table_ref RIGHT opt_outer JOIN_SYM table_factor
@@ -12046,7 +12043,11 @@ use_partition:
table_factor:
table_primary_ident_opt_parens { $$= $1; }
| table_primary_derived_opt_parens { $$= $1; }
- | join_table_parens { $$= $1; }
+ | join_table_parens
+ {
+ $1->nested_join->nest_type= 0;
+ $$= $1;
+ }
| table_reference_list_parens { $$= $1; }
;
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 12dd6febb3a..290e13e16a0 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -294,10 +294,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
- Currently there are 50 shift/reduce conflicts.
+ Currently there are 49 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 50
+%expect 49
/*
Comments for TOKENS.
@@ -1077,10 +1077,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> YEAR_SYM /* SQL-2003-R */
-%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
-/* A dummy token to force the priority of table_ref production in a join. */
-%left TABLE_REF_PRIORITY
-
/*
Give ESCAPE (in LIKE) a very low precedence.
This allows the concatenation operator || to be used on the right
@@ -1090,6 +1086,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%left PREC_BELOW_ESCAPE
%left ESCAPE_SYM
+/* A dummy token to force the priority of table_ref production in a join. */
+%left CONDITIONLESS_JOIN
+%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT ON_SYM USING
+
%left SET_VAR
%left OR_SYM OR2_SYM
%left XOR
@@ -7055,7 +7055,12 @@ field_type_lob:
Lex->charset=&my_charset_bin;
$$.set(&type_handler_blob, $2);
}
- | BLOB_ORACLE_SYM opt_field_length opt_compressed
+ | BLOB_ORACLE_SYM field_length opt_compressed
+ {
+ Lex->charset=&my_charset_bin;
+ $$.set(&type_handler_blob, $2);
+ }
+ | BLOB_ORACLE_SYM opt_compressed
{
Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob);
@@ -11945,18 +11950,18 @@ join_table_list:
and are ignored.
*/
esc_table_ref:
- table_ref { $$=$1; }
- | '{' ident table_ref '}' { $$=$3; }
- ;
+ table_ref { $$=$1; }
+ | '{' ident table_ref '}' { $$=$3; }
+ ;
/* Equivalent to <table reference list> in the SQL:2003 standard. */
/* Warning - may return NULL in case of incomplete SELECT */
derived_table_list:
esc_table_ref
- {
- $$=$1;
- Select->add_joined_table($1);
- }
+ {
+ $$=$1;
+ Select->add_joined_table($1);
+ }
| derived_table_list ',' esc_table_ref
{
MYSQL_YYABORT_UNLESS($1 && ($$=$3));
@@ -11965,25 +11970,17 @@ derived_table_list:
;
/*
- Notice that JOIN is a left-associative operation, and it must be parsed
- as such, that is, the parser must process first the left join operand
- then the right one. Such order of processing ensures that the parser
- produces correct join trees which is essential for semantic analysis
- and subsequent optimization phases.
+ Notice that JOIN can be a left-associative operator in one context and
+ a right-associative operator in another context (see the comment for
+ st_select_lex::add_cross_joined_table).
*/
join_table:
/* INNER JOIN variants */
- /*
- Use %prec to evaluate production 'table_ref' before 'normal_join'
- so that [INNER | CROSS] JOIN is properly nested as other
- left-associative joins.
- */
- table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
+ table_ref normal_join table_ref %prec CONDITIONLESS_JOIN
{
MYSQL_YYABORT_UNLESS($1 && ($$=$3));
- Select->add_joined_table($1);
- Select->add_joined_table($3);
- $3->straight=$2;
+ if (unlikely(Select->add_cross_joined_table($1, $3, $2)))
+ MYSQL_YYABORT;
}
| table_ref normal_join table_ref
ON
@@ -11998,9 +11995,9 @@ join_table:
}
expr
{
- $3->straight=$2;
+ $3->straight=$2;
add_join_on(thd, $3, $6);
- Lex->pop_context();
+ $3->on_context= Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
| table_ref normal_join table_ref
@@ -12040,7 +12037,7 @@ join_table:
expr
{
add_join_on(thd, $5, $8);
- Lex->pop_context();
+ $5->on_context= Lex->pop_context();
$5->outer_join|=JOIN_TYPE_LEFT;
$$=$5;
Select->parsing_place= NO_MATTER;
@@ -12085,7 +12082,7 @@ join_table:
if (unlikely(!($$= lex->current_select->convert_right_join())))
MYSQL_YYABORT;
add_join_on(thd, $$, $8);
- Lex->pop_context();
+ $1->on_context= Lex->pop_context();
Select->parsing_place= NO_MATTER;
}
| table_ref RIGHT opt_outer JOIN_SYM table_factor
@@ -12146,7 +12143,11 @@ use_partition:
table_factor:
table_primary_ident_opt_parens { $$= $1; }
| table_primary_derived_opt_parens { $$= $1; }
- | join_table_parens { $$= $1; }
+ | join_table_parens
+ {
+ $1->nested_join->nest_type= 0;
+ $$= $1;
+ }
| table_reference_list_parens { $$= $1; }
;
@@ -16985,7 +16986,7 @@ table_lock:
? MDL_SHARED_WRITE
: MDL_SHARED_NO_READ_WRITE;
- if (unlikely(!Select->
+ if (unlikely(!Lex->current_select_or_default()->
add_table_to_list(thd, $1, $2, table_options,
lock_type, mdl_type)))
MYSQL_YYABORT;
diff --git a/sql/table.cc b/sql/table.cc
index e24404ab401..6951b21c53d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1184,8 +1184,8 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
{
List<Item> *field_list= new (mem_root) List<Item>();
Item *list_item;
- KEY *key;
- uint key_index, parts;
+ KEY *key= 0;
+ uint key_index, parts= 0;
for (key_index= 0; key_index < table->s->keys; key_index++)
{
key=table->key_info + key_index;
@@ -1193,7 +1193,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
if (key->key_part[parts].fieldnr == field->field_index + 1)
break;
}
- if (key->algorithm != HA_KEY_ALG_LONG_HASH)
+ if (!key || key->algorithm != HA_KEY_ALG_LONG_HASH)
goto end;
KEY_PART_INFO *keypart;
for (uint i=0; i < parts; i++)
@@ -5148,6 +5148,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
range_rowid_filter_cost_info= NULL;
update_handler= NULL;
check_unique_buf= NULL;
+ vers_write= s->versioned;
#ifdef HAVE_REPLICATION
/* used in RBR Triggers */
master_had_triggers= 0;
diff --git a/sql/table.h b/sql/table.h
index b256df25a80..2b866159fe0 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -59,6 +59,7 @@ class SEQUENCE;
class Range_rowid_filter_cost_info;
class derived_handler;
class Pushdown_derived;
+struct Name_resolution_context;
/*
Used to identify NESTED_JOIN structures within a join (applicable only to
@@ -2009,6 +2010,7 @@ struct TABLE_LIST
LEX_CSTRING alias;
const char *option; /* Used by cache index */
Item *on_expr; /* Used with outer join */
+ Name_resolution_context *on_context; /* For ON expressions */
Item *sj_on_expr;
/*
@@ -2770,9 +2772,31 @@ public:
};
+#define JOIN_OP_NEST 1
+#define REBALANCED_NEST 2
+
typedef struct st_nested_join
{
List<TABLE_LIST> join_list; /* list of elements in the nested join */
+ /*
+ Currently the valid values for nest type are:
+ JOIN_OP_NEST - for nest created for JOIN operation used as an operand in
+ a join expression, contains 2 elements;
+ JOIN_OP_NEST | REBALANCED_NEST - nest created after tree re-balancing
+ in st_select_lex::add_cross_joined_table(), contains 1 element;
+ 0 - for all other nests.
+ Examples:
+ 1. SELECT * FROM t1 JOIN t2 LEFT JOIN t3 ON t2.a=t3.a;
+ Here the nest created for LEFT JOIN at first has nest_type==JOIN_OP_NEST.
+ After re-balancing in st_select_lex::add_cross_joined_table() this nest
+ has nest_type==JOIN_OP_NEST | REBALANCED_NEST. The nest for JOIN created
+ in st_select_lex::add_cross_joined_table() has nest_type== JOIN_OP_NEST.
+ 2. SELECT * FROM t1 JOIN (t2 LEFT JOIN t3 ON t2.a=t3.a)
+ Here the nest created for LEFT JOIN has nest_type==0, because it's not
+ an operand in a join expression. The nest created for JOIN has nest_type
+ set to JOIN_OP_NEST.
+ */
+ uint nest_type;
/*
Bitmap of tables within this nested join (including those embedded within
its children), including tables removed by table elimination.
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 4bf980044e3..9427bf3175b 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -1314,7 +1314,7 @@ char *ha_connect::GetRealString(PCSZ s)
{
char *sv;
- if (IsPartitioned() && s && *partname) {
+ if (IsPartitioned() && s && partname && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
diff --git a/storage/connect/mysql-test/connect/disabled.def b/storage/connect/mysql-test/connect/disabled.def
index 827ed58b835..1de4deb0a60 100644
--- a/storage/connect/mysql-test/connect/disabled.def
+++ b/storage/connect/mysql-test/connect/disabled.def
@@ -9,15 +9,15 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-infoschema-9739 : Crashes with MariaDB 10.0
-jdbc : Variable settings depend on machine configuration
-jdbc_new : Variable settings depend on machine configuration
-jdbc_oracle : Variable settings depend on machine configuration
-jdbc_postgresql : Variable settings depend on machine configuration
-json_mongo_c : Need MongoDB running and its C Driver installed
-json_java_2 : Need MongoDB running and its Java Driver installed
-json_java_3 : Need MongoDB running and its Java Driver installed
-mongo_c : Need MongoDB running and its C Driver installed
-mongo_java_2 : Need MongoDB running and its Java Driver installed
-mongo_java_3 : Need MongoDB running and its Java Driver installed
-tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed
+jdbc : Variable settings depend on machine configuration
+jdbc_new : Variable settings depend on machine configuration
+jdbc_oracle : Variable settings depend on machine configuration
+jdbc_postgresql : Variable settings depend on machine configuration
+json_mongo_c : Need MongoDB running and its C Driver installed
+json_java_2 : Need MongoDB running and its Java Driver installed
+json_java_3 : Need MongoDB running and its Java Driver installed
+mongo_c : Need MongoDB running and its C Driver installed
+mongo_java_2 : Need MongoDB running and its Java Driver installed
+mongo_java_3 : Need MongoDB running and its Java Driver installed
+tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed
+#vcol : Different error code on different versions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 2c1cdb37a38..fd0ed4cb232 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -98,7 +98,7 @@ throughput clearly from about 100000. */
#define BTR_CUR_FINE_HISTORY_LENGTH 100000
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
-ulint btr_cur_n_non_sea;
+Atomic_counter<ulint> btr_cur_n_non_sea;
/** Old value of btr_cur_n_non_sea. Copied by
srv_refresh_innodb_monitor_stats(). Referenced by
srv_printf_innodb_monitor(). */
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index a17113fb9f1..b28fc48405d 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -1034,7 +1034,7 @@ inherited external field. */
#define BTR_EXTERN_INHERITED_FLAG 64U
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
-extern ulint btr_cur_n_non_sea;
+extern Atomic_counter<ulint> btr_cur_n_non_sea;
/** Old value of btr_cur_n_non_sea. Copied by
srv_refresh_innodb_monitor_stats(). Referenced by
srv_printf_innodb_monitor(). */
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index 449b5c4df68..f00664e2421 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -571,14 +571,6 @@ struct upd_node_t{
/* column assignment list */
ulint magic_n;
- /** Also set row_start = CURRENT_TIMESTAMP/trx->id
- @param[in] trx transaction */
- void make_versioned_update(const trx_t* trx);
- /** Only set row_end = CURRENT_TIMESTAMP/trx->id.
- Do not touch other fields at all.
- @param[in] trx transaction */
- void make_versioned_delete(const trx_t* trx);
-
private:
/** Appends row_start or row_end field to update vector and sets a
CURRENT_TIMESTAMP/trx->id value to it.
@@ -587,6 +579,24 @@ private:
@param[in] trx transaction
@param[in] vers_sys_idx table->row_start or table->row_end */
void make_versioned_helper(const trx_t* trx, ulint idx);
+
+public:
+ /** Also set row_start = CURRENT_TIMESTAMP/trx->id
+ @param[in] trx transaction */
+ void make_versioned_update(const trx_t* trx)
+ {
+ make_versioned_helper(trx, table->vers_start);
+ }
+
+ /** Only set row_end = CURRENT_TIMESTAMP/trx->id.
+ Do not touch other fields at all.
+ @param[in] trx transaction */
+ void make_versioned_delete(const trx_t* trx)
+ {
+ update->n_fields = 0;
+ is_delete = VERSIONED_DELETE;
+ make_versioned_helper(trx, table->vers_end);
+ }
};
#define UPD_NODE_MAGIC_N 1579975
diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc
index c2ec46158c6..b1ca82dd9ce 100644
--- a/storage/innobase/log/log0crypt.cc
+++ b/storage/innobase/log/log0crypt.cc
@@ -41,12 +41,6 @@ my_bool srv_encrypt_log;
struct aes_block_t {
byte bytes[MY_AES_BLOCK_SIZE];
-#ifdef HAVE_WOLFSSL
- // Workaround for MDEV-19582.
- // WolfSSL reads memory out of bounds with decrypt/NOPAD
- // Pad the structure to workaround
- byte pad[MY_AES_BLOCK_SIZE];
-#endif
};
struct crypt_info_t {
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index b6e31a2b017..25930cb86f1 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -42,14 +42,6 @@ Created 2011-05-26 Marko Makela
#include <algorithm>
#include <map>
-#ifdef HAVE_WOLFSSL
-// Workaround for MDEV-19582
-// (WolfSSL reads memory out of bounds with decryption/NOPAD)
-#define WOLFSSL_PAD_SIZE MY_AES_BLOCK_SIZE
-#else
-#define WOLFSSL_PAD_SIZE 0
-#endif
-
Atomic_counter<ulint> onlineddl_rowlog_rows;
ulint onlineddl_rowlog_pct_used;
ulint onlineddl_pct_progress;
@@ -301,7 +293,7 @@ row_log_block_allocate(
);
log_buf.block = ut_allocator<byte>(mem_key_row_log_buf)
- .allocate_large(srv_sort_buf_size + WOLFSSL_PAD_SIZE,
+ .allocate_large(srv_sort_buf_size,
&log_buf.block_pfx);
if (log_buf.block == NULL) {
@@ -323,7 +315,7 @@ row_log_block_free(
if (log_buf.block != NULL) {
ut_allocator<byte>(mem_key_row_log_buf).deallocate_large(
log_buf.block, &log_buf.block_pfx,
- log_buf.size + WOLFSSL_PAD_SIZE);
+ log_buf.size);
log_buf.block = NULL;
}
DBUG_VOID_RETURN;
@@ -3239,7 +3231,7 @@ row_log_allocate(
index->online_log = log;
if (log_tmp_is_encrypted()) {
- ulint size = srv_sort_buf_size + WOLFSSL_PAD_SIZE;
+ ulint size = srv_sort_buf_size;
log->crypt_head = static_cast<byte *>(os_mem_alloc_large(&size));
log->crypt_tail = static_cast<byte *>(os_mem_alloc_large(&size));
@@ -3273,13 +3265,11 @@ row_log_free(
row_merge_file_destroy_low(log->fd);
if (log->crypt_head) {
- os_mem_free_large(log->crypt_head, srv_sort_buf_size
- + WOLFSSL_PAD_SIZE);
+ os_mem_free_large(log->crypt_head, srv_sort_buf_size);
}
if (log->crypt_tail) {
- os_mem_free_large(log->crypt_tail, srv_sort_buf_size
- + WOLFSSL_PAD_SIZE);
+ os_mem_free_large(log->crypt_tail, srv_sort_buf_size);
}
mutex_free(&log->mutex);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 31166bdb94f..fbb5e7543a2 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -54,14 +54,6 @@ Completed by Sunny Bains and Marko Makela
# define posix_fadvise(fd, offset, len, advice) /* nothing */
#endif /* _WIN32 */
-#ifdef HAVE_WOLFSSL
-// Workaround for MDEV-19582
-// (WolfSSL accesses memory out of bounds)
-# define WOLFSSL_PAD_SIZE MY_AES_BLOCK_SIZE
-#else
-# define WOLFSSL_PAD_SIZE 0
-#endif
-
/* Whether to disable file system cache */
char srv_disable_sort_file_cache;
@@ -4638,7 +4630,7 @@ row_merge_build_indexes(
if (log_tmp_is_encrypted()) {
crypt_block = static_cast<row_merge_block_t*>(
- alloc.allocate_large(block_size + WOLFSSL_PAD_SIZE,
+ alloc.allocate_large(block_size,
&crypt_pfx));
if (crypt_block == NULL) {
@@ -5010,7 +5002,7 @@ func_exit:
if (crypt_block) {
alloc.deallocate_large(crypt_block, &crypt_pfx,
- block_size + WOLFSSL_PAD_SIZE);
+ block_size);
}
DICT_TF2_FLAG_UNSET(new_table, DICT_TF2_FTS_ADD_DOC_ID);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 19b8d4b8f43..5266b467091 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -3476,7 +3476,8 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
dict_index_t* clust_index = dict_table_get_first_index(table);
- /* row_create_update_node_for_mysql() pre-allocated this much */
+ /* row_create_update_node_for_mysql() pre-allocated this much.
+ At least one PK column always remains unchanged. */
ut_ad(update->n_fields < ulint(table->n_cols + table->n_v_cols));
update->n_fields++;
@@ -3496,19 +3497,3 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
dfield_set_data(&ufield->new_val, update->vers_sys_value, col->len);
}
-/** Also set row_start = CURRENT_TIMESTAMP/trx->id
-@param[in] trx transaction */
-void upd_node_t::make_versioned_update(const trx_t* trx)
-{
- make_versioned_helper(trx, table->vers_start);
-}
-
-/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
-Do not touch other fields at all.
-@param[in] trx transaction */
-void upd_node_t::make_versioned_delete(const trx_t* trx)
-{
- update->n_fields = 0;
- is_delete = VERSIONED_DELETE;
- make_versioned_helper(trx, table->vers_end);
-}
diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc
index a40618f3fb3..ef4732a98af 100644
--- a/storage/innobase/trx/trx0rseg.cc
+++ b/storage/innobase/trx/trx0rseg.cc
@@ -53,6 +53,10 @@ trx_rseg_write_wsrep_checkpoint(
const XID* xid,
mtr_t* mtr)
{
+ DBUG_ASSERT(xid->gtrid_length >= 0);
+ DBUG_ASSERT(xid->bqual_length >= 0);
+ DBUG_ASSERT(xid->gtrid_length + xid->bqual_length < XIDDATASIZE);
+
mlog_write_ulint(TRX_RSEG_WSREP_XID_FORMAT + rseg_header,
uint32_t(xid->formatID),
MLOG_4BYTES, mtr);
@@ -65,9 +69,15 @@ trx_rseg_write_wsrep_checkpoint(
uint32_t(xid->bqual_length),
MLOG_4BYTES, mtr);
+ const ulint xid_length = static_cast<ulint>(xid->gtrid_length
+ + xid->bqual_length);
mlog_write_string(TRX_RSEG_WSREP_XID_DATA + rseg_header,
reinterpret_cast<const byte*>(xid->data),
- XIDDATASIZE, mtr);
+ xid_length, mtr);
+ if (UNIV_LIKELY(xid_length < XIDDATASIZE)) {
+ mlog_memset(TRX_RSEG_WSREP_XID_DATA + rseg_header + xid_length,
+ XIDDATASIZE - xid_length, 0, mtr);
+ }
}
/** Update the WSREP XID information in rollback segment header.
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index 6267a8edd53..56a48ad5bf6 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2018, MariaDB Corporation.
+Copyright (c) 2014, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -662,6 +662,10 @@ trx_undo_write_xid(
const XID* xid, /*!< in: X/Open XA Transaction Identification */
mtr_t* mtr) /*!< in: mtr */
{
+ DBUG_ASSERT(xid->gtrid_length >= 0);
+ DBUG_ASSERT(xid->bqual_length >= 0);
+ DBUG_ASSERT(xid->gtrid_length + xid->bqual_length < XIDDATASIZE);
+
mlog_write_ulint(log_hdr + TRX_UNDO_XA_FORMAT,
static_cast<ulint>(xid->formatID),
MLOG_4BYTES, mtr);
@@ -673,10 +677,15 @@ trx_undo_write_xid(
mlog_write_ulint(log_hdr + TRX_UNDO_XA_BQUAL_LEN,
static_cast<ulint>(xid->bqual_length),
MLOG_4BYTES, mtr);
-
+ const ulint xid_length = static_cast<ulint>(xid->gtrid_length
+ + xid->bqual_length);
mlog_write_string(log_hdr + TRX_UNDO_XA_XID,
reinterpret_cast<const byte*>(xid->data),
- XIDDATASIZE, mtr);
+ xid_length, mtr);
+ if (UNIV_LIKELY(xid_length < XIDDATASIZE)) {
+ mlog_memset(log_hdr + TRX_UNDO_XA_XID + xid_length,
+ XIDDATASIZE - xid_length, 0, mtr);
+ }
}
/********************************************************************//**
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result
index 53fbccda2b4..543a9012efe 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_multiple_column_select_varchar.result
@@ -6,6 +6,8 @@ family_name varchar(30) not null,
score int not null,
primary key property (given_name, family_name, score)
) default charset utf8;
+Warnings:
+Warning 1280 Name 'property' ignored for PRIMARY key.
show create table scores;
Table Create Table
scores CREATE TABLE `scores` (
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result b/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result
index 1e59dd0daec..20f84dd5563 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/add_index_inplace.result
@@ -482,6 +482,8 @@ DROP TABLE t1;
SET @prior_rocksdb_table_stats_sampling_pct = @@rocksdb_table_stats_sampling_pct;
set global rocksdb_table_stats_sampling_pct = 100;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY ka(a)) ENGINE=RocksDB;
+Warnings:
+Warning 1280 Name 'ka' ignored for PRIMARY key.
INSERT INTO t1 (a, b) VALUES (1, 10);
INSERT INTO t1 (a, b) VALUES (2, 10);
INSERT INTO t1 (a, b) VALUES (3, 20);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/add_unique_index_inplace.result b/storage/rocksdb/mysql-test/rocksdb/r/add_unique_index_inplace.result
index f7c4bab685d..e998cfb43c1 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/add_unique_index_inplace.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/add_unique_index_inplace.result
@@ -1,5 +1,7 @@
drop table if exists t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY ka(a)) ENGINE=RocksDB;
+Warnings:
+Warning 1280 Name 'ka' ignored for PRIMARY key.
INSERT INTO t1 (a, b) VALUES (1, 5);
INSERT INTO t1 (a, b) VALUES (2, 6);
INSERT INTO t1 (a, b) VALUES (3, 7);
@@ -15,6 +17,8 @@ t1 CREATE TABLE `t1` (
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY ka(a)) ENGINE=RocksDB;
+Warnings:
+Warning 1280 Name 'ka' ignored for PRIMARY key.
INSERT INTO t1 (a, b) VALUES (1, 5);
INSERT INTO t1 (a, b) VALUES (2, 6);
INSERT INTO t1 (a, b) VALUES (3, 7);
@@ -38,6 +42,8 @@ a b
5 8
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY ka(a)) ENGINE=RocksDB;
+Warnings:
+Warning 1280 Name 'ka' ignored for PRIMARY key.
INSERT INTO t1 (a, b) VALUES (1, 5);
INSERT INTO t1 (a, b) VALUES (2, NULL);
INSERT INTO t1 (a, b) VALUES (3, NULL);
@@ -56,6 +62,8 @@ COUNT(*)
4
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY ka(a)) ENGINE=RocksDB;
+Warnings:
+Warning 1280 Name 'ka' ignored for PRIMARY key.
INSERT INTO t1 (a,b,c) VALUES (1,1,NULL);
INSERT INTO t1 (a,b,c) VALUES (2,1,NULL);
INSERT INTO t1 (a,b,c) VALUES (3,1,NULL);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result b/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result
index b0113d79bb2..5b804828e69 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result
@@ -23,6 +23,8 @@ CREATE TABLE t1 (a INT,
b CHAR(8),
PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'ind2' ignored for PRIMARY key.
SHOW INDEX IN t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 b A # 1 NULL LSMTREE big key_block_size value
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_blob_indexes.result b/storage/rocksdb/mysql-test/rocksdb/r/type_blob_indexes.result
index 26726e0f6d1..1e614a2bbf1 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_blob_indexes.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_blob_indexes.result
@@ -8,6 +8,8 @@ m MEDIUMBLOB,
l LONGBLOB,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
SHOW INDEX IN t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 b A 1000 32 NULL LSMTREE
@@ -133,6 +135,8 @@ CREATE TABLE t1 (
b BLOB,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -147,6 +151,8 @@ CREATE TABLE t1 (
b TINYBLOB,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -161,6 +167,8 @@ CREATE TABLE t1 (
b MEDIUMBLOB,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -175,6 +183,8 @@ CREATE TABLE t1 (
b LONGBLOB,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/type_text_indexes.result b/storage/rocksdb/mysql-test/rocksdb/r/type_text_indexes.result
index 22318316596..7db5c23c53f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/type_text_indexes.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/type_text_indexes.result
@@ -8,6 +8,8 @@ m MEDIUMTEXT,
l LONGTEXT,
PRIMARY KEY t (t(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 't' ignored for PRIMARY key.
SHOW INDEX IN t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 t A 1000 32 NULL LSMTREE
@@ -55,6 +57,8 @@ pk MEDIUMTEXT,
PRIMARY KEY mt (pk(1)),
INDEX (m(128))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'mt' ignored for PRIMARY key.
SHOW INDEX IN t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 pk A 1000 1 NULL LSMTREE
@@ -80,6 +84,8 @@ CREATE TABLE t1 (
b TEXT,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -94,6 +100,8 @@ CREATE TABLE t1 (
b TINYTEXT,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -108,6 +116,8 @@ CREATE TABLE t1 (
b MEDIUMTEXT,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -122,6 +132,8 @@ CREATE TABLE t1 (
b LONGTEXT,
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -136,6 +148,8 @@ CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "binary" COLLATE "binary",
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES
('00000000000000000000000000000000'),
('00000000000000000000000000000001'),
@@ -154,6 +168,8 @@ CREATE TABLE t1 (
b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
PRIMARY KEY b (b(32))
) ENGINE=rocksdb;
+Warnings:
+Warning 1280 Name 'b' ignored for PRIMARY key.
INSERT INTO t1 (b) VALUES (''), (_binary 0x0), (' ');
ERROR 23000: Duplicate entry ' ' for key 'PRIMARY'
INSERT INTO t1 (b) VALUES (''), (_binary 0x0);
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 98cd0c3e731..aa82f0b0fb1 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -2781,7 +2781,7 @@ int spider_db_fetch_for_item_sum_func(
thd->free_list = free_list;
}
- Item_sum_hybrid *item_hybrid = (Item_sum_hybrid *) item_sum;
+ Item_sum_min_max *item_sum_min_max = (Item_sum_min_max *) item_sum;
Item_string *item =
(Item_string *) spider->direct_aggregate_item_current->item;
if (row->is_null())
@@ -2808,7 +2808,7 @@ int spider_db_fetch_for_item_sum_func(
#endif
item->null_value = FALSE;
}
- item_hybrid->direct_add(item);
+ item_sum_min_max->direct_add(item);
row->next();
}
break;
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index 8b0581b9bd9..30a5d598709 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2008-2018 Kentoku Shiba
+/* Copyright (C) 2008-2019 Kentoku Shiba
+ Copyright (C) 2019 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -293,6 +294,7 @@ typedef struct st_spider_thread
volatile bool thd_wait;
volatile bool first_free_wait;
volatile bool init_command;
+ volatile int error;
pthread_t thread;
pthread_cond_t cond;
pthread_mutex_t mutex;
diff --git a/storage/spider/spd_malloc.h b/storage/spider/spd_malloc.h
index abbeb58d71c..9e97e039e04 100644
--- a/storage/spider/spd_malloc.h
+++ b/storage/spider/spd_malloc.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2012-2014 Kentoku Shiba
+/* Copyright (C) 2012-2019 Kentoku Shiba
+ Copyright (C) 2019 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +20,7 @@
#define spider_bulk_malloc(A,B,C,...) \
spider_bulk_alloc_mem(A,B,__func__,__FILE__,__LINE__,C,__VA_ARGS__)
#define spider_current_trx \
- (current_thd ? ((SPIDER_TRX *) thd_get_ha_data(current_thd, spider_hton_ptr)) : NULL)
+ (current_thd && spider_hton_ptr->slot != HA_SLOT_UNDEF ? ((SPIDER_TRX *) thd_get_ha_data(current_thd, spider_hton_ptr)) : NULL)
#define init_calc_mem(A) init_mem_calc(A,__func__,__FILE__,__LINE__)
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index ae0e88eb3a8..ee41d39df0f 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -129,6 +129,9 @@ const char **spd_mysqld_unix_port;
uint *spd_mysqld_port;
bool volatile *spd_abort_loop;
Time_zone *spd_tz_system;
+static int *spd_mysqld_server_started;
+static pthread_mutex_t *spd_LOCK_server_started;
+static pthread_cond_t *spd_COND_server_started;
extern long spider_conn_mutex_id;
handlerton *spider_hton_ptr;
SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
@@ -6576,11 +6579,27 @@ handler* spider_create_handler(
) {
DBUG_ENTER("spider_create_handler");
#ifndef WITHOUT_SPIDER_BG_SEARCH
- if (unlikely(spider_table_sts_threads[0].init_command))
+ SPIDER_THREAD *thread = &spider_table_sts_threads[0];
+ if (unlikely(thread->init_command))
{
+ THD *thd = current_thd;
+ pthread_cond_t *cond = thd->mysys_var->current_cond;
+ pthread_mutex_t *mutex = thd->mysys_var->current_mutex;
/* wait for finishing init_command */
- pthread_mutex_lock(&spider_table_sts_threads[0].mutex);
- pthread_mutex_unlock(&spider_table_sts_threads[0].mutex);
+ pthread_mutex_lock(&thread->mutex);
+ if (unlikely(thread->init_command))
+ {
+ thd->mysys_var->current_cond = &thread->sync_cond;
+ thd->mysys_var->current_mutex = &thread->mutex;
+ pthread_cond_wait(&thread->sync_cond, &thread->mutex);
+ }
+ pthread_mutex_unlock(&thread->mutex);
+ thd->mysys_var->current_cond = cond;
+ thd->mysys_var->current_mutex = mutex;
+ if (thd->killed)
+ {
+ DBUG_RETURN(NULL);
+ }
}
#endif
DBUG_RETURN(new (mem_root) ha_spider(hton, table));
@@ -7005,6 +7024,13 @@ int spider_db_init(
#else
GetProcAddress(current_module, "?my_tz_SYSTEM@@3PAVTime_zone@@A");
#endif
+ spd_mysqld_server_started = (int *)
+ GetProcAddress(current_module, "?mysqld_server_started@@3HA");
+ spd_LOCK_server_started = (pthread_mutex_t *)
+ GetProcAddress(current_module,
+ "?LOCK_server_started@@3Ust_mysql_mutex@@A");
+ spd_COND_server_started = (pthread_cond_t *)
+ GetProcAddress(current_module, "?COND_server_started@@3Ust_mysql_cond@@A");
#else
#ifndef SPIDER_HAS_NEXT_THREAD_ID
spd_db_att_thread_id = &thread_id;
@@ -7027,6 +7053,9 @@ int spider_db_init(
spd_mysqld_port = &mysqld_port;
spd_abort_loop = &abort_loop;
spd_tz_system = my_tz_SYSTEM;
+ spd_mysqld_server_started = &mysqld_server_started;
+ spd_LOCK_server_started = &LOCK_server_started;
+ spd_COND_server_started = &COND_server_started;
#endif
#ifdef HAVE_PSI_INTERFACE
@@ -7364,30 +7393,6 @@ int spider_db_init(
}
}
}
-
-#ifndef WITHOUT_SPIDER_BG_SEARCH
- DBUG_PRINT("info",("spider before getting mutex"));
- pthread_mutex_lock(&spider_table_sts_threads[0].mutex);
- DBUG_PRINT("info",("spider after getting mutex"));
- if (spider_table_sts_threads[0].init_command)
- {
- if (spider_table_sts_threads[0].thd_wait)
- {
- pthread_cond_signal(&spider_table_sts_threads[0].cond);
- }
- spider_table_sts_threads[0].first_free_wait = TRUE;
- pthread_cond_wait(&spider_table_sts_threads[0].sync_cond,
- &spider_table_sts_threads[0].mutex);
- spider_table_sts_threads[0].first_free_wait = FALSE;
- if (spider_table_sts_threads[0].thd_wait)
- {
- pthread_cond_signal(&spider_table_sts_threads[0].cond);
- }
- }
- DBUG_PRINT("info",("spider before releasing mutex"));
- pthread_mutex_unlock(&spider_table_sts_threads[0].mutex);
- DBUG_PRINT("info",("spider after releasing mutex"));
-#endif
DBUG_RETURN(0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -10034,46 +10039,45 @@ void *spider_table_bg_sts_action(
tmp_disable_binlog(thd);
thd->security_ctx->skip_grants();
thd->client_capabilities |= CLIENT_MULTI_RESULTS;
- while (spider_init_queries[i + 2].length)
+ if (!(*spd_mysqld_server_started) && !thd->killed)
{
- dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
- (uint) spider_init_queries[i].length, FALSE, FALSE);
- if (unlikely(thd->is_error()))
+ pthread_mutex_lock(spd_LOCK_server_started);
+ thd->mysys_var->current_cond = spd_COND_server_started;
+ thd->mysys_var->current_mutex = spd_LOCK_server_started;
+ if (!(*spd_mysqld_server_started) && !thd->killed)
{
- fprintf(stderr, "[ERROR] %s\n", thd->get_stmt_da()->message());
- thd->clear_error();
- break;
+ pthread_cond_wait(spd_COND_server_started, spd_LOCK_server_started);
}
- ++i;
+ pthread_mutex_unlock(spd_LOCK_server_started);
+ thd->mysys_var->current_cond = &thread->cond;
+ thd->mysys_var->current_mutex = &thread->mutex;
}
- DBUG_PRINT("info",("spider first_free_wait=%s",
- thread->first_free_wait ? "TRUE" : "FALSE"));
- if (!thread->first_free_wait)
- {
- thread->thd_wait = TRUE;
- pthread_cond_wait(&thread->cond, &thread->mutex);
- thread->thd_wait = FALSE;
- }
- DBUG_ASSERT(thread->first_free_wait);
- pthread_cond_signal(&thread->sync_cond);
- thread->thd_wait = TRUE;
- pthread_cond_wait(&thread->cond, &thread->mutex);
- thread->thd_wait = FALSE;
- while (spider_init_queries[i].length)
+ while (spider_init_queries[i].length && !thd->killed)
{
dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
(uint) spider_init_queries[i].length, FALSE, FALSE);
if (unlikely(thd->is_error()))
{
- fprintf(stderr, "[ERROR] %s\n", thd->get_stmt_da()->message());
+ fprintf(stderr, "[ERROR] %s\n", spider_stmt_da_message(thd));
thd->clear_error();
break;
}
++i;
}
+ thd->mysys_var->current_cond = &thread->cond;
+ thd->mysys_var->current_mutex = &thread->mutex;
thd->client_capabilities -= CLIENT_MULTI_RESULTS;
reenable_binlog(thd);
thread->init_command = FALSE;
+ pthread_cond_broadcast(&thread->sync_cond);
+ }
+ if (thd->killed)
+ {
+ thread->killed = TRUE;
+ }
+ if (thd->killed)
+ {
+ thread->killed = TRUE;
}
while (TRUE)
diff --git a/storage/tokudb/PerconaFT/ft/comparator.h b/storage/tokudb/PerconaFT/ft/comparator.h
index 9775cc13387..dfafd71549d 100644
--- a/storage/tokudb/PerconaFT/ft/comparator.h
+++ b/storage/tokudb/PerconaFT/ft/comparator.h
@@ -31,6 +31,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.cc b/storage/tokudb/PerconaFT/ft/ft-ops.cc
index aefd6f0ec22..df0d88a9580 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.cc
@@ -4974,6 +4974,7 @@ int toku_ft_layer_init(void) {
// Portability must be initialized first
r = toku_portability_init();
+ assert(r==0);
if (r) {
goto exit;
}
@@ -4981,6 +4982,7 @@ int toku_ft_layer_init(void) {
toku_pfs_keys_init("fti");
r = db_env_set_toku_product_name("tokudb");
+ assert(r==0);
if (r) {
goto exit;
}
diff --git a/storage/tokudb/PerconaFT/ft/ft-status.cc b/storage/tokudb/PerconaFT/ft/ft-status.cc
index 64acd4ec017..9b45ba21b4f 100644
--- a/storage/tokudb/PerconaFT/ft/ft-status.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-status.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/ft/ft-status.h b/storage/tokudb/PerconaFT/ft/ft-status.h
index b176161683d..4775487cc2f 100644
--- a/storage/tokudb/PerconaFT/ft/ft-status.h
+++ b/storage/tokudb/PerconaFT/ft/ft-status.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/keyrange.cc b/storage/tokudb/PerconaFT/locktree/keyrange.cc
index 2b4b3bbd4fd..24a999e134a 100644
--- a/storage/tokudb/PerconaFT/locktree/keyrange.cc
+++ b/storage/tokudb/PerconaFT/locktree/keyrange.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/keyrange.h b/storage/tokudb/PerconaFT/locktree/keyrange.h
index a454287cbc8..8347e4d8edf 100644
--- a/storage/tokudb/PerconaFT/locktree/keyrange.h
+++ b/storage/tokudb/PerconaFT/locktree/keyrange.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.cc b/storage/tokudb/PerconaFT/locktree/lock_request.cc
index 51898d4ccb1..0a95dc417d6 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.cc
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.h b/storage/tokudb/PerconaFT/locktree/lock_request.h
index 455433cb90c..8b22241e276 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.h
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/locktree.cc b/storage/tokudb/PerconaFT/locktree/locktree.cc
index 8ba3f0f00ae..8e81adefbf8 100644
--- a/storage/tokudb/PerconaFT/locktree/locktree.cc
+++ b/storage/tokudb/PerconaFT/locktree/locktree.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/locktree.h b/storage/tokudb/PerconaFT/locktree/locktree.h
index 7006b6fb01d..4d9e5bdaf6c 100644
--- a/storage/tokudb/PerconaFT/locktree/locktree.h
+++ b/storage/tokudb/PerconaFT/locktree/locktree.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/manager.cc b/storage/tokudb/PerconaFT/locktree/manager.cc
index 21f8dc6cf01..5662150de4b 100644
--- a/storage/tokudb/PerconaFT/locktree/manager.cc
+++ b/storage/tokudb/PerconaFT/locktree/manager.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/range_buffer.cc b/storage/tokudb/PerconaFT/locktree/range_buffer.cc
index d1f14fc4a52..33ee481aa51 100644
--- a/storage/tokudb/PerconaFT/locktree/range_buffer.cc
+++ b/storage/tokudb/PerconaFT/locktree/range_buffer.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/range_buffer.h b/storage/tokudb/PerconaFT/locktree/range_buffer.h
index 811b0f85e69..3b08e895304 100644
--- a/storage/tokudb/PerconaFT/locktree/range_buffer.h
+++ b/storage/tokudb/PerconaFT/locktree/range_buffer.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/treenode.cc b/storage/tokudb/PerconaFT/locktree/treenode.cc
index 0247242f975..f328bf348e3 100644
--- a/storage/tokudb/PerconaFT/locktree/treenode.cc
+++ b/storage/tokudb/PerconaFT/locktree/treenode.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/treenode.h b/storage/tokudb/PerconaFT/locktree/treenode.h
index 981e8b5a9cf..fb2adc4745d 100644
--- a/storage/tokudb/PerconaFT/locktree/treenode.h
+++ b/storage/tokudb/PerconaFT/locktree/treenode.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/txnid_set.cc b/storage/tokudb/PerconaFT/locktree/txnid_set.cc
index bd4e9723155..f5ed6b2e416 100644
--- a/storage/tokudb/PerconaFT/locktree/txnid_set.cc
+++ b/storage/tokudb/PerconaFT/locktree/txnid_set.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/txnid_set.h b/storage/tokudb/PerconaFT/locktree/txnid_set.h
index 81fd45b6dde..70b0ce76761 100644
--- a/storage/tokudb/PerconaFT/locktree/txnid_set.h
+++ b/storage/tokudb/PerconaFT/locktree/txnid_set.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/wfg.cc b/storage/tokudb/PerconaFT/locktree/wfg.cc
index 26b7a3b5295..8fd079bedfd 100644
--- a/storage/tokudb/PerconaFT/locktree/wfg.cc
+++ b/storage/tokudb/PerconaFT/locktree/wfg.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/wfg.h b/storage/tokudb/PerconaFT/locktree/wfg.h
index 5c1599592e6..32f14e4b519 100644
--- a/storage/tokudb/PerconaFT/locktree/wfg.h
+++ b/storage/tokudb/PerconaFT/locktree/wfg.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/memory.cc b/storage/tokudb/PerconaFT/portability/memory.cc
index 403abfe1d68..f4888dccc51 100644
--- a/storage/tokudb/PerconaFT/portability/memory.cc
+++ b/storage/tokudb/PerconaFT/portability/memory.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
@@ -65,7 +79,7 @@ static realloc_fun_t t_xrealloc = 0;
static LOCAL_MEMORY_STATUS_S status;
int toku_memory_do_stats = 0;
-static bool memory_startup_complete;
+static bool memory_startup_complete = false;
int
toku_memory_startup(void) {
@@ -83,8 +97,10 @@ toku_memory_startup(void) {
if (success) {
status.mallocator_version = "libc";
status.mmap_threshold = mmap_threshold;
- } else
+ } else {
result = EINVAL;
+ }
+ assert(result == 0);
#else
// just a guess
status.mallocator_version = "darwin";
@@ -100,18 +116,17 @@ toku_memory_startup(void) {
if (mallctl_f) { // jemalloc is loaded
size_t version_length = sizeof status.mallocator_version;
result = mallctl_f("version", &status.mallocator_version, &version_length, NULL, 0);
+ assert(result == 0);
if (result == 0) {
size_t lg_chunk; // log2 of the mmap threshold
size_t lg_chunk_length = sizeof lg_chunk;
result = mallctl_f("opt.lg_chunk", &lg_chunk, &lg_chunk_length, NULL, 0);
- if (result)
- {
- status.mmap_threshold = 1 << 21; // Default value.
- // Incompatible jemalloc change.
+ if (result == 0) {
+ status.mmap_threshold = 1 << lg_chunk;
+ } else {
+ status.mmap_threshold = 1 << 22;
result = 0;
}
- else
- status.mmap_threshold = 1 << lg_chunk;
}
}
diff --git a/storage/tokudb/PerconaFT/portability/memory.h b/storage/tokudb/PerconaFT/portability/memory.h
index 851e4d69e03..b804463413b 100644
--- a/storage/tokudb/PerconaFT/portability/memory.h
+++ b/storage/tokudb/PerconaFT/portability/memory.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/portability.cc b/storage/tokudb/PerconaFT/portability/portability.cc
index dfa5153cc66..81115a516aa 100644
--- a/storage/tokudb/PerconaFT/portability/portability.cc
+++ b/storage/tokudb/PerconaFT/portability/portability.cc
@@ -88,9 +88,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
int
toku_portability_init(void) {
int r = toku_memory_startup();
+ assert(r==0);
if (r == 0) {
uint64_t hz;
r = toku_os_get_processor_frequency(&hz); // get and cache freq
+ assert(r==0);
}
(void) toku_os_get_pagesize(); // get and cache pagesize
return r;
diff --git a/storage/tokudb/PerconaFT/portability/toku_atomic.h b/storage/tokudb/PerconaFT/portability/toku_atomic.h
index 5086c87170e..88644f56939 100644
--- a/storage/tokudb/PerconaFT/portability/toku_atomic.h
+++ b/storage/tokudb/PerconaFT/portability/toku_atomic.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_instrumentation.h b/storage/tokudb/PerconaFT/portability/toku_instrumentation.h
index 7f2946d9702..01552f9feab 100644
--- a/storage/tokudb/PerconaFT/portability/toku_instrumentation.h
+++ b/storage/tokudb/PerconaFT/portability/toku_instrumentation.h
@@ -1,3 +1,49 @@
+/*======
+This file is part of PerconaFT.
+
+Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2,
+ as published by the Free Software Foundation.
+
+ PerconaFT 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 PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License, version 3,
+ as published by the Free Software Foundation.
+
+ PerconaFT 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 Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+======= */
+
#pragma once
#include <stdio.h> // FILE
diff --git a/storage/tokudb/PerconaFT/portability/toku_portability.h b/storage/tokudb/PerconaFT/portability/toku_portability.h
index 9c5bf891eba..7027b2a1ab8 100644
--- a/storage/tokudb/PerconaFT/portability/toku_portability.h
+++ b/storage/tokudb/PerconaFT/portability/toku_portability.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_pthread.cc b/storage/tokudb/PerconaFT/portability/toku_pthread.cc
index 65eeea6ae07..fe8a4d485cd 100644
--- a/storage/tokudb/PerconaFT/portability/toku_pthread.cc
+++ b/storage/tokudb/PerconaFT/portability/toku_pthread.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_pthread.h b/storage/tokudb/PerconaFT/portability/toku_pthread.h
index d05c6fabf53..a0831f677ad 100644
--- a/storage/tokudb/PerconaFT/portability/toku_pthread.h
+++ b/storage/tokudb/PerconaFT/portability/toku_pthread.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_race_tools.h b/storage/tokudb/PerconaFT/portability/toku_race_tools.h
index eee08185513..479363546ee 100644
--- a/storage/tokudb/PerconaFT/portability/toku_race_tools.h
+++ b/storage/tokudb/PerconaFT/portability/toku_race_tools.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_time.cc b/storage/tokudb/PerconaFT/portability/toku_time.cc
index 07bf09f887c..bbc5689a8cf 100644
--- a/storage/tokudb/PerconaFT/portability/toku_time.cc
+++ b/storage/tokudb/PerconaFT/portability/toku_time.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_time.h b/storage/tokudb/PerconaFT/portability/toku_time.h
index c4c45b8e8c7..b9789bc5613 100644
--- a/storage/tokudb/PerconaFT/portability/toku_time.h
+++ b/storage/tokudb/PerconaFT/portability/toku_time.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/dbt.h b/storage/tokudb/PerconaFT/util/dbt.h
index d3ef73a7a6f..1b8375674fa 100644
--- a/storage/tokudb/PerconaFT/util/dbt.h
+++ b/storage/tokudb/PerconaFT/util/dbt.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/growable_array.h b/storage/tokudb/PerconaFT/util/growable_array.h
index ad60ea6395b..bc9e67af240 100644
--- a/storage/tokudb/PerconaFT/util/growable_array.h
+++ b/storage/tokudb/PerconaFT/util/growable_array.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/memarena.cc b/storage/tokudb/PerconaFT/util/memarena.cc
index 158cf37e5e8..8c0542211e4 100644
--- a/storage/tokudb/PerconaFT/util/memarena.cc
+++ b/storage/tokudb/PerconaFT/util/memarena.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/memarena.h b/storage/tokudb/PerconaFT/util/memarena.h
index 7cbbdc89cfb..c1de3c94a30 100644
--- a/storage/tokudb/PerconaFT/util/memarena.h
+++ b/storage/tokudb/PerconaFT/util/memarena.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/omt.cc b/storage/tokudb/PerconaFT/util/omt.cc
index 846c4df7f54..44da98478a0 100644
--- a/storage/tokudb/PerconaFT/util/omt.cc
+++ b/storage/tokudb/PerconaFT/util/omt.cc
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident \
diff --git a/storage/tokudb/PerconaFT/util/omt.h b/storage/tokudb/PerconaFT/util/omt.h
index dc26b2d5718..849389b9fac 100644
--- a/storage/tokudb/PerconaFT/util/omt.h
+++ b/storage/tokudb/PerconaFT/util/omt.h
@@ -45,6 +45,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/partitioned_counter.cc b/storage/tokudb/PerconaFT/util/partitioned_counter.cc
index beab7fc7228..7a6b8ab26bf 100644
--- a/storage/tokudb/PerconaFT/util/partitioned_counter.cc
+++ b/storage/tokudb/PerconaFT/util/partitioned_counter.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/partitioned_counter.h b/storage/tokudb/PerconaFT/util/partitioned_counter.h
index 43d4e7b46b7..d5bf97cf301 100644
--- a/storage/tokudb/PerconaFT/util/partitioned_counter.h
+++ b/storage/tokudb/PerconaFT/util/partitioned_counter.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/status.h b/storage/tokudb/PerconaFT/util/status.h
index ddf43c72d9f..2d03ef1ed5e 100644
--- a/storage/tokudb/PerconaFT/util/status.h
+++ b/storage/tokudb/PerconaFT/util/status.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_Makefile b/storage/tokudb/mysql-test/tokudb/t/change_column_Makefile
index d1a692e0357..b1ee6d1f16d 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_Makefile
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_Makefile
@@ -1,4 +1,4 @@
-# generate tests from test generator python programs
+# generate tests from test generator python2 programs
S = $(wildcard *.py)
T = $(patsubst %.py,%.test,$(S))
@@ -6,14 +6,14 @@ T = $(patsubst %.py,%.test,$(S))
default: $(T)
%.test: %.py
- python $< >$@
+ python2 $< >$@
change_all.test: change_all.py change_all_1000_10.test change_all_1000_1.test change_all_10000_1.test
true
change_all_1000_10.test: change_all.py
- python change_all.py --experiments=1000 --nrows=10 >change_all_1000_10.test
+ python2 change_all.py --experiments=1000 --nrows=10 >change_all_1000_10.test
change_all_1000_1.test: change_all.py
- python change_all.py --experiments=1000 --nrows=1 >change_all_1000_1.test
+ python2 change_all.py --experiments=1000 --nrows=1 >change_all_1000_1.test
change_all_10000_1.test: change_all.py
- python change_all.py --experiments=10000 --nrows=1 >change_all_10000_1.test
+ python2 change_all.py --experiments=10000 --nrows=1 >change_all_10000_1.test
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py
index 2c7d8dd9a54..9b291c8f9db 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(n):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py
index 6bd5de38fe8..50feab50ffc 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(n):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py
index c53442ade50..a0b45e9de59 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(n):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py
index e92797918d5..3cbf389ebc1 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(n):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py
index 065e37b186d..ca507130f57 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(n):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py
index fe73fce0d53..26707868c53 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(n):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py
index 6f69156e260..1067031fd05 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(types, values):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py
index fd7e5868c40..4b06df54607 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(types):
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py
index 1708c65efde..afafbe1a99f 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def supported(from_int, from_modifier, to_int, to_modifer):
if from_modifier != to_modifer:
diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py
index 5222564a9a2..6b6c979329b 100644
--- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py
+++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
import sys
def gen_test(types, values):
diff --git a/storage/tokudb/mysql-test/tokudb/t/fast_update_Makefile b/storage/tokudb/mysql-test/tokudb/t/fast_update_Makefile
index 71956d1fe43..dfcf2877734 100644
--- a/storage/tokudb/mysql-test/tokudb/t/fast_update_Makefile
+++ b/storage/tokudb/mysql-test/tokudb/t/fast_update_Makefile
@@ -1,4 +1,4 @@
-# generate tests from test generator python programs
+# generate tests from test generator python2 programs
S = $(wildcard *.py)
T = $(patsubst %.py,%.test,$(S))
@@ -6,5 +6,5 @@ T = $(patsubst %.py,%.test,$(S))
default: $(T)
%.test: %.py
- python $< >$@
+ python2 $< >$@
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result
index 33c60935952..f92bc361547 100644
--- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result
@@ -20,6 +20,6 @@ test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 7 NULL NULL BTREE
-t 1 x 1 x A 7 NULL NULL YES BTREE
+t 1 x 1 x A 3 NULL NULL YES BTREE
set @@use_stat_tables = @save_use_stat_tables;
drop table t;
diff --git a/storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_sync_tokudb-master.opt b/storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_sync_tokudb-master.opt
deleted file mode 100644
index 9854fda301d..00000000000
--- a/storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_sync_tokudb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_file_per_table=1
diff --git a/storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_tokudb-master.opt b/storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_tokudb-master.opt
deleted file mode 100644
index 43fac202fd4..00000000000
--- a/storage/tokudb/mysql-test/tokudb_parts/t/partition_debug_tokudb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-file-per-table=1
diff --git a/storage/tokudb/mysql-test/tokudb_parts/t/partition_special_tokudb-master.opt b/storage/tokudb/mysql-test/tokudb_parts/t/partition_special_tokudb-master.opt
deleted file mode 100644
index 624645d75c7..00000000000
--- a/storage/tokudb/mysql-test/tokudb_parts/t/partition_special_tokudb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_lock_wait_timeout=2 --innodb-file-per-table=1
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index 09f26d52129..6eb2d0bc257 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -388,7 +388,7 @@ case "$mode" in
fi
else
# Try to find appropriate mysqld process
- mysqld_pid=`pgrep $libexecdir/mysqld`
+ mysqld_pid=`pgrep -f $libexecdir/mysqld`
# test if multiple pids exist
pid_count=`echo $mysqld_pid | wc -w`
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index 72c059aa706..9fee823b75b 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,4 +1,4 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_9.5_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_10.2_32_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
@@ -12,6 +12,5 @@ IF(NOT EXISTS ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP})
)
ENDIF()
-SET(LIBMYSQLDLL_SOURCE ${HEIDISQL_DOWNLOAD_DIR}/libmysql.dll)
CONFIGURE_FILE(${SRCDIR}/heidisql.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql.wxi)
CONFIGURE_FILE(${SRCDIR}/heidisql_feature.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql_feature.wxi)
diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in
index 241d2c2750d..4244b47d0d8 100644
--- a/win/packaging/heidisql.wxi.in
+++ b/win/packaging/heidisql.wxi.in
@@ -8,6 +8,7 @@
Win64="no"
/>
</Property>
+<?define pluginlist=auth_gssapi_client.dll;mysql_clear_password.dll;sha256_password.dll;caching_sha2_password.dll;pvio_npipe.dll;dialog.dll;pvio_shmem.dll?>
<DirectoryRef Id="MariaDBShared">
<Directory Id="D.HeidiSQL" Name="HeidiSQL">
<Component Id="component.HeidiSQL" Guid="96ea3879-5320-4098-8f26-2f655d2f716c" Win64="no">
@@ -35,7 +36,9 @@
<Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
<File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
</Component>
-
+ <Component Id="component.HeidiSQL_libmariadb.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libmariadb.dll" Name="libmariadb.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmariadb.dll" />
+ </Component>
<Component Id="component.HeidiSQL_libeay32.dll" Guid="*" Win64="no">
<File Id="heidisql.libeay32.dll" Name="libeay32.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libeay32.dll" />
</Component>
@@ -53,12 +56,11 @@
</Component>
<Directory Id="D.HeidiSQL.plugins" Name="plugins">
- <Component Id="component.HeidiSQL_dialog.dll" Guid="*" Win64="no">
- <File Id="heidisql.dialog.dll" Name="dialog.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\dialog.dll" />
- </Component>
- <Component Id="component.HeidiSQL_auth_gssapi_client.dll" Guid="*" Win64="no">
- <File Id="heidisql.auth_gssapi_client.dll" Name="auth_gssapi_client.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\auth_gssapi_client.dll" />
+ <?foreach dll in $(var.pluginlist) ?>
+ <Component Id="component.HeidiSQL_$(var.dll)" Guid="*" Win64="no">
+ <File Id="heidisql.$(var.dll)" Name="$(var.dll)" Source="${HEIDISQL_DOWNLOAD_DIR}\plugins\$(var.dll)" />
</Component>
+ <?endforeach?>
</Directory>
<Component Id="component.HeidiSQL_CleanupSettings" Guid="*" Win64="no">
@@ -73,13 +75,15 @@
<ComponentRef Id="component.HeidiSQL"/>
<ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
<ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
+ <ComponentRef Id="component.HeidiSQL_libmariadb.dll"/>
<ComponentRef Id="component.HeidiSQL_libeay32.dll" />
<ComponentRef Id="component.HeidiSQL_libpq.dll" />
<ComponentRef Id="component.HeidiSQL_ssleay32.dll" />
<ComponentRef Id="component.HeidiSQL_libintl_8.dll" />
<ComponentRef Id="component.HeidiSQL_libiconv_2.dll" />
- <ComponentRef Id="component.HeidiSQL_dialog.dll" />
- <ComponentRef Id="component.HeidiSQL_auth_gssapi_client.dll" />
+ <?foreach dll in $(var.pluginlist)?>
+ <ComponentRef Id="component.HeidiSQL_$(var.dll)" />
+ <?endforeach?>
<ComponentRef Id="component.HeidiSQL_CleanupSettings"/>
</ComponentGroup>
</Include>