summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--SSL/Makefile.am4
-rw-r--r--client/mysqldump.c37
-rw-r--r--cmd-line-utils/libedit/Makefile.am4
-rw-r--r--config/ac-macros/large_file.m411
-rw-r--r--config/ac-macros/misc.m41
-rw-r--r--configure.in8
-rw-r--r--include/Makefile.am7
-rw-r--r--include/mysql.h4
-rw-r--r--myisam/mi_extra.c2
-rw-r--r--mysql-test/Makefile.am18
-rw-r--r--mysql-test/include/have_bug25714.inc7
-rwxr-xr-xmysql-test/mysql-test-run.pl12
-rw-r--r--mysql-test/r/alter_table.result12
-rw-r--r--mysql-test/r/bdb.result2
-rw-r--r--mysql-test/r/check.result8
-rw-r--r--mysql-test/r/create.result29
-rw-r--r--mysql-test/r/federated.result11
-rw-r--r--mysql-test/r/federated_bug_25714.result56
-rw-r--r--mysql-test/r/func_time.result8
-rw-r--r--mysql-test/r/group_by.result17
-rw-r--r--mysql-test/r/have_bug25714.require2
-rw-r--r--mysql-test/r/having.result19
-rw-r--r--mysql-test/r/innodb-big.result66
-rw-r--r--mysql-test/r/innodb.result2
-rw-r--r--mysql-test/r/innodb_mysql.result296
-rw-r--r--mysql-test/r/insert_select.result26
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result113
-rw-r--r--mysql-test/r/mysqlbinlog.result7
-rw-r--r--mysql-test/r/mysqldump-max.result36
-rw-r--r--mysql-test/r/mysqldump.result218
-rw-r--r--mysql-test/r/openssl_1.result9
-rw-r--r--mysql-test/r/query_cache.result119
-rw-r--r--mysql-test/r/rpl_insert_delayed.result23
-rw-r--r--mysql-test/r/rpl_session_var.result10
-rw-r--r--mysql-test/r/show_check.result20
-rw-r--r--mysql-test/r/sp-prelocking.result52
-rw-r--r--mysql-test/r/sp.result115
-rw-r--r--mysql-test/r/trigger.result28
-rw-r--r--mysql-test/r/type_enum.result24
-rw-r--r--mysql-test/r/view.result15
-rw-r--r--mysql-test/std_data/cacert.pem (renamed from SSL/cacert.pem)0
-rw-r--r--mysql-test/std_data/client-cert.pem (renamed from SSL/client-cert.pem)0
-rw-r--r--mysql-test/std_data/client-key.pem (renamed from SSL/client-key.pem)0
-rw-r--r--mysql-test/std_data/server-cert.pem (renamed from SSL/server-cert.pem)0
-rw-r--r--mysql-test/std_data/server-key.pem (renamed from SSL/server-key.pem)0
-rw-r--r--mysql-test/suite/funcs_1/datadict/datadict_master.inc15
-rw-r--r--mysql-test/suite/funcs_1/r/innodb__datadict.result3
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result332
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0102.result2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result5
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_09.result2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result3
-rw-r--r--mysql-test/suite/funcs_1/r/memory__datadict.result3
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result332
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0102.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result5
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_09.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result3
-rw-r--r--mysql-test/suite/funcs_1/r/myisam__datadict.result3
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result332
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0102.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result5
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_09.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views.result3
-rw-r--r--mysql-test/suite/funcs_1/triggers/triggers_0102.inc2
-rw-r--r--mysql-test/suite/funcs_1/views/func_view.inc3
-rw-r--r--mysql-test/suite/row_lock/include/row_lock.inc83
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab.inc94
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_trig.inc96
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view.inc89
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_mix.inc92
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_storedp.inc126
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_trig.inc99
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_1.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_2.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_3.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_4.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_5.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result97
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result145
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result113
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result151
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result37
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result34
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result48
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result312
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result47
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result183
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_1.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_2.result31
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_3.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_4.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_5.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result177
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result357
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result255
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result148
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result35
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result194
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result200
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result169
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result309
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result46
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result180
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result36
-rw-r--r--mysql-test/suite/row_lock/readme.txt9
-rw-r--r--mysql-test/suite/row_lock/summary_of_sel_test.txt36
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_3.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_4.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_5.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_3.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_4.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_5.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test6
-rw-r--r--mysql-test/t/alter_table.test12
-rw-r--r--mysql-test/t/bigint.test2
-rw-r--r--mysql-test/t/check.test9
-rw-r--r--mysql-test/t/create.test29
-rw-r--r--mysql-test/t/federated.test9
-rw-r--r--mysql-test/t/federated_bug_25714.test47
-rw-r--r--mysql-test/t/func_time.test8
-rw-r--r--mysql-test/t/group_by.test22
-rw-r--r--mysql-test/t/having.test26
-rw-r--r--mysql-test/t/innodb-big.test106
-rw-r--r--mysql-test/t/innodb.test2
-rw-r--r--mysql-test/t/innodb_mysql.test119
-rw-r--r--mysql-test/t/insert_select.test28
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test122
-rw-r--r--mysql-test/t/mysqlbinlog.test21
-rw-r--r--mysql-test/t/mysqldump.test22
-rw-r--r--mysql-test/t/query_cache.test124
-rw-r--r--mysql-test/t/rpl_insert_delayed.test30
-rw-r--r--mysql-test/t/rpl_session_var.test22
-rw-r--r--mysql-test/t/show_check.test57
-rw-r--r--mysql-test/t/sp-prelocking.test54
-rw-r--r--mysql-test/t/sp.test129
-rw-r--r--mysql-test/t/trigger.test23
-rw-r--r--mysql-test/t/type_enum.test24
-rw-r--r--mysql-test/t/view.test13
-rw-r--r--ndb/src/common/util/File.cpp4
-rw-r--r--ndb/src/mgmclient/Makefile.am1
-rw-r--r--ndb/src/mgmsrv/Makefile.am2
-rw-r--r--ndb/test/ndbapi/benchronja.cpp19
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp19
-rw-r--r--ndb/test/ndbapi/flexHammer.cpp15
-rw-r--r--ndb/test/ndbapi/flexScan.cpp11
-rw-r--r--ndb/test/ndbapi/flexTT.cpp19
-rw-r--r--ndb/test/ndbapi/flexTimedAsynch.cpp23
-rw-r--r--ndb/test/ndbapi/initronja.cpp9
-rw-r--r--ndb/test/ndbapi/testOperations.cpp5
-rw-r--r--ndb/test/ndbapi/testScanFilter.cpp12
-rw-r--r--ndb/test/odbc/SQL99_test/SQL99_test.cpp13
-rw-r--r--scripts/make_binary_distribution.sh4
-rw-r--r--scripts/mysql_install_db.sh342
-rw-r--r--scripts/mysql_setpermission.sh22
-rw-r--r--sql-common/client.c14
-rw-r--r--sql/field.cc7
-rw-r--r--sql/filesort.cc3
-rw-r--r--sql/ha_berkeley.cc6
-rw-r--r--sql/ha_federated.cc310
-rw-r--r--sql/ha_federated.h2
-rw-r--r--sql/ha_innodb.cc24
-rw-r--r--sql/ha_ndbcluster.cc2
-rw-r--r--sql/handler.cc15
-rw-r--r--sql/handler.h68
-rw-r--r--sql/item.cc56
-rw-r--r--sql/item.h17
-rw-r--r--sql/item_create.cc3
-rw-r--r--sql/item_func.cc22
-rw-r--r--sql/item_func.h2
-rw-r--r--sql/item_strfunc.h4
-rw-r--r--sql/lock.cc35
-rw-r--r--sql/log.cc5
-rw-r--r--sql/log_event.cc11
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/opt_range.cc6
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/sp.cc4
-rw-r--r--sql/sp_head.cc164
-rw-r--r--sql/sp_rcontext.cc18
-rw-r--r--sql/sp_rcontext.h6
-rw-r--r--sql/sql_base.cc59
-rw-r--r--sql/sql_class.cc26
-rw-r--r--sql/sql_class.h65
-rw-r--r--sql/sql_delete.cc31
-rw-r--r--sql/sql_insert.cc178
-rw-r--r--sql/sql_lex.cc133
-rw-r--r--sql/sql_load.cc16
-rw-r--r--sql/sql_parse.cc23
-rw-r--r--sql/sql_select.cc37
-rw-r--r--sql/sql_select.h19
-rw-r--r--sql/sql_show.cc4
-rw-r--r--sql/sql_table.cc11
-rw-r--r--sql/sql_union.cc57
-rw-r--r--sql/sql_update.cc42
-rw-r--r--sql/sql_yacc.yy5
-rw-r--r--sql/table.cc133
-rw-r--r--sql/table.h1
-rwxr-xr-xtests/CMakeLists.txt3
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/bug25714.c71
237 files changed, 4251 insertions, 6945 deletions
diff --git a/Makefile.am b/Makefile.am
index 186a3ec2453..66daff4bd68 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@ AUTOMAKE_OPTIONS = foreign
# These are built from source in the Docs directory
EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \
README COPYING EXCEPTIONS-CLIENT CMakeLists.txt
+
SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \
@readline_topdir@ sql-common scripts \
@thread_dirs@ pstack \
@@ -157,8 +158,6 @@ test-bt:
@PERL@ ./mysql-test-run.pl --force --comment=funcs1_ps --ps-protocol --suite=funcs_1
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2
- -cd mysql-test ; MTR_BUILD_THREAD=auto \
- @PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock
-if [ -d mysql-test/suite/nist ] ; then \
cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \
diff --git a/SSL/Makefile.am b/SSL/Makefile.am
index 5fc44d3a247..30a6fc3c995 100644
--- a/SSL/Makefile.am
+++ b/SSL/Makefile.am
@@ -15,9 +15,7 @@
## Process this file with automake to create Makefile.in
-EXTRA_DIST= NOTES cacert.pem client-cert.pem client-key.pem \
- run-client run-server server-cert.pem \
- server-key.pem
+EXTRA_DIST= NOTES run-client run-server
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/client/mysqldump.c b/client/mysqldump.c
index f72cb0171e1..577e439d6a7 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -992,6 +992,21 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
return 0;
}
+
+static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
+{
+ char query_buffer[QUERY_LENGTH];
+ size_t query_length;
+
+ query_length= my_snprintf(query_buffer,
+ sizeof (query_buffer),
+ "SET SESSION character_set_results = '%s'",
+ (const char *) cs_name);
+
+ return mysql_real_query(mysql, query_buffer, query_length);
+}
+
+
/*
Open a new .sql file to dump the table or view into
@@ -1671,7 +1686,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
MYSQL_FIELD *field;
my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
- if (mysql_query_with_error_report(mysql, 0, buff))
+
+ if (switch_character_set_results(mysql, "binary") ||
+ mysql_query_with_error_report(mysql, &result, buff) ||
+ switch_character_set_results(mysql, default_charset))
DBUG_RETURN(0);
if (path)
@@ -1702,7 +1720,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file);
}
- result= mysql_store_result(mysql);
field= mysql_fetch_field_direct(result, 0);
if (strcmp(field->name, "View") == 0)
{
@@ -1794,7 +1811,14 @@ static uint get_table_structure(char *table, char *db, char *table_type,
}
row= mysql_fetch_row(result);
- fprintf(sql_file, "%s;\n", row[1]);
+
+ fprintf(sql_file,
+ "SET @saved_cs_client = @@character_set_client;\n"
+ "SET character_set_client = utf8;\n"
+ "%s;\n"
+ "SET character_set_client = @saved_cs_client;\n",
+ row[1]);
+
check_io(sql_file);
mysql_free_result(result);
}
@@ -2122,8 +2146,7 @@ static void dump_triggers_for_table(char *table,
}
if (mysql_num_rows(result))
{
- if (opt_compact)
- fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
+ fprintf(sql_file, "\n/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;\n");
fprintf(sql_file, "\nDELIMITER ;;\n");
}
while ((row= mysql_fetch_row(result)))
@@ -2167,9 +2190,11 @@ static void dump_triggers_for_table(char *table,
row[3] /* Statement */);
}
if (mysql_num_rows(result))
+ {
fprintf(sql_file,
"DELIMITER ;\n"
- "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n");
+ "/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;\n");
+ }
mysql_free_result(result);
/*
make sure to set back opt_compatible mode to
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am
index ae6755f1c5c..b7611193aea 100644
--- a/cmd-line-utils/libedit/Makefile.am
+++ b/cmd-line-utils/libedit/Makefile.am
@@ -5,8 +5,8 @@
ASRC = $(srcdir)/vi.c $(srcdir)/emacs.c $(srcdir)/common.c
AHDR = vi.h emacs.h common.h
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(srcdir)/../.. -I..
+# Make sure to include stuff from this directory first, to get right "config.h"
+INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
noinst_LIBRARIES = libedit.a
diff --git a/config/ac-macros/large_file.m4 b/config/ac-macros/large_file.m4
index 00c2fdf614e..2639cec5fb7 100644
--- a/config/ac-macros/large_file.m4
+++ b/config/ac-macros/large_file.m4
@@ -127,14 +127,9 @@ AC_DEFUN([MYSQL_SYS_LARGEFILE],
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_largefile_source=1 ;;
esac])
- AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
- ac_cv_sys_large_files,
- [Large files support on AIX-style hosts.],
- [case "$host_os" in
- # AIX 4.2 and later
- aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
- ac_cv_sys_large_files=1 ;;
- esac])
+
+ # AIX 4.2 and later -- do nothing, include standards.h instead.
+ # this goes for both GNU and IBM C and C++ compilers.
fi
])
diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4
index 09081fb3eac..60c0469e449 100644
--- a/config/ac-macros/misc.m4
+++ b/config/ac-macros/misc.m4
@@ -763,7 +763,6 @@ AC_SUBST(CXX_VERSION)
])
AC_DEFUN([MYSQL_PROG_AR], [
-AC_REQUIRE([MYSQL_CHECK_CXX_VERSION])
case $CXX_VERSION in
MIPSpro*)
AR=$CXX
diff --git a/configure.in b/configure.in
index 843837b9348..1dff42cbfb1 100644
--- a/configure.in
+++ b/configure.in
@@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.48)
-AM_CONFIG_HEADER(config.h)
+AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
DOT_FRM_VERSION=6
@@ -2898,6 +2898,12 @@ then
ndb_opt_subdirs="$ndb_opt_subdirs docs"
ndb_bin_am_ldflags=""
fi
+# building dynamic breaks on AIX. (If you want to try it and get unresolved
+# __vec__delete2 and some such, try linking against libhC.)
+case "$host_os" in
+ aix3.* | aix4.0.* | aix4.1.*) ;;
+ *) ndb_bin_am_ldflags="-static";;
+esac
AC_SUBST([ndb_bin_am_ldflags])
AC_SUBST([ndb_opt_subdirs])
diff --git a/include/Makefile.am b/include/Makefile.am
index 2cd72052a15..c856b6398fe 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -49,8 +49,11 @@ link_sources:
@readline_h_ln_cmd@
@yassl_h_ln_cmd@
-my_config.h: ../config.h
- $(CP) ../config.h my_config.h
+# We want both "my_config.h" and "config.h" that are identical, as
+# MySQL sources assumes the name "my_config.h", and 3rd party sources
+# assumes the name "config.h".
+my_config.h: config.h
+ $(CP) config.h my_config.h
# These files should not be included in distributions since they are
# generated by configure from the .h.in files
diff --git a/include/mysql.h b/include/mysql.h
index a153d0b51db..b3e0dc45496 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -27,6 +27,10 @@
#ifndef _mysql_h
#define _mysql_h
+#ifdef _AIX /* large-file support will break without this */
+#include <standards.h>
+#endif
+
#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 5eb5010ad8c..71e65153eac 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -278,7 +278,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
case HA_EXTRA_PREPARE_FOR_DELETE:
pthread_mutex_lock(&THR_LOCK_myisam);
share->last_version= 0L; /* Impossible version */
-#ifdef __WIN__
+#ifdef __WIN__REMOVE_OBSOLETE_WORKAROUND
/* Close the isam and data files as Win32 can't drop an open table */
pthread_mutex_lock(&share->intern_lock);
if (flush_key_blocks(share->key_cache, share->kfile,
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 1920a68b21b..439b13af779 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -37,12 +37,7 @@ EXTRA_DIST = $(EXTRA_SCRIPTS) suite
GENSCRIPTS = mysql-test-run-shell mysql-test-run install_test_db mtr
PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
-test_DATA = std_data/client-key.pem \
- std_data/client-cert.pem \
- std_data/cacert.pem \
- std_data/server-cert.pem \
- std_data/server-key.pem
-CLEANFILES = $(GENSCRIPTS) $(test_DATA)
+CLEANFILES = $(GENSCRIPTS)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
@@ -111,17 +106,6 @@ install-data-local:
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
-std_data/client-key.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/client-cert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/cacert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-cert.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-std_data/server-key.pem: $(top_srcdir)/SSL/$(@F)
- @RM@ -f $@; @CP@ $(top_srcdir)/SSL/$(@F) $(srcdir)/std_data
-
# mtr - a shortcut for executing mysql-test-run.pl
mtr:
$(RM) -f mtr
diff --git a/mysql-test/include/have_bug25714.inc b/mysql-test/include/have_bug25714.inc
new file mode 100644
index 00000000000..0c995cd0d4c
--- /dev/null
+++ b/mysql-test/include/have_bug25714.inc
@@ -0,0 +1,7 @@
+#
+# Check if the variable MYSQL_BUG25714 is set
+#
+--require r/have_bug25714.require
+disable_query_log;
+eval select LENGTH("MYSQL_BUG25714") > 0 as "have_bug25714_exe";
+enable_query_log;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index c58ed308bd8..43b1ef7ac86 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -144,6 +144,7 @@ our $exe_mysqladmin;
our $exe_mysql_upgrade;
our $exe_mysqlbinlog;
our $exe_mysql_client_test;
+our $exe_bug25714;
our $exe_mysqld;
our $exe_mysqlcheck;
our $exe_mysqldump;
@@ -1630,6 +1631,12 @@ sub executable_setup () {
"$glob_basedir/tests/mysql_client_test",
"$glob_basedir/bin/mysql_client_test");
}
+
+ # Look for bug25714 executable which may _not_ exist in
+ # some versions, test using it should be skipped
+ $exe_bug25714=
+ mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
+ "$glob_basedir/tests/bug25714");
}
@@ -2011,6 +2018,11 @@ sub environment_setup () {
$ENV{'MYSQL'}= $cmdline_mysql;
# ----------------------------------------------------
+ # Setup env so childs can execute bug25714
+ # ----------------------------------------------------
+ $ENV{'MYSQL_BUG25714'}= $exe_bug25714;
+
+ # ----------------------------------------------------
# Setup env so childs can execute mysql_client_test
# ----------------------------------------------------
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 4eace9ac628..f24a1788404 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -903,3 +903,15 @@ f1 f2 f21 f4 f41
1 2000-01-01 00:00:00 2000-01-01 2002-02-02 00:00:00 2002-02-02
drop table t1;
set sql_mode= @orig_sql_mode;
+create table t1 (c char(10) default "Two");
+lock table t1 write;
+insert into t1 values ();
+alter table t1 modify c char(10) default "Three";
+unlock tables;
+select * from t1;
+c
+Two
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index 91c385112b4..3356d23053f 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -136,8 +136,8 @@ update ignore t1 set id=1023 where id=1010;
select * from t1 where parent_id=102 order by parent_id,id;
id parent_id level
1008 102 2
-1010 102 2
1015 102 2
+1010 102 2
explain select level from t1 where level=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref level level 1 const X Using index
diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result
index 60806e7393e..03219d0977e 100644
--- a/mysql-test/r/check.result
+++ b/mysql-test/r/check.result
@@ -14,3 +14,11 @@ test.v1 check status OK
test.t2 check status OK
drop view v1;
drop table t1, t2;
+CREATE TEMPORARY TABLE t1(a INT);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+DROP TABLE t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index e692dbf3938..3cba394189a 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1503,4 +1503,33 @@ t1 CREATE TABLE `t1` (
`c17` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+
+Bug #26104 Bug on foreign key class constructor
+
+Check that ref_columns is initalized correctly in the constructor
+and semantic checks in mysql_prepare_table work.
+
+We do not need a storage engine that supports foreign keys
+for this test, as the checks are purely syntax-based, and the
+syntax is supported for all engines.
+
+drop table if exists t1,t2;
+create table t1(a int not null, b int not null, primary key (a, b));
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+ERROR 42000: Incorrect foreign key definition for 'fk_bug26104': Key reference and table reference don't match
+drop table t1;
+create table t1(f1 int,f2 int);
+insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
+flush status;
+create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
+show status like 'handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 7
+drop table t1,t2;
End of 5.0 tests
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 56522ba2f50..74fa20af685 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -40,17 +40,18 @@ CREATE TABLE federated.t1 (
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3';
-ERROR HY000: Can't create federated table. Foreign data src error: error: 1146 'Table 'federated.t3' doesn't exist'
+SELECT * FROM federated.t1;
+ERROR HY000: The foreign data source you are trying to reference does not exist. Data source error: error: 1146 'Table 'federated.t3' doesn't exist'
+DROP TABLE federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1';
-ERROR HY000: Unable to connect to foreign data source: database: 'federated' username: 'user' hostname: '127.0.0.1'
-DROP TABLE IF EXISTS federated.t1;
-Warnings:
-Note 1051 Unknown table 't1'
+SELECT * FROM federated.t1;
+ERROR HY000: Unable to connect to foreign data source: Access denied for user 'user'@'localhost' (using password: YES)
+DROP TABLE federated.t1;
CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
diff --git a/mysql-test/r/federated_bug_25714.result b/mysql-test/r/federated_bug_25714.result
new file mode 100644
index 00000000000..12554f7af3a
--- /dev/null
+++ b/mysql-test/r/federated_bug_25714.result
@@ -0,0 +1,56 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP DATABASE IF EXISTS federated;
+CREATE DATABASE federated;
+DROP TABLE IF EXISTS federated.bug_13118_table;
+CREATE TABLE federated.t1 (
+`id` int auto_increment primary key,
+`value` int
+) ENGINE=MyISAM;
+INSERT INTO federated.t1 SET value=1;
+INSERT INTO federated.t1 SET value=2;
+INSERT INTO federated.t1 SET value=2;
+DROP TABLE IF EXISTS federated.t1;
+CREATE TABLE federated.t1 (
+`id` int auto_increment primary key,
+`value` int
+) ENGINE=FEDERATED
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1';
+SELECT * from federated.t1;
+id value
+1 1
+2 2
+3 2
+INSERT INTO federated.t1 SET value=4;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+4
+
+5 inserted
+6 inserted
+
+7 inserted
+8 inserted
+SELECT * from federated.t1;
+id value
+1 1
+2 2
+3 2
+4 4
+5 54
+6 55
+7 54
+8 55
+DROP TABLE federated.t1;
+DROP TABLE federated.t1;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 56ea72a8ee3..f92ecac329a 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -840,11 +840,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)`
-SET @TMP=NOW();
+SET @TMP='2007-08-01 12:22:49';
CREATE TABLE t1 (d DATETIME);
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:01');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:20');
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
count(*)
3
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 88f635595d6..d4ffbe43a91 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -824,6 +824,23 @@ a
2
1
DROP TABLE t1;
+CREATE TABLE t1 (
+f1 int(10) unsigned NOT NULL auto_increment primary key,
+f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+f1 varchar(10) NOT NULL default '',
+f2 char(3) NOT NULL default '',
+PRIMARY KEY (`f1`),
+KEY `k1` (`f2`,`f1`)
+);
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+avg(t2.f1)
+SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+avg(t2.f1)
+DROP TABLE t1, t2;
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
diff --git a/mysql-test/r/have_bug25714.require b/mysql-test/r/have_bug25714.require
new file mode 100644
index 00000000000..5acc378dcf7
--- /dev/null
+++ b/mysql-test/r/have_bug25714.require
@@ -0,0 +1,2 @@
+have_bug25714_exe
+1
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 9b131109809..f113304c767 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -158,6 +158,25 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
DROP table t1;
+CREATE TABLE t1 (a int PRIMARY KEY);
+CREATE TABLE t2 (b int PRIMARY KEY, a int);
+CREATE TABLE t3 (b int, flag int);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
+INSERT INTO t3(b,flag) VALUES (2, 1);
+SELECT t1.a
+FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+a
+SELECT DISTINCT t1.a, MAX(t3.flag)
+FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+a MAX(t3.flag)
+SELECT DISTINCT t1.a
+FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+a
+DROP TABLE t1,t2,t3;
create table t1 (col1 int, col2 varchar(5), col_t1 int);
create table t2 (col1 int, col2 varchar(5), col_t2 int);
create table t3 (col1 int, col2 varchar(5), col_t3 int);
diff --git a/mysql-test/r/innodb-big.result b/mysql-test/r/innodb-big.result
index 19204b7cc65..84bb02d445e 100644
--- a/mysql-test/r/innodb-big.result
+++ b/mysql-test/r/innodb-big.result
@@ -32,3 +32,69 @@ select sum(id) from t3;
sum(id)
2199024304128
drop table t1,t2,t3,t4;
+CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+CREATE TRIGGER t1_bi before INSERT
+ON t1 FOR EACH ROW
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+INSERT INTO t2 (f2) VALUES (1);
+DELETE FROM t2 WHERE f2 = 1;
+END;|
+CREATE PROCEDURE proc24989()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+INSERT INTO t2 (f2) VALUES (1);
+DELETE FROM t2 WHERE f2 = 1;
+END;|
+create procedure proc24989_2()
+deterministic
+begin
+declare continue handler for sqlexception
+select 'Outer handler' as 'exception';
+insert into t1 values(1);
+select "continued";
+end|
+start transaction;
+insert into t1 values(1);
+start transaction;
+insert into t2 values(123);
+insert into t1 values(1);
+insert into t1 values(1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select @a;
+@a
+NULL
+select * from t2;
+f2
+commit;
+start transaction;
+insert into t1 values(1);
+start transaction;
+insert into t2 values(123);
+call proc24989();
+insert into t1 values(1);
+select @a,@b;
+@a @b
+exception deadlock
+select * from t2;
+f2
+commit;
+start transaction;
+insert into t1 values(1);
+start transaction;
+insert into t2 values(123);
+call proc24989_2();
+insert into t1 values(1);
+commit;
+exception
+Outer handler
+continued
+continued
+select * from t2;
+f2
+drop procedure proc24989;
+drop procedure proc24989_2;
+drop table t1,t2;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 80b46e5098a..6082a30bce3 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1648,7 +1648,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
-ERROR HY000: Can't create table './test/t2' (errno: 150)
+ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
show create table t2;
Table Create Table
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index a7f6b0ad9d7..63e25b7aa1e 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -739,6 +739,302 @@ drop table if exists t1;
create table t1 (a int) engine=innodb;
alter table t1 alter a set default 1;
drop table t1;
+
+Bug#24918 drop table and lock / inconsistent between
+perm and temp tables
+
+Check transactional tables under LOCK TABLES
+
+drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
+t24918_access;
+create table t24918_access (id int);
+create table t24918 (id int) engine=myisam;
+create temporary table t24918_tmp (id int) engine=myisam;
+create table t24918_trans (id int) engine=innodb;
+create temporary table t24918_trans_tmp (id int) engine=innodb;
+lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
+drop table t24918;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_trans;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_trans_tmp;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+drop table t24918_tmp;
+select * from t24918_access;
+ERROR HY000: Table 't24918_access' was not locked with LOCK TABLES
+unlock tables;
+drop table t24918_access;
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
+INSERT INTO t1 SELECT a + 8, 2 FROM t1;
+INSERT INTO t1 SELECT a + 16, 1 FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
+id 1
+select_type SIMPLE
+table t1
+type ref
+possible_keys bkey
+key bkey
+key_len 5
+ref const
+rows 16
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b=2 ORDER BY a;
+a b
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+id 1
+select_type SIMPLE
+table t1
+type range
+possible_keys bkey
+key bkey
+key_len 5
+ref NULL
+rows 16
+Extra Using where; Using index; Using filesort
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+a b
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+17 1
+18 1
+19 1
+20 1
+21 1
+22 1
+23 1
+24 1
+25 1
+26 1
+27 1
+28 1
+29 1
+30 1
+31 1
+32 1
+EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+id 1
+select_type SIMPLE
+table t1
+type range
+possible_keys bkey
+key bkey
+key_len 5
+ref NULL
+rows 16
+Extra Using where; Using index
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+a b
+17 1
+18 1
+19 1
+20 1
+21 1
+22 1
+23 1
+24 1
+25 1
+26 1
+27 1
+28 1
+29 1
+30 1
+31 1
+32 1
+1 2
+2 2
+3 2
+4 2
+5 2
+6 2
+7 2
+8 2
+9 2
+10 2
+11 2
+12 2
+13 2
+14 2
+15 2
+16 2
+CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
+ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
+INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
+INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
+EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 5
+ref const
+rows 8
+Extra Using where; Using index; Using filesort
+SELECT * FROM t2 WHERE b=1 ORDER BY a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+id 1
+select_type SIMPLE
+table t2
+type ref
+possible_keys bkey
+key bkey
+key_len 10
+ref const,const
+rows 8
+Extra Using where; Using index
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+a b c
+1 1 1
+2 1 1
+3 1 1
+4 1 1
+5 1 1
+6 1 1
+7 1 1
+8 1 1
+9 1 1
+10 1 1
+11 1 1
+12 1 1
+13 1 1
+14 1 1
+15 1 1
+16 1 1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a + 8 FROM t1;
+INSERT INTO t1 SELECT a + 16 FROM t1;
+CREATE PROCEDURE p1 ()
+BEGIN
+DECLARE i INT DEFAULT 50;
+DECLARE cnt INT;
+START TRANSACTION;
+ALTER TABLE t1 ENGINE=InnoDB;
+COMMIT;
+START TRANSACTION;
+WHILE (i > 0) DO
+SET i = i - 1;
+SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
+END WHILE;
+COMMIT;
+END;|
+CALL p1();
+CALL p1();
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
create table t1(a text) engine=innodb default charset=utf8;
insert into t1 values('aaa');
alter table t1 add index(a(1024));
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 8cb94072818..d16562d97e2 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -699,6 +699,32 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 1
DROP TABLE t1;
+CREATE TABLE t1 (
+f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
+f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+f1 varchar(10) NOT NULL default '',
+f2 char(3) NOT NULL default '',
+PRIMARY KEY (`f1`),
+KEY `k1` (`f2`, `f1`)
+);
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+min(t2.f1)
+INSERT INTO t1 (f2)
+SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT * FROM t1;
+f1 f2
+1
+DROP TABLE t1, t2;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index 8fc5bfca3ef..5777bd890b2 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -280,3 +280,116 @@ select
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1
drop table t1, t2;
+create temporary table tt (a int unique);
+create table ti (a int) engine=innodb;
+reset master;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+begin;
+insert into ti values (1);
+insert into ti values (2) ;
+insert into tt select * from ti;
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+select count(*) from tt /* 2 */;
+count(*)
+2
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 507
+show binlog events from 98;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into ti values (1)
+master-bin.000001 # Query 1 # use `test`; insert into ti values (2)
+master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+select count(*) from ti /* zero */;
+count(*)
+0
+insert into ti select * from tt;
+select * from ti /* that is what slave would miss - a bug */;
+a
+1
+2
+delete from ti;
+delete from tt where a=1;
+reset master;
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+begin;
+insert into ti values (1);
+insert into ti values (2) /* to make the dup error in the following */;
+insert into tt select * from ti /* one affected and error */;
+ERROR 23000: Duplicate entry '2' for key 1
+rollback;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 581
+show binlog events from 98;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query 1 # use `test`; BEGIN
+master-bin.000001 # Query 1 # use `test`; insert into ti values (1)
+master-bin.000001 # Query 1 # use `test`; insert into ti values (2) /* to make the dup error in the following */
+master-bin.000001 # Query 1 # use `test`; insert into tt select * from ti /* one affected and error */
+master-bin.000001 # Query 1 # use `test`; ROLLBACK
+select count(*) from ti /* zero */;
+count(*)
+0
+insert into ti select * from tt;
+select * from tt /* that is what otherwise slave missed - the bug */;
+a
+1
+2
+drop table ti;
+drop function if exists bug27417;
+drop table if exists t1,t2;
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
+CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a));
+create function bug27417(n int)
+RETURNS int(11)
+begin
+insert into t1 values (null);
+return n;
+end|
+reset master;
+insert into t2 values (bug27417(1));
+insert into t2 select bug27417(2);
+reset master;
+insert into t2 values (bug27417(2));
+ERROR 23000: Duplicate entry '2' for key 1
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+/* only (!) with fixes for #23333 will show there is the query */;
+select count(*) from t1 /* must be 3 */;
+count(*)
+3
+reset master;
+select count(*) from t2;
+count(*)
+2
+delete from t2 where a=bug27417(3);
+select count(*) from t2 /* nothing got deleted */;
+count(*)
+2
+show master status;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 195
+/* the query must be in regardless of #23333 */;
+select count(*) from t1 /* must be 5 */;
+count(*)
+5
+delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
+affected rows: 0
+select count(*) from t1 /* must be 7 */;
+count(*)
+7
+drop function bug27417;
+drop table t1,t2;
+end of tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 1ba198dfd75..d16a4c39a11 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -318,4 +318,11 @@ INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
+flush logs;
+create table t1(a int);
+insert into t1 values(connection_id());
+flush logs;
+drop table t1;
+1
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 9ae3e368e28..261c7a7f197 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -93,55 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t4` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t5` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t6` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
@@ -172,55 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t4` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t5` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t6` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index da05fe7bc5b..42c437857b7 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -28,9 +28,12 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(64,20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
#
@@ -40,9 +43,12 @@ CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999');
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (RES);
DROP TABLE t1;
#
@@ -58,15 +64,21 @@ INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);
ERROR 42S22: Unknown column '1.2345' in 'field list'
SET SQL_MODE=@OLD_SQL_MODE;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
);
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -80,10 +92,13 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456)
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -106,10 +121,13 @@ UNLOCK TABLES;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
);
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -185,9 +203,12 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=koi8r;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -218,9 +239,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -241,9 +265,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -262,9 +289,12 @@ DROP TABLE t1;
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
#
create table ```a` (i int);
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE ```a` (
`i` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
drop table ```a`;
#
# Bug #2591 "mysqldump quotes names inconsistently"
@@ -282,9 +312,12 @@ create table t1(a int);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -307,9 +340,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1" (
"a" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -335,9 +371,12 @@ set global sql_mode='ANSI_QUOTES';
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -360,9 +399,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1" (
"a" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -392,9 +434,12 @@ insert into t1 values (1),(2),(3);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -483,9 +528,12 @@ INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -516,9 +564,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -539,9 +590,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -562,9 +616,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) TYPE=MyISAM;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -598,9 +655,12 @@ INSERT INTO t2 VALUES (4),(5),(6);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -636,9 +696,12 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -674,9 +737,12 @@ INSERT INTO t1 VALUES (4),(5),(6);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -705,9 +771,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
@@ -1071,6 +1140,8 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`F_c4ca4238a0b923820dcc509a6f75849b` int(11) default NULL,
`F_c81e728d9d4c2f636f067f89cc14862c` int(11) default NULL,
@@ -1403,6 +1474,7 @@ CREATE TABLE `t1` (
`F_6faa8040da20ef399b63a72d0e4ab575` int(11) default NULL,
`F_fe73f687e5bc5280214e0486b273a5f9` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1443,9 +1515,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1484,13 +1559,19 @@ INSERT INTO t2 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1513,13 +1594,19 @@ CREATE TABLE `t2` (
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1719,17 +1806,26 @@ create table t3(a int);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1759,9 +1855,12 @@ mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manu
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1792,12 +1891,15 @@ insert into t1 values (0815, 4711, 2006);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -1823,12 +1925,15 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1874,10 +1979,13 @@ create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` varchar(30) default NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -1955,9 +2063,12 @@ create view v1 as select * from t1;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2012,10 +2123,13 @@ create view v2 as select * from t2 where a like 'a%' with check option;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` varchar(30) default NULL,
KEY `a` (`a`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2064,9 +2178,12 @@ INSERT INTO t1 VALUES ('\'');
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2107,11 +2224,14 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL,
`c` varchar(30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2227,10 +2347,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2238,6 +2361,8 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
@@ -2260,17 +2385,22 @@ end if;
end */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
@@ -2280,7 +2410,7 @@ end if;
end */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2307,10 +2437,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` bigint(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2318,9 +2451,12 @@ INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2444,9 +2580,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2534,10 +2673,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2568,10 +2710,13 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`d` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
UNIQUE KEY `d` (`d`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2618,9 +2763,12 @@ a2
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1 test";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t1 test" (
"a1" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t1 test" WRITE;
/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
@@ -2628,17 +2776,22 @@ INSERT INTO "t1 test" VALUES (1),(2),(3);
/*!40000 ALTER TABLE "t1 test" ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
DROP TABLE IF EXISTS "t2 test";
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE "t2 test" (
"a2" int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES "t2 test" WRITE;
/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
@@ -2687,11 +2840,14 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` varchar(32) default NULL,
`c` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2779,15 +2935,20 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
+/*!50003 SET @SAVE_SQL_MODE=@@SQL_MODE*/;
+
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
@@ -2795,7 +2956,7 @@ SET new.a = 0;
END */;;
DELIMITER ;
-/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!50003 SET SESSION SQL_MODE=@SAVE_SQL_MODE*/;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -2825,10 +2986,13 @@ insert into t1 values ('','');
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` binary(1) default NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2857,10 +3021,13 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` binary(1) default NULL,
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3015,9 +3182,12 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CH
USE `mysqldump_test_db`;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3062,11 +3232,14 @@ create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_tables`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `basetable` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`tag` varchar(64) default NULL,
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
@@ -3134,10 +3307,13 @@ mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SU
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` varchar(34) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
drop table t1;
drop user mysqltest_1@localhost;
#
@@ -3226,22 +3402,31 @@ CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`);
+SET character_set_client = @saved_cs_client;
DROP TABLE IF EXISTS `t2`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
UNLOCK TABLES;
DROP TABLE IF EXISTS `t3`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t3` WRITE;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
@@ -3317,10 +3502,13 @@ drop database mysqldump_test_db;
#
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`c1` int(11) default NULL,
`c2` longblob
);
+SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
DROP TABLE t1;
#
@@ -3334,5 +3522,27 @@ SELECT * FROM v1;
1
DROP VIEW v1;
#
+# Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
+# the SQL_MODE variable after the dumping of triggers.
+#
+CREATE TABLE t1 (c1 INT);
+CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
+CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+SET @TMP_SQL_MODE = @@SQL_MODE;
+SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
+INSERT INTO t2 VALUES (0), (1), (2);
+SET SQL_MODE = @TMP_SQL_MODE;
+SELECT * FROM t2;
+c1
+0
+1
+2
+SELECT * FROM t2;
+c1
+0
+1
+2
+DROP TABLE t1,t2;
+#
# End of 5.0 tests
#
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 3f10eed7ad7..9c6c29eea47 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -77,9 +77,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -108,9 +111,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -139,9 +145,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
+SET @saved_cs_client = @@character_set_client;
+SET character_set_client = utf8;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
+SET character_set_client = @saved_cs_client;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index f1f99012910..25c6d58dee2 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1467,6 +1467,125 @@ insert into t1 values ('c');
a
drop table t1;
set GLOBAL query_cache_size= default;
+SET GLOBAL query_cache_size=64*1024*1024;
+CREATE TABLE t1 (id INT);
+CREATE PROCEDURE proc29856(IN theUPC TEXT)
+BEGIN
+SET @stmtStr := '';
+SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr;
+PREPARE stmt FROM @stmtStr;
+EXECUTE stmt;
+END |
+CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
+25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
+51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
+77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
+102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
+121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
+140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
+159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,
+178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,
+197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
+216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
+235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
+254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,
+273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,
+292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,
+311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,
+330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,
+349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,
+368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,
+387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,
+406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,
+425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,
+444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,
+463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,
+482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,
+501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,
+520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,
+539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,
+558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,
+577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,
+596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,
+615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,
+634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,
+653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,
+672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,
+691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,
+710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,
+729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,
+748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,
+767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,
+786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,
+805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,
+824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,
+843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,
+862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,
+881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,
+900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,
+919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,
+938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,
+957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,
+976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,
+995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,
+1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,
+1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,
+1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,
+1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
+1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
+1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,
+1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,
+1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,
+1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,
+1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,
+1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,
+1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,
+1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,
+1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,
+1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,
+1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,
+1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,
+1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,
+1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,
+1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,
+1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,
+1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,
+1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,
+1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,
+1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,
+1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,
+1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,
+1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,
+1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,
+1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,
+1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,
+1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,
+1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,
+1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,
+1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,
+1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,
+1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,
+1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,
+1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,
+1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,
+1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,
+1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,
+1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,
+1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,
+1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,
+1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,
+1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,
+1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,
+1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,
+1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,
+1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,
+1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,
+1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,
+1806,1807,1808,1809,1810,1811');
+id
+DROP PROCEDURE proc29856;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock
set GLOBAL query_cache_type=1;
set GLOBAL query_cache_limit=10000;
diff --git a/mysql-test/r/rpl_insert_delayed.result b/mysql-test/r/rpl_insert_delayed.result
index 38e2cddd650..6815a727fd7 100644
--- a/mysql-test/r/rpl_insert_delayed.result
+++ b/mysql-test/r/rpl_insert_delayed.result
@@ -29,3 +29,26 @@ id name
10 my name
20 is Bond
drop table t1;
+CREATE TABLE t1(a int, UNIQUE(a));
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+flush table t1;
+show binlog events limit 11,100;
+Log_name Pos Event_type Server_id End_log_pos Info
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; flush table t1
+select * from t1;
+a
+1
+On slave
+show binlog events limit 12,100;
+Log_name Pos Event_type Server_id End_log_pos Info
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; INSERT DELAYED IGNORE INTO t1 VALUES(1)
+x x x x x use `test`; flush table t1
+select * from t1;
+a
+1
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/rpl_session_var.result b/mysql-test/r/rpl_session_var.result
index b5b4b815ade..787899932d6 100644
--- a/mysql-test/r/rpl_session_var.result
+++ b/mysql-test/r/rpl_session_var.result
@@ -41,3 +41,13 @@ select * from t2 order by b;
b a
1 1
drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`data` varchar(100),
+PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+INSERT INTO t1(data) VALUES(SESSION_USER());
+SELECT * FROM t1;
+id data
+1
+drop table t1;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 85528de00bc..b3eea989cd7 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1088,6 +1088,26 @@ DROP TABLE t1;
DROP VIEW v1;
DROP PROCEDURE p1;
DROP FUNCTION f1;
+set names koi8r;
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+use mysqltest1;
+CREATE TABLE t1(ËÏÌÏÎËÁ1 INT);
+
+---> Dumping mysqltest1 to show_check.mysqltest1.sql
+
+
+DROP DATABASE mysqltest1;
+
+
+---> Restoring mysqltest1...
+SHOW CREATE TABLE mysqltest1.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `ËÏÌÏÎËÁ1` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP DATABASE mysqltest1;
+use test;
flush status;
show variables like "log_queries_not_using_indexes";
Variable_name Value
diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result
index 5eac54803f0..186b2c05d34 100644
--- a/mysql-test/r/sp-prelocking.result
+++ b/mysql-test/r/sp-prelocking.result
@@ -267,4 +267,56 @@ drop table bug_27907_logs;
insert into bug_27907_t1(a) values (1);
ERROR 42S02: Table 'test.bug_27907_logs' doesn't exist
drop table bug_27907_t1;
+
+Bug#22427 create table if not exists + stored function results in
+inconsistent behavior
+
+Add a test case, the bug itself was fixed by the patch for
+Bug#20662
+
+drop table if exists t1;
+drop function if exists f_bug22427;
+create table t1 (i int);
+insert into t1 values (1);
+create function f_bug22427() returns int return (select max(i) from t1);
+select f_bug22427();
+f_bug22427()
+1
+create table if not exists t1 select f_bug22427() as i;
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 select f_bug22427() as i;
+ERROR 42S01: Table 't1' already exists
+drop table t1;
+drop function f_bug22427;
+#
+# Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
+#
+DROP table IF EXISTS t1,t2;
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c2 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+UPDATE t2 SET c2= c2 + 1;
+END//
+# Take a table lock on t1.
+# This should pre-lock t2 through the trigger.
+LOCK TABLE t1 WRITE;
+INSERT INTO t1 VALUES (3);
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+INSERT INTO t2 values(4);
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+UNLOCK TABLES;
+SELECT * FROM t1;
+c1
+1
+3
+SELECT * FROM t2;
+c2
+3
+DROP TRIGGER t1_ai;
+DROP TABLE t1, t2;
End of 5.0 tests
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 7a4deb3ea5f..4a278cd4aec 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -1,5 +1,10 @@
use test;
drop table if exists t1,t2,t3,t4;
+drop view if exists v1;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
create table t1 (
id char(16) not null default '',
data int not null
@@ -6144,7 +6149,7 @@ drop table t1,t2;
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
set @a=0;
-CREATE function bug27354() RETURNS int deterministic
+CREATE function bug27354() RETURNS int not deterministic
begin
insert into t1 values (null);
set @a=@a+1;
@@ -6176,6 +6181,73 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP VIEW v1;
DROP FUNCTION metered;
DROP TABLE t1;
+SET @p1_p2_cnt= 2;
+CREATE TABLE t1 (c1 INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+PREPARE s1 FROM 'SELECT c1 FROM v1';
+EXECUTE s1;
+c1
+EXECUTE s1;
+c1
+CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+WHILE loops > 0 DO
+SELECT c1 FROM v1;
+SET loops = loops - 1;
+END WHILE;
+END|
+CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+WHILE loops > 0 DO
+SELECT c1 FROM v1;
+CALL p1(@p1_p2_cnt);
+SET loops = loops - 1;
+END WHILE;
+END|
+CREATE FUNCTION f1(loops INT UNSIGNED)
+RETURNS INT
+BEGIN
+DECLARE tmp INT;
+WHILE loops > 0 DO
+SELECT c1 INTO tmp FROM v1;
+SET loops = loops - 1;
+END WHILE;
+RETURN loops;
+END|
+CALL p1(2);
+c1
+c1
+CALL p2(2);
+c1
+c1
+c1
+c1
+c1
+c1
+SELECT f1(2);
+f1(2)
+0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warning 1329 No data - zero rows fetched, selected, or processed
+PREPARE s1 FROM 'SELECT f1(2)';
+EXECUTE s1;
+f1(2)
+0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warning 1329 No data - zero rows fetched, selected, or processed
+EXECUTE s1;
+f1(2)
+0
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warning 1329 No data - zero rows fetched, selected, or processed
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
drop database if exists mysqltest_db1;
create database mysqltest_db1;
create procedure mysqltest_db1.sp_bug28551() begin end;
@@ -6201,4 +6273,45 @@ Level Code Message
use test;
drop procedure sp_bug29050;
drop table t1;
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2;
+CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3;
+CREATE TABLE t1 (c1 INT, INDEX(c1));
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+CREATE VIEW v1 AS SELECT c1 FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE c1=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f1();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM v1 WHERE c1=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM v1 WHERE c1=f1();
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand());
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
+DROP VIEW v1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+SET NAMES latin1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE áâä INT;
+SELECT áâä;
+END|
+CALL p1();
+áâä
+NULL
+SET NAMES default;
+DROP PROCEDURE p1;
End of 5.0 tests
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 4b18e525e62..a07318435f6 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1933,4 +1933,32 @@ Before UPDATE, new=multi-UPDATE, SET for t2, but the trigger is fired, old=multi
After UPDATE, new=multi-UPDATE, SET for t2, but the trigger is fired, old=multi-UPDATE
drop view v1;
drop table t1, t2, t1_op_log;
+
+Bug#27248 Triggers: error if insert affects temporary table
+
+The bug was fixed by the fix for Bug#26141
+
+drop table if exists t1;
+drop temporary table if exists t2;
+create table t1 (s1 int);
+create temporary table t2 (s1 int);
+create trigger t1_bi before insert on t1 for each row insert into t2 values (0);
+create trigger t1_bd before delete on t1 for each row delete from t2;
+insert into t1 values (0);
+insert into t1 values (0);
+select * from t1;
+s1
+0
+0
+select * from t2;
+s1
+0
+0
+delete from t1;
+select * from t1;
+s1
+select * from t2;
+s1
+drop table t1;
+drop temporary table t2;
End of 5.0 tests
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index ca516f027ba..994001d94e5 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1829,3 +1829,27 @@ c1 + 0
0
2
DROP TABLE t1,t2;
+CREATE TABLE t1(a enum('a','b','c','d'));
+INSERT INTO t1 VALUES (4),(1),(0),(3);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+SELECT a FROM t1;
+a
+d
+a
+
+c
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT a FROM t1 WHERE a=0;
+a
+
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 1 const 1 Using index
+SELECT a FROM t1 WHERE a=0;
+a
+
+DROP TABLE t1;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index c51a4c30960..c5c6b675146 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3547,4 +3547,19 @@ a b
6 6
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+create table t1 (i int);
+insert into t1 values (1), (2), (1), (3), (2), (4);
+create view v1 as select distinct i from t1;
+select * from v1;
+i
+1
+2
+3
+4
+select table_name, is_updatable from information_schema.views
+where table_name = 'v1';
+table_name is_updatable
+v1 NO
+drop view v1;
+drop table t1;
End of 5.0 tests.
diff --git a/SSL/cacert.pem b/mysql-test/std_data/cacert.pem
index b445e77d7c4..b445e77d7c4 100644
--- a/SSL/cacert.pem
+++ b/mysql-test/std_data/cacert.pem
diff --git a/SSL/client-cert.pem b/mysql-test/std_data/client-cert.pem
index fdd5c86a23f..fdd5c86a23f 100644
--- a/SSL/client-cert.pem
+++ b/mysql-test/std_data/client-cert.pem
diff --git a/SSL/client-key.pem b/mysql-test/std_data/client-key.pem
index 22f8e23ab2a..22f8e23ab2a 100644
--- a/SSL/client-key.pem
+++ b/mysql-test/std_data/client-key.pem
diff --git a/SSL/server-cert.pem b/mysql-test/std_data/server-cert.pem
index f420b4f3124..f420b4f3124 100644
--- a/SSL/server-cert.pem
+++ b/mysql-test/std_data/server-cert.pem
diff --git a/SSL/server-key.pem b/mysql-test/std_data/server-key.pem
index a4842624c0c..a4842624c0c 100644
--- a/SSL/server-key.pem
+++ b/mysql-test/std_data/server-key.pem
diff --git a/mysql-test/suite/funcs_1/datadict/datadict_master.inc b/mysql-test/suite/funcs_1/datadict/datadict_master.inc
index 03d3eeb3777..2c8ceb4e68e 100644
--- a/mysql-test/suite/funcs_1/datadict/datadict_master.inc
+++ b/mysql-test/suite/funcs_1/datadict/datadict_master.inc
@@ -437,19 +437,23 @@ eval SELECT *
# check also with a 'simple' user
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+# OBN: The following line was added following the fix to bug 28181
+# where queries to information_schema will fail if exporting to
+# a file without having the FILE attribute
+GRANT FILE ON *.* TO user_3212@localhost;
+
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (u3212,localhost,user_3212,,db_datadict);
--source suite/funcs_1/include/show_connection.inc
# no db given --> db_datadict.schema does not exist
---error 1045
+--error 1146
eval SELECT *
INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-# FIXME 3.2.1.2: why do we get different error numbers with and without OUTFILE ?
--error 1146
eval SELECT *
FROM schemata LIMIT 0, 5;
@@ -460,8 +464,6 @@ eval SELECT *
LINES TERMINATED BY '\n'
FROM information_schema.schemata
WHERE schema_name LIKE 'db_%';
-# The above will fail with access error as long as
-# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT *
FROM information_schema.schemata
@@ -469,14 +471,11 @@ eval SELECT *
USE information_schema;
-# no db given --> db_datadict.schema does not exist
eval SELECT *
INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-# The above will fail with access error as long as
-# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT *
FROM schemata LIMIT 0, 5;
@@ -487,8 +486,6 @@ eval SELECT *
LINES TERMINATED BY '\n'
FROM information_schema.schemata
WHERE schema_name LIKE 'db_%';
-# The above will fail with access error as long as
-# BUBG#28181 - a regression introduced in 5.0.42 is not fixed
eval SELECT *
FROM information_schema.schemata
diff --git a/mysql-test/suite/funcs_1/r/innodb__datadict.result b/mysql-test/suite/funcs_1/r/innodb__datadict.result
index 675f30da14a..bbaef83ea59 100644
--- a/mysql-test/suite/funcs_1/r/innodb__datadict.result
+++ b/mysql-test/suite/funcs_1/r/innodb__datadict.result
@@ -4859,6 +4859,7 @@ INTO OUTFILE '../tmp/out.innodb.db.file'
WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict
@@ -4867,7 +4868,7 @@ INTO OUTFILE '../tmp/out.innodb.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO)
+ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT *
FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index 5fac88b8f14..f901bcf8246 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -2400,16 +2400,10 @@ my_time, id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL;
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL);
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL);
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2476,15 +2452,10 @@ my_date, id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL;
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL);
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL;
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL);
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2780,15 +2736,10 @@ my_time, id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL;
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL);
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL);
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2854,15 +2788,10 @@ my_date, id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL;
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL);
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL;
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL);
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL;
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL);
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$--'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values;
-SELECT CAST(my_year AS DECIMAL),
+SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL;
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3128,11 +3042,11 @@ NULL NULL 1
2005.00 2005 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL);
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3141,12 +3055,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values;
-SELECT CAST(my_time AS DECIMAL),
+SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL;
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3154,11 +3068,11 @@ NULL NULL 1
100000.00 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL);
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3167,12 +3081,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values;
-SELECT CAST(my_timestamp AS DECIMAL),
+SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL;
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL);
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values;
-SELECT CAST(my_date AS DECIMAL),
+SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL;
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3206,11 +3120,11 @@ NULL NULL 1
20050628.00 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL);
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3219,12 +3133,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values;
-SELECT CAST(my_datetime AS DECIMAL),
+SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL;
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3232,11 +3146,11 @@ NULL NULL 1
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL);
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3245,12 +3159,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values;
-SELECT CAST(my_decimal AS DECIMAL),
+SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL;
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3258,11 +3172,11 @@ NULL NULL 1
-1.00 -1.000000000000000000000000000000 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL);
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3271,12 +3185,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values;
-SELECT CAST(my_bigint AS DECIMAL),
+SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL;
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3284,11 +3198,11 @@ NULL NULL 1
-1.00 -1 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL);
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3297,12 +3211,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values;
-SELECT CAST(my_varbinary_1000 AS DECIMAL),
+SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL;
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL);
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values;
-SELECT CAST(my_binary_30 AS DECIMAL),
+SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL;
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL);
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values;
-SELECT CAST(my_varchar_1000 AS DECIMAL),
+SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL;
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL);
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values;
-SELECT CAST(my_char_30 AS DECIMAL),
+SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL;
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
@@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL);
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
index a2bb203b294..56f20781995 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0102.result
@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = innodb;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
-ERROR HY000: Trigger in wrong schema
+ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index 0f2d54f01ba..bb087d5882e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -484,9 +484,8 @@ BEGIN
WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136
-SET @counter1 = @counter1 + 1;
-END' at line 3
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
+END' at line 4
delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_09.result b/mysql-test/suite/funcs_1/r/innodb_trig_09.result
index 54b191e401e..685de95db51 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_09.result
@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11
+Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 63d1c8a3131..3bb56a82612 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -10202,7 +10202,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
-test.v1 check error Table 'test.v1' doesn't exist
+test.v1 check Error Table 'test.v1' doesn't exist
+test.v1 check error Corrupt
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
diff --git a/mysql-test/suite/funcs_1/r/memory__datadict.result b/mysql-test/suite/funcs_1/r/memory__datadict.result
index 1dea8a5f4a9..fda7cc6e76e 100644
--- a/mysql-test/suite/funcs_1/r/memory__datadict.result
+++ b/mysql-test/suite/funcs_1/r/memory__datadict.result
@@ -4842,6 +4842,7 @@ INTO OUTFILE '../tmp/out.memory.db.file'
WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict
@@ -4850,7 +4851,7 @@ INTO OUTFILE '../tmp/out.memory.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO)
+ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT *
FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index 08e49d1bf6f..552b549a1a0 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -2400,16 +2400,10 @@ my_time, id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL;
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL);
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL);
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2476,15 +2452,10 @@ my_date, id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL;
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL);
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL;
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL);
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2780,15 +2736,10 @@ my_time, id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL;
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL);
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL);
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2854,15 +2788,10 @@ my_date, id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL;
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL);
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL;
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL);
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL;
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL);
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$--'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values;
-SELECT CAST(my_year AS DECIMAL),
+SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL;
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3128,11 +3042,11 @@ NULL NULL 1
2005.00 2005 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL);
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3141,12 +3055,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values;
-SELECT CAST(my_time AS DECIMAL),
+SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL;
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3154,11 +3068,11 @@ NULL NULL 1
100000.00 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL);
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3167,12 +3081,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values;
-SELECT CAST(my_timestamp AS DECIMAL),
+SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL;
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL);
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values;
-SELECT CAST(my_date AS DECIMAL),
+SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL;
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3206,11 +3120,11 @@ NULL NULL 1
20050628.00 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL);
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3219,12 +3133,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values;
-SELECT CAST(my_datetime AS DECIMAL),
+SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL;
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3232,11 +3146,11 @@ NULL NULL 1
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL);
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3245,12 +3159,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values;
-SELECT CAST(my_decimal AS DECIMAL),
+SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL;
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3258,11 +3172,11 @@ NULL NULL 1
-1.00 -1.000000000000000000000000000000 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL);
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3271,12 +3185,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values;
-SELECT CAST(my_bigint AS DECIMAL),
+SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL;
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3284,11 +3198,11 @@ NULL NULL 1
-1.00 -1 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL);
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3297,12 +3211,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values;
-SELECT CAST(my_varbinary_1000 AS DECIMAL),
+SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL;
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL);
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values;
-SELECT CAST(my_binary_30 AS DECIMAL),
+SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL;
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL);
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values;
-SELECT CAST(my_varchar_1000 AS DECIMAL),
+SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL;
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL);
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values;
-SELECT CAST(my_char_30 AS DECIMAL),
+SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL;
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
@@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL);
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0102.result b/mysql-test/suite/funcs_1/r/memory_trig_0102.result
index 0a640201d76..e7fec297ca7 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0102.result
@@ -233,7 +233,7 @@ create table t1 (f1 integer) engine = memory;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
-ERROR HY000: Trigger in wrong schema
+ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index 9a14845d0eb..a842bbc3ac7 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -480,9 +480,8 @@ BEGIN
WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136
-SET @counter1 = @counter1 + 1;
-END' at line 3
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
+END' at line 4
delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_09.result b/mysql-test/suite/funcs_1/r/memory_trig_09.result
index c1b9ec6d33f..3dbe64958e3 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_09.result
@@ -190,7 +190,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11
+Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 516eef24439..69dee081446 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -10207,7 +10207,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
-test.v1 check error Table 'test.v1' doesn't exist
+test.v1 check Error Table 'test.v1' doesn't exist
+test.v1 check error Corrupt
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
diff --git a/mysql-test/suite/funcs_1/r/myisam__datadict.result b/mysql-test/suite/funcs_1/r/myisam__datadict.result
index e9082e7aee7..b95d51f3801 100644
--- a/mysql-test/suite/funcs_1/r/myisam__datadict.result
+++ b/mysql-test/suite/funcs_1/r/myisam__datadict.result
@@ -4912,6 +4912,7 @@ INTO OUTFILE '../tmp/out.myisam.db.file'
WHERE schema_name LIKE 'db_%';
CREATE USER user_3212@localhost;
GRANT ALL ON db_datadict.* TO user_3212@localhost;
+GRANT FILE ON *.* TO user_3212@localhost;
connect(localhost,user_3212,,db_datadict,MYSQL_PORT,MYSQL_SOCK);
user_3212@localhost db_datadict
@@ -4920,7 +4921,7 @@ INTO OUTFILE '../tmp/out.myisam.user.file'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM schemata LIMIT 0, 5;
-ERROR 28000: Access denied for user 'user_3212'@'localhost' (using password: NO)
+ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
SELECT *
FROM schemata LIMIT 0, 5;
ERROR 42S02: Table 'db_datadict.schemata' doesn't exist
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index 4f8a1b23bc0..94cba9796a2 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -2400,16 +2400,10 @@ my_time, id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL;
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as unsigned) AS `CAST(my_time AS UNSIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2418,16 +2412,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 89 OR select_id IS NULL);
CAST(my_time AS UNSIGNED INTEGER) my_time id
NULL NULL 1
-18446744073709550778 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1105 Cast to unsigned converted negative integer to it's positive complement
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+18446744073701165657 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2438,16 +2426,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL;
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as unsigned) AS `CAST(my_timestamp AS UNSIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2456,16 +2438,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 88 OR select_id IS NULL);
CAST(my_timestamp AS UNSIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2476,15 +2452,10 @@ my_date, id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL;
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as unsigned) AS `CAST(my_date AS UNSIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2493,15 +2464,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 87 OR select_id IS NULL);
CAST(my_date AS UNSIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2512,15 +2478,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL;
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as unsigned) AS `CAST(my_datetime AS UNSIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2529,15 +2490,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 86 OR select_id IS NULL);
CAST(my_datetime AS UNSIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2780,15 +2736,10 @@ my_time, id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL;
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as signed) AS `CAST(my_time AS SIGNED INTEGER)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2797,15 +2748,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 78 OR select_id IS NULL);
CAST(my_time AS SIGNED INTEGER) my_time id
NULL NULL 1
--838 -838:59:59 2
-838 838:59:59 3
-13 13:00:00 4
-10 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '-838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '838:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '13:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '10:00:00'
+-8385959 -838:59:59 2
+8385959 838:59:59 3
+130000 13:00:00 4
+100000 10:00:00 5
DROP VIEW v1;
@@ -2816,16 +2762,10 @@ my_timestamp, id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL;
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as signed) AS `CAST(my_timestamp AS SIGNED INTEGER)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2834,16 +2774,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 77 OR select_id IS NULL);
CAST(my_timestamp AS SIGNED INTEGER) my_timestamp id
0 0000-00-00 00:00:00 1
-1970 1970-01-01 03:00:01 2
-2038 2038-01-01 02:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0000-00-00 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '1970-01-01 03:00:01'
-Warning 1292 Truncated incorrect INTEGER value: '2038-01-01 02:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+19700101030001 1970-01-01 03:00:01 2
+20380101025959 2038-01-01 02:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2854,15 +2788,10 @@ my_date, id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL;
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as signed) AS `CAST(my_date AS SIGNED INTEGER)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2871,15 +2800,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 76 OR select_id IS NULL);
CAST(my_date AS SIGNED INTEGER) my_date id
NULL NULL 1
-1 0001-01-01 2
-9999 9999-12-31 3
-2004 2004-02-29 4
-2005 2005-06-28 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28'
+10101 0001-01-01 2
+99991231 9999-12-31 3
+20040229 2004-02-29 4
+20050628 2005-06-28 5
DROP VIEW v1;
@@ -2890,15 +2814,10 @@ my_datetime, id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL;
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as signed) AS `CAST(my_datetime AS SIGNED INTEGER)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
@@ -2907,15 +2826,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 75 OR select_id IS NULL);
CAST(my_datetime AS SIGNED INTEGER) my_datetime id
NULL NULL 1
-1 0001-01-01 00:00:00 2
-9999 9999-12-31 23:59:59 3
-2004 2004-02-29 23:59:59 4
-2005 2005-06-28 10:00:00 5
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '0001-01-01 00:00:00'
-Warning 1292 Truncated incorrect INTEGER value: '9999-12-31 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2004-02-29 23:59:59'
-Warning 1292 Truncated incorrect INTEGER value: '2005-06-28 10:00:00'
+10101000000 0001-01-01 00:00:00 2
+99991231235959 9999-12-31 23:59:59 3
+20040229235959 2004-02-29 23:59:59 4
+20050628100000 2005-06-28 10:00:00 5
DROP VIEW v1;
@@ -2926,8 +2840,8 @@ my_decimal, id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL;
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -2941,8 +2855,8 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 74 OR select_id IS NULL);
CAST(my_decimal AS SIGNED INTEGER) my_decimal id
NULL NULL 1
--10000000000000000 -9999999999999999999999999999999999.999999999999999999999999999999 2
-10000000000000000 9999999999999999999999999999999999.999999999999999999999999999999 3
+-9223372036854775808 -9999999999999999999999999999999999.999999999999999999999999999999 2
+9223372036854775807 9999999999999999999999999999999999.999999999999999999999999999999 3
0 0.000000000000000000000000000000 4
-1 -1.000000000000000000000000000000 5
Warnings:
@@ -3115,12 +3029,12 @@ Warning 1292 Truncated incorrect INTEGER value: ' ---äÖüß@µ*$--'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values;
-SELECT CAST(my_year AS DECIMAL),
+SELECT CAST(my_year AS DECIMAL(37,2)),
my_year, id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL;
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3128,11 +3042,11 @@ NULL NULL 1
2005.00 2005 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal) AS `CAST(my_year AS DECIMAL)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as decimal(37,2)) AS `CAST(my_year AS DECIMAL(37,2))`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 68 OR select_id IS NULL);
-CAST(my_year AS DECIMAL) my_year id
+CAST(my_year AS DECIMAL(37,2)) my_year id
NULL NULL 1
1901.00 1901 2
2155.00 2155 3
@@ -3141,12 +3055,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values;
-SELECT CAST(my_time AS DECIMAL),
+SELECT CAST(my_time AS DECIMAL(37,2)),
my_time, id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL;
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3154,11 +3068,11 @@ NULL NULL 1
100000.00 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal) AS `CAST(my_time AS DECIMAL)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as decimal(37,2)) AS `CAST(my_time AS DECIMAL(37,2))`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 67 OR select_id IS NULL);
-CAST(my_time AS DECIMAL) my_time id
+CAST(my_time AS DECIMAL(37,2)) my_time id
NULL NULL 1
-8385959.00 -838:59:59 2
8385959.00 838:59:59 3
@@ -3167,12 +3081,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values;
-SELECT CAST(my_timestamp AS DECIMAL),
+SELECT CAST(my_timestamp AS DECIMAL(37,2)),
my_timestamp, id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL;
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3180,11 +3094,11 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal) AS `CAST(my_timestamp AS DECIMAL)`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_timestamp` as decimal(37,2)) AS `CAST(my_timestamp AS DECIMAL(37,2))`,`t1_values`.`my_timestamp` AS `my_timestamp`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 66 OR select_id IS NULL);
-CAST(my_timestamp AS DECIMAL) my_timestamp id
+CAST(my_timestamp AS DECIMAL(37,2)) my_timestamp id
0.00 0000-00-00 00:00:00 1
19700101030001.00 1970-01-01 03:00:01 2
20380101025959.00 2038-01-01 02:59:59 3
@@ -3193,12 +3107,12 @@ CAST(my_timestamp AS DECIMAL) my_timestamp id
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values;
-SELECT CAST(my_date AS DECIMAL),
+SELECT CAST(my_date AS DECIMAL(37,2)),
my_date, id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL;
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3206,11 +3120,11 @@ NULL NULL 1
20050628.00 2005-06-28 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal) AS `CAST(my_date AS DECIMAL)`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_date` as decimal(37,2)) AS `CAST(my_date AS DECIMAL(37,2))`,`t1_values`.`my_date` AS `my_date`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 65 OR select_id IS NULL);
-CAST(my_date AS DECIMAL) my_date id
+CAST(my_date AS DECIMAL(37,2)) my_date id
NULL NULL 1
10101.00 0001-01-01 2
99991231.00 9999-12-31 3
@@ -3219,12 +3133,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values;
-SELECT CAST(my_datetime AS DECIMAL),
+SELECT CAST(my_datetime AS DECIMAL(37,2)),
my_datetime, id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL;
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3232,11 +3146,11 @@ NULL NULL 1
20050628100000.00 2005-06-28 10:00:00 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal) AS `CAST(my_datetime AS DECIMAL)`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_datetime` as decimal(37,2)) AS `CAST(my_datetime AS DECIMAL(37,2))`,`t1_values`.`my_datetime` AS `my_datetime`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 64 OR select_id IS NULL);
-CAST(my_datetime AS DECIMAL) my_datetime id
+CAST(my_datetime AS DECIMAL(37,2)) my_datetime id
NULL NULL 1
10101000000.00 0001-01-01 00:00:00 2
99991231235959.00 9999-12-31 23:59:59 3
@@ -3245,12 +3159,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values;
-SELECT CAST(my_decimal AS DECIMAL),
+SELECT CAST(my_decimal AS DECIMAL(37,2)),
my_decimal, id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL;
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3258,11 +3172,11 @@ NULL NULL 1
-1.00 -1.000000000000000000000000000000 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal) AS `CAST(my_decimal AS DECIMAL)`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_decimal` as decimal(37,2)) AS `CAST(my_decimal AS DECIMAL(37,2))`,`t1_values`.`my_decimal` AS `my_decimal`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 63 OR select_id IS NULL);
-CAST(my_decimal AS DECIMAL) my_decimal id
+CAST(my_decimal AS DECIMAL(37,2)) my_decimal id
NULL NULL 1
-10000000000000000000000000000000000.00 -9999999999999999999999999999999999.999999999999999999999999999999 2
10000000000000000000000000000000000.00 9999999999999999999999999999999999.999999999999999999999999999999 3
@@ -3271,12 +3185,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values;
-SELECT CAST(my_bigint AS DECIMAL),
+SELECT CAST(my_bigint AS DECIMAL(37,2)),
my_bigint, id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL;
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3284,11 +3198,11 @@ NULL NULL 1
-1.00 -1 5
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal) AS `CAST(my_bigint AS DECIMAL)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as decimal(37,2)) AS `CAST(my_bigint AS DECIMAL(37,2))`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 62 OR select_id IS NULL);
-CAST(my_bigint AS DECIMAL) my_bigint id
+CAST(my_bigint AS DECIMAL(37,2)) my_bigint id
NULL NULL 1
-9223372036854775808.00 -9223372036854775808 2
9223372036854775807.00 9223372036854775807 3
@@ -3297,12 +3211,12 @@ NULL NULL 1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values;
-SELECT CAST(my_varbinary_1000 AS DECIMAL),
+SELECT CAST(my_varbinary_1000 AS DECIMAL(37,2)),
my_varbinary_1000, id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL;
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3315,11 +3229,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal) AS `CAST(my_varbinary_1000 AS DECIMAL)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 61 OR select_id IS NULL);
-CAST(my_varbinary_1000 AS DECIMAL) my_varbinary_1000 id
+CAST(my_varbinary_1000 AS DECIMAL(37,2)) my_varbinary_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3333,12 +3247,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values;
-SELECT CAST(my_binary_30 AS DECIMAL),
+SELECT CAST(my_binary_30 AS DECIMAL(37,2)),
my_binary_30, id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL;
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3356,11 +3270,11 @@ Warning 1292 Truncated incorrect DECIMAL value: '-1'
Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal) AS `CAST(my_binary_30 AS DECIMAL)`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_binary_30` as decimal(37,2)) AS `CAST(my_binary_30 AS DECIMAL(37,2))`,`t1_values`.`my_binary_30` AS `my_binary_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 60 OR select_id IS NULL);
-CAST(my_binary_30 AS DECIMAL) my_binary_30 id
+CAST(my_binary_30 AS DECIMAL(37,2)) my_binary_30 id
NULL NULL 1
0.00
0.00 <--------30 characters-------> 3
@@ -3379,12 +3293,12 @@ Warning 1292 Truncated incorrect DECIMAL value: '-3333.3333'
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values;
-SELECT CAST(my_varchar_1000 AS DECIMAL),
+SELECT CAST(my_varchar_1000 AS DECIMAL(37,2)),
my_varchar_1000, id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL;
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3397,11 +3311,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Error 1366 Incorrect decimal value: '' for column '' at row -1
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal) AS `CAST(my_varchar_1000 AS DECIMAL)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 59 OR select_id IS NULL);
-CAST(my_varchar_1000 AS DECIMAL) my_varchar_1000 id
+CAST(my_varchar_1000 AS DECIMAL(37,2)) my_varchar_1000 id
NULL NULL 1
0.00 2
0.00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
@@ -3415,12 +3329,12 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
DROP VIEW v1;
-CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL),
+CREATE VIEW v1 AS SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values;
-SELECT CAST(my_char_30 AS DECIMAL),
+SELECT CAST(my_char_30 AS DECIMAL(37,2)),
my_char_30, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL;
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
@@ -3436,11 +3350,11 @@ Error 1366 Incorrect decimal value: '' for column '' at row -1
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal) AS `CAST(my_char_30 AS DECIMAL)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values`
SELECT v1.* FROM v1
WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL);
-CAST(my_char_30 AS DECIMAL) my_char_30 id
+CAST(my_char_30 AS DECIMAL(37,2)) my_char_30 id
NULL NULL 1
0.00 2
0.00 <--------30 characters-------> 3
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
index 4bbee8aa133..6dd56a1e912 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0102.result
@@ -237,7 +237,7 @@ create table t1 (f1 integer) engine = myisam;
use test;
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
-ERROR HY000: Trigger in wrong schema
+ERROR 42S02: Table 'trig_db.tb3' doesn't exist
use trig_db;
CREATE TRIGGER trg6_3 AFTER INSERT on test.tb3
for each row set @ret_trg6_3 = 18;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index ec8e12ff32d..8a13e91d71d 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -484,9 +484,8 @@ BEGIN
WHILE @counter1 < new.f136
SET @counter1 = @counter1 + 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHILE @counter1 < new.f136
-SET @counter1 = @counter1 + 1;
-END' at line 3
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @counter1 = @counter1 + 1;
+END' at line 4
delete from tb3 where f122='Test 3.5.8.5-while';
drop trigger trg7;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_09.result b/mysql-test/suite/funcs_1/r/myisam_trig_09.result
index 9643aa567e3..b7a5933e2f7 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_09.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_09.result
@@ -194,7 +194,7 @@ a NULL Test 3.5.9.4 7 999 995.240000000000000000000000000000
Update tb3 Set f122='Test 3.5.9.4-trig', f136=NULL, f151=DEFAULT, f163=NULL
where f122='Test 3.5.9.4';
Warnings:
-Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'f136' at row 11
+Warning 1048 Column 'f136' cannot be null
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig';
f118 f121 f122 f136 f151 f163
diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result
index 1dbebbccb29..83af04dcd2c 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views.result
@@ -10224,7 +10224,8 @@ SHOW FIELDS FROM v1;
ERROR 42S02: Table 'test.v1' doesn't exist
CHECK TABLE v1;
Table Op Msg_type Msg_text
-test.v1 check error Table 'test.v1' doesn't exist
+test.v1 check Error Table 'test.v1' doesn't exist
+test.v1 check error Corrupt
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
diff --git a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc
index 26a5dab3370..b11455c07d3 100644
--- a/mysql-test/suite/funcs_1/triggers/triggers_0102.inc
+++ b/mysql-test/suite/funcs_1/triggers/triggers_0102.inc
@@ -265,7 +265,7 @@ let $message= Testcase 3.5.1.8:;
# Can't create a trigger in a different database
use test;
- --error 1435
+ --error 1146
CREATE TRIGGER trig_db.trg6_2 AFTER INSERT on tb3
for each row set @ret_trg6_2 = 5;
diff --git a/mysql-test/suite/funcs_1/views/func_view.inc b/mysql-test/suite/funcs_1/views/func_view.inc
index 4479db22e70..c477eafc610 100644
--- a/mysql-test/suite/funcs_1/views/func_view.inc
+++ b/mysql-test/suite/funcs_1/views/func_view.inc
@@ -609,7 +609,8 @@ let $col_type= my_year;
# 1.1.6. CAST --> DECIMAL
-let $target_type= DECIMAL;
+# Set the following to (37,2) since the default was changed to (10,0) - OBN
+let $target_type= DECIMAL(37,2);
#
let $col_type= my_char_30;
--source suite/funcs_1/views/fv_cast.inc
diff --git a/mysql-test/suite/row_lock/include/row_lock.inc b/mysql-test/suite/row_lock/include/row_lock.inc
deleted file mode 100644
index 8572bc0246e..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock.inc
+++ /dev/null
@@ -1,83 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-COMMIT;
-SELECT @@global.tx_isolation;
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
deleted file mode 100644
index f0823067eac..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
+++ /dev/null
@@ -1,94 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext2;
-DELIMITER |;
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT count(*)/2 INTO res FROM t1;
- RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT count(*)/2 INTO res FROM t2;
- RETURN res;
-END;
-|
-DELIMITER ;|
-CALL fill_t1 (10);
-CALL fill_t2 (10);
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-SELECT k from t1 WHERE k < half_t1();
-SELECT k from t1 WHERE k >= half_t1();
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
deleted file mode 100644
index 8535c016819..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
+++ /dev/null
@@ -1,93 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext2;
-DELIMITER |;
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t1;
- RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t2;
- RETURN res;
-END;
-|
-DELIMITER ;|
-eval CALL fill_t1 ($nbrows);
-eval CALL fill_t2 ($nbrows);
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
deleted file mode 100644
index 050f2a54016..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
+++ /dev/null
@@ -1,93 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-eval $indext2;
-DELIMITER |;
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t1;
- RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
- INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
- SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
- DECLARE res int DEFAULT 0;
- SELECT MOD(k,2) INTO res FROM t2;
- RETURN res;
-END;
-|
-DELIMITER ;|
-eval CALL fill_t1 ($nbrows);
-eval CALL fill_t2 ($nbrows);
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE;
-DELETE FROM t1 WHERE t1.k % 2 = 1;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
-SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_trig.inc b/mysql-test/suite/row_lock/include/row_lock_trig.inc
deleted file mode 100644
index 384f00f243e..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_trig.inc
+++ /dev/null
@@ -1,96 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-DELIMITER |;
-
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
- FOR EACH ROW BEGIN
- UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
- END;
-|
-
-DELIMITER ;|
-
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_view.inc b/mysql-test/suite/row_lock/include/row_lock_view.inc
deleted file mode 100644
index fbed8f64d3a..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view.inc
+++ /dev/null
@@ -1,89 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE v1 SET i=325 where i=125;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE v1 SET i=326 where i=126;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
deleted file mode 100644
index 9e8cf3d34fc..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
+++ /dev/null
@@ -1,92 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-# With the two separate selects (without join) the differs from
-# that select with join.
-
-# Both transaction are able to update the tables
-eval EXPLAIN $select;
-eval $select;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-#UPDATE v1 SET i=325 where i=125;
-#SELECT * FROM v1 ORDER BY i,l;
-#SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-SELECT * FROM t1 ORDER BY t1.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
-#DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
deleted file mode 100644
index 479392098be..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
+++ /dev/null
@@ -1,126 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS stp_t;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
-CONNECT (root2, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i from t1;
-DELIMITER |;
-
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
- BEGIN
- UPDATE t2 SET i = p2 WHERE i = p1;
- UPDATE v1 SET i = p2 WHERE i = p1;
- SELECT * FROM v1 ORDER BY i;
- SELECT * FROM t1 ORDER BY t1.k;
- SELECT * FROM t2 ORDER BY t2.k;
- END;
-|
-
-DELIMITER ;|
-
-COMMIT;
-SELECT @@global.tx_isolation;
-eval EXPLAIN $select;
-eval $select;
---echo connection root1;
-CONNECTION root1;
-CALL stp_t (125, 225);
-
---echo connection root2;
-CONNECTION root2;
-CALL stp_t (127, 227);
-
---echo connection default;
-CONNECTION default;
-CALL stp_t (123, 223);
-
---echo connection root1;
-CONNECTION root1;
-CALL stp_t (126, 226);
-
---echo connection root2;
-CONNECTION root2;
-CALL stp_t (128, 228);
-
---echo connection default;
-CONNECTION default;
-CALL stp_t (124, 224);
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root2;
-CONNECTION root2;
-DELETE FROM t1 WHERE t1.i=228;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection root1;
-CONNECTION root1;
-COMMIT;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
-
---echo connection root2;
-CONNECTION root2;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root2;
-
---echo connection default;
-CONNECTION default;
---disable_warnings
-DROP VIEW v1;
-DROP PROCEDURE stp_t;
-DROP TABLE t1, t2;
---enable_warnings
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
deleted file mode 100644
index 785eb1b66a9..00000000000
--- a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
+++ /dev/null
@@ -1,99 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-SET autocommit=0;
-# Create additional connections used through test
-CONNECT (root1, localhost, root,,);
-SET autocommit=0;
---echo connection default;
-CONNECTION default;
-eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-eval $indext1;
-eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-eval $indext2;
-CREATE VIEW v1 AS SELECT t1.i from t1;
-DELIMITER |;
-
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
- FOR EACH ROW BEGIN
- UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
- END;
-|
-
-DELIMITER ;|
-
-COMMIT;
-SELECT @@global.tx_isolation;
-eval EXPLAIN $select;
-eval $select;
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection default;
-CONNECTION default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-COMMIT;
-
---echo connection root1;
-CONNECTION root1;
-ROLLBACK;
-
---echo connection default;
-CONNECTION default;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-
---echo connection root1;
-CONNECTION root1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-DISCONNECT root1;
---echo connection default;
-CONNECTION default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
deleted file mode 100644
index 54ed4350ba9..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
+++ /dev/null
@@ -1,142 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
deleted file mode 100644
index 56154e64489..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
deleted file mode 100644
index a89c55973d2..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
deleted file mode 100644
index 310d24a456a..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
+++ /dev/null
@@ -1,142 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
deleted file mode 100644
index ace5fddfad5..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
+++ /dev/null
@@ -1,32 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
deleted file mode 100644
index 8f00c3a0bb7..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
+++ /dev/null
@@ -1,97 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (10);
-CALL fill_t2 (10);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-connection root1;
-SELECT k from t1 WHERE k < half_t1();
-k
-0
-1
-2
-3
-4
-SELECT k from t1 WHERE k >= half_t1();
-k
-5
-6
-7
-8
-9
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 1111 0 100
-1 1111 1 101
-2 1111 2 102
-3 1111 3 103
-4 1111 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 2222 0 100
-1 2222 1 101
-2 2222 2 102
-3 2222 3 103
-4 2222 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
deleted file mode 100644
index 0b12f149193..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
+++ /dev/null
@@ -1,145 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (40);
-CALL fill_t2 (40);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-100 100
-102 102
-104 104
-106 106
-108 108
-110 110
-112 112
-114 114
-116 116
-118 118
-120 120
-122 122
-124 124
-126 126
-128 128
-130 130
-132 132
-134 134
-136 136
-138 138
-connection root1;
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-101 101
-103 103
-105 105
-107 107
-109 109
-111 111
-113 113
-115 115
-117 117
-119 119
-121 121
-123 123
-125 125
-127 127
-129 129
-131 131
-133 133
-135 135
-137 137
-139 139
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 1111 1 101
-2 102 2 102
-3 1111 3 103
-4 104 4 104
-5 1111 5 105
-6 106 6 106
-7 1111 7 107
-8 108 8 108
-9 1111 9 109
-10 110 10 110
-11 1111 11 111
-12 112 12 112
-13 1111 13 113
-14 114 14 114
-15 1111 15 115
-16 116 16 116
-17 1111 17 117
-18 118 18 118
-19 1111 19 119
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 2222 1 101
-2 102 2 102
-3 2222 3 103
-4 104 4 104
-5 2222 5 105
-6 106 6 106
-7 2222 7 107
-8 108 8 108
-9 2222 9 109
-10 110 10 110
-11 2222 11 111
-12 112 12 112
-13 2222 13 113
-14 114 14 114
-15 2222 15 115
-16 116 16 116
-17 2222 17 117
-18 118 18 118
-19 2222 19 119
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
deleted file mode 100644
index cc9f297f9fb..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
+++ /dev/null
@@ -1,113 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (40);
-CALL fill_t2 (40);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-100 100
-102 102
-104 104
-106 106
-108 108
-110 110
-112 112
-114 114
-116 116
-118 118
-120 120
-122 122
-124 124
-126 126
-128 128
-130 130
-132 132
-134 134
-136 136
-138 138
-connection root1;
-DELETE FROM t1 WHERE t1.k % 2 = 1;
-SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
-k i j l
-0 100 0 100
-2 102 2 102
-4 104 4 104
-6 106 6 106
-8 108 8 108
-10 110 10 110
-12 112 12 112
-14 114 14 114
-16 116 16 116
-18 118 18 118
-SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-10 110 10 110
-11 111 11 111
-12 112 12 112
-13 113 13 113
-14 114 14 114
-15 115 15 115
-16 116 16 116
-17 117 17 117
-18 118 18 118
-19 119 19 119
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
deleted file mode 100644
index dd43e5752e5..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
+++ /dev/null
@@ -1,151 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
deleted file mode 100644
index cb3a5c692e9..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
+++ /dev/null
@@ -1,37 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
deleted file mode 100644
index 834cb669833..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
+++ /dev/null
@@ -1,34 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
deleted file mode 100644
index 440138d4cd1..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
+++ /dev/null
@@ -1,40 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
deleted file mode 100644
index 230873b67a0..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
+++ /dev/null
@@ -1,48 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
deleted file mode 100644
index d792d573f8e..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
+++ /dev/null
@@ -1,40 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
deleted file mode 100644
index 77b9a4dd964..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
+++ /dev/null
@@ -1,312 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
-i
-123
-124
-126
-127
-128
-225
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (127, 227);
-i
-123
-124
-125
-126
-128
-227
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-connection default;
-CALL stp_t (123, 223);
-i
-124
-125
-126
-127
-128
-223
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-CALL stp_t (126, 226);
-i
-123
-124
-127
-128
-225
-226
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (128, 228);
-i
-123
-124
-125
-126
-227
-228
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-CALL stp_t (124, 224);
-i
-125
-126
-127
-128
-223
-224
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-DELETE FROM t1 WHERE t1.i=228;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-COMMIT;
-connection root1;
-ROLLBACK;
-connection root1;
-COMMIT;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-125
-126
-227
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
deleted file mode 100644
index 73d8a3f4bea..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
+++ /dev/null
@@ -1,47 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
deleted file mode 100644
index 90383a9489f..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
+++ /dev/null
@@ -1,183 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-126
-225
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM v1 ORDER BY i;
-i
-124
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-225
-226
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-224
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
deleted file mode 100644
index 55793558b21..00000000000
--- a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
+++ /dev/null
@@ -1,38 +0,0 @@
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
deleted file mode 100644
index 248c7d5ea1f..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
+++ /dev/null
@@ -1,139 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
deleted file mode 100644
index 109d99dd036..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
+++ /dev/null
@@ -1,31 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
deleted file mode 100644
index c936ea209ff..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
+++ /dev/null
@@ -1,30 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
deleted file mode 100644
index 875c783bd81..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
+++ /dev/null
@@ -1,139 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
deleted file mode 100644
index 0d94f8abf72..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
+++ /dev/null
@@ -1,30 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
deleted file mode 100644
index 94b67c63d94..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
+++ /dev/null
@@ -1,177 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT count(*)/2 INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (10);
-CALL fill_t2 (10);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-i i
-connection root1;
-SELECT k from t1 WHERE k < half_t1();
-k
-0
-3
-1
-2
-4
-SELECT k from t1 WHERE k >= half_t1();
-k
-6
-7
-9
-5
-8
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 1111 0 100
-1 1111 1 101
-2 1111 2 102
-3 1111 3 103
-4 1111 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 2222 0 100
-1 2222 1 101
-2 2222 2 102
-3 2222 3 103
-4 2222 4 104
-5 105 5 105
-6 106 6 106
-7 107 7 107
-8 108 8 108
-9 109 9 109
-connection default;
-UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 3333 5 105
-6 3333 6 106
-7 3333 7 107
-8 3333 8 108
-9 3333 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 4444 5 105
-6 4444 6 106
-7 4444 7 107
-8 4444 8 108
-9 4444 9 109
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 3333 5 105
-6 3333 6 106
-7 3333 7 107
-8 3333 8 108
-9 3333 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 4444 5 105
-6 4444 6 106
-7 4444 7 107
-8 4444 8 108
-9 4444 9 109
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 3333 5 105
-6 3333 6 106
-7 3333 7 107
-8 3333 8 108
-9 3333 9 109
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-0 100 0 100
-1 101 1 101
-2 102 2 102
-3 103 3 103
-4 104 4 104
-5 4444 5 105
-6 4444 6 106
-7 4444 7 107
-8 4444 8 108
-9 4444 9 109
-connection default;
-DROP VIEW IF EXISTS v1;
-Warnings:
-Note 1051 Unknown table 'test.v1'
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
deleted file mode 100644
index 9803895e1a7..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
+++ /dev/null
@@ -1,357 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (200);
-CALL fill_t2 (200);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-i i
-135 135
-119 119
-211 211
-184 184
-232 232
-105 105
-188 188
-216 216
-255 255
-154 154
-197 197
-279 279
-218 218
-127 127
-203 203
-281 281
-194 194
-161 161
-276 276
-122 122
-139 139
-183 183
-114 114
-247 247
-144 144
-148 148
-174 174
-267 267
-142 142
-168 168
-226 226
-258 258
-231 231
-146 146
-253 253
-189 189
-230 230
-290 290
-178 178
-158 158
-130 130
-214 214
-133 133
-229 229
-294 294
-295 295
-108 108
-112 112
-297 297
-151 151
-251 251
-270 270
-291 291
-159 159
-132 132
-121 121
-244 244
-272 272
-293 293
-186 186
-111 111
-166 166
-201 201
-175 175
-180 180
-209 209
-192 192
-246 246
-195 195
-107 107
-233 233
-239 239
-103 103
-109 109
-128 128
-266 266
-143 143
-160 160
-187 187
-243 243
-273 273
-259 259
-110 110
-176 176
-141 141
-170 170
-215 215
-191 191
-200 200
-271 271
-162 162
-260 260
-106 106
-150 150
-126 126
-147 147
-155 155
-193 193
-207 207
-287 287
-235 235
-252 252
-129 129
-205 205
-268 268
-278 278
-116 116
-137 137
-199 199
-217 217
-234 234
-190 190
-236 236
-257 257
-100 100
-210 210
-212 212
-264 264
-221 221
-241 241
-256 256
-262 262
-265 265
-269 269
-277 277
-173 173
-177 177
-208 208
-219 219
-285 285
-101 101
-164 164
-113 113
-125 125
-202 202
-140 140
-156 156
-282 282
-181 181
-206 206
-299 299
-102 102
-145 145
-227 227
-196 196
-138 138
-198 198
-204 204
-237 237
-171 171
-284 284
-263 263
-292 292
-104 104
-149 149
-250 250
-296 296
-228 228
-280 280
-242 242
-248 248
-185 185
-220 220
-245 245
-275 275
-118 118
-120 120
-152 152
-153 153
-157 157
-182 182
-179 179
-254 254
-288 288
-172 172
-283 283
-286 286
-115 115
-238 238
-289 289
-131 131
-223 223
-134 134
-136 136
-222 222
-225 225
-261 261
-274 274
-123 123
-163 163
-224 224
-117 117
-298 298
-169 169
-124 124
-167 167
-240 240
-249 249
-165 165
-213 213
-connection root1;
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
-i i
-209 209
-195 195
-107 107
-233 233
-239 239
-103 103
-109 109
-143 143
-187 187
-243 243
-273 273
-259 259
-141 141
-215 215
-191 191
-271 271
-147 147
-155 155
-193 193
-207 207
-287 287
-235 235
-129 129
-205 205
-137 137
-199 199
-217 217
-257 257
-221 221
-241 241
-265 265
-269 269
-277 277
-173 173
-177 177
-135 135
-119 119
-211 211
-105 105
-255 255
-197 197
-279 279
-127 127
-203 203
-281 281
-161 161
-139 139
-183 183
-247 247
-267 267
-231 231
-253 253
-189 189
-133 133
-229 229
-295 295
-297 297
-151 151
-251 251
-291 291
-159 159
-121 121
-293 293
-111 111
-201 201
-175 175
-185 185
-245 245
-275 275
-153 153
-157 157
-179 179
-283 283
-115 115
-289 289
-131 131
-223 223
-225 225
-261 261
-123 123
-163 163
-117 117
-169 169
-167 167
-249 249
-165 165
-213 213
-219 219
-285 285
-101 101
-113 113
-125 125
-181 181
-299 299
-145 145
-227 227
-237 237
-171 171
-263 263
-149 149
-UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
deleted file mode 100644
index adb89b03480..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
+++ /dev/null
@@ -1,255 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-CREATE INDEX ixi ON t2 (i);
-CREATE PROCEDURE fill_t1 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t1() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t1;
-RETURN res;
-END;
-|
-CREATE PROCEDURE fill_t2 (IN upb int)
-BEGIN
-DECLARE cnt int DEFAULT 0;
-WHILE cnt < upb DO
-INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
-SET cnt= cnt+1;
-END WHILE;
-END;
-|
-CREATE FUNCTION half_t2() RETURNS int
-BEGIN
-DECLARE res int DEFAULT 0;
-SELECT MOD(k,2) INTO res FROM t2;
-RETURN res;
-END;
-|
-CALL fill_t1 (200);
-CALL fill_t2 (200);
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
-1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-i i
-135 135
-119 119
-211 211
-184 184
-232 232
-105 105
-188 188
-216 216
-255 255
-154 154
-197 197
-279 279
-218 218
-127 127
-203 203
-281 281
-194 194
-161 161
-276 276
-122 122
-139 139
-183 183
-114 114
-247 247
-144 144
-148 148
-174 174
-267 267
-142 142
-168 168
-226 226
-258 258
-231 231
-146 146
-253 253
-189 189
-230 230
-290 290
-178 178
-158 158
-130 130
-214 214
-133 133
-229 229
-294 294
-295 295
-108 108
-112 112
-297 297
-151 151
-251 251
-270 270
-291 291
-159 159
-132 132
-121 121
-244 244
-272 272
-293 293
-186 186
-111 111
-166 166
-201 201
-175 175
-180 180
-209 209
-192 192
-246 246
-195 195
-107 107
-233 233
-239 239
-103 103
-109 109
-128 128
-266 266
-143 143
-160 160
-187 187
-243 243
-273 273
-259 259
-110 110
-176 176
-141 141
-170 170
-215 215
-191 191
-200 200
-271 271
-162 162
-260 260
-106 106
-150 150
-126 126
-147 147
-155 155
-193 193
-207 207
-287 287
-235 235
-252 252
-129 129
-205 205
-268 268
-278 278
-116 116
-137 137
-199 199
-217 217
-234 234
-190 190
-236 236
-257 257
-100 100
-210 210
-212 212
-264 264
-221 221
-241 241
-256 256
-262 262
-265 265
-269 269
-277 277
-173 173
-177 177
-208 208
-219 219
-285 285
-101 101
-164 164
-113 113
-125 125
-202 202
-140 140
-156 156
-282 282
-181 181
-206 206
-299 299
-102 102
-145 145
-227 227
-196 196
-138 138
-198 198
-204 204
-237 237
-171 171
-284 284
-263 263
-292 292
-104 104
-149 149
-250 250
-296 296
-228 228
-280 280
-242 242
-248 248
-185 185
-220 220
-245 245
-275 275
-118 118
-120 120
-152 152
-153 153
-157 157
-182 182
-179 179
-254 254
-288 288
-172 172
-283 283
-286 286
-115 115
-238 238
-289 289
-131 131
-223 223
-134 134
-136 136
-222 222
-225 225
-261 261
-274 274
-123 123
-163 163
-224 224
-117 117
-298 298
-169 169
-124 124
-167 167
-240 240
-249 249
-165 165
-213 213
-connection root1;
-DELETE FROM t1 WHERE t1.k % 2 = 1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
deleted file mode 100644
index eb69fd2e306..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
+++ /dev/null
@@ -1,148 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 225
-4 126 4 226
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 223
-2 124 2 224
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
deleted file mode 100644
index bedb75da93a..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
+++ /dev/null
@@ -1,35 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
deleted file mode 100644
index 279f2626c73..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
+++ /dev/null
@@ -1,194 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-126 123
-126 124
-126 125
-126 126
-325 123
-325 124
-325 125
-325 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-124 123
-124 124
-124 125
-124 126
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE v1 SET i=326 where i=126;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-325 123
-325 124
-325 125
-325 126
-326 123
-326 124
-326 125
-326 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-connection default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-324 123
-324 124
-324 125
-324 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
deleted file mode 100644
index 9e74e93b0cc..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
+++ /dev/null
@@ -1,200 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE v1 SET i=325 where i=125;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-126 123
-126 124
-126 125
-126 126
-325 123
-325 124
-325 125
-325 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-124 123
-124 124
-124 125
-124 126
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE v1 SET i=326 where i=126;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-123 123
-123 124
-123 125
-123 126
-124 123
-124 124
-124 125
-124 126
-325 123
-325 124
-325 125
-325 126
-326 123
-326 124
-326 125
-326 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-connection default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-324 123
-324 124
-324 125
-324 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 325 3 125
-4 326 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
deleted file mode 100644
index b5b1c519702..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
+++ /dev/null
@@ -1,169 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
-SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-i i
-123 123
-124 124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE v1 SET i=323 where i=123;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-124 123
-124 124
-124 125
-124 126
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE v1 SET i=324 where i=124;
-SELECT * FROM v1 ORDER BY i,l;
-i l
-125 123
-125 124
-125 125
-125 126
-126 123
-126 124
-126 125
-126 126
-323 123
-323 124
-323 125
-323 126
-324 123
-324 124
-324 125
-324 126
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 323 1 123
-2 324 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
deleted file mode 100644
index d92f9ad9664..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
+++ /dev/null
@@ -1,38 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-1 SIMPLE t2 ALL NULL NULL NULL NULL 4
-SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-i
-123
-124
-123
-124
-123
-124
-123
-124
-connection root1;
-UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
deleted file mode 100644
index e2a2a6e7deb..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
+++ /dev/null
@@ -1,309 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS stp_t;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
-i
-123
-124
-126
-127
-128
-225
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (127, 227);
-i
-123
-124
-125
-126
-128
-227
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 128 6 128
-connection default;
-CALL stp_t (123, 223);
-i
-124
-125
-126
-127
-128
-223
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-CALL stp_t (126, 226);
-i
-123
-124
-127
-128
-225
-226
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-CALL stp_t (128, 228);
-i
-123
-124
-125
-126
-227
-228
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-CALL stp_t (124, 224);
-i
-125
-126
-127
-128
-223
-224
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-DELETE FROM t1 WHERE t1.i=228;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-COMMIT;
-connection root1;
-ROLLBACK;
-connection root1;
-COMMIT;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-127
-128
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 127 5 127
-6 128 6 128
-connection root2;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-227
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-5 227 5 127
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-5 227 5 127
-6 228 6 128
-connection default;
-DROP VIEW v1;
-DROP PROCEDURE stp_t;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
deleted file mode 100644
index 6dbd5f834ed..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
+++ /dev/null
@@ -1,46 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS stp_t;
-SET autocommit=0;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-INSERT INTO t1 VALUES (5,127,5,127);
-INSERT INTO t1 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-INSERT INTO t2 VALUES (5,127,5,127);
-INSERT INTO t2 VALUES (6,128,6,128);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
-BEGIN
-UPDATE t2 SET i = p2 WHERE i = p1;
-UPDATE v1 SET i = p2 WHERE i = p1;
-SELECT * FROM v1 ORDER BY i;
-SELECT * FROM t1 ORDER BY t1.k;
-SELECT * FROM t2 ORDER BY t2.k;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
deleted file mode 100644
index f5c745ca41c..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
+++ /dev/null
@@ -1,180 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-126
-225
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 126 4 126
-connection default;
-UPDATE t2 SET t2.i=223 WHERE t2.i=123;
-SELECT * FROM v1 ORDER BY i;
-i
-124
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 124 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-UPDATE t2 SET t2.i=226 WHERE t2.i=126;
-SELECT * FROM v1 ORDER BY i;
-i
-123
-124
-225
-226
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-UPDATE t2 SET t2.i=224 WHERE t2.i=124;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-224
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-DELETE FROM t1 WHERE t1.i=226;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 123 1 123
-2 124 2 124
-3 225 3 125
-4 226 4 126
-connection default;
-DELETE FROM t1 WHERE t1.i=224;
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-COMMIT;
-connection root1;
-ROLLBACK;
-connection default;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection root1;
-SELECT * FROM v1 ORDER BY i;
-i
-125
-126
-223
-SELECT * FROM t1 ORDER BY t1.k;
-k i j l
-1 223 1 123
-3 125 3 125
-4 126 4 126
-SELECT * FROM t2 ORDER BY t2.k;
-k i j l
-1 223 1 123
-2 224 2 124
-3 125 3 125
-4 126 4 126
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
deleted file mode 100644
index d6a38753c1d..00000000000
--- a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
+++ /dev/null
@@ -1,36 +0,0 @@
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-SET autocommit=0;
-SET autocommit=0;
-connection default;
-CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t1 VALUES (1,123,1,123);
-INSERT INTO t1 VALUES (2,124,2,124);
-INSERT INTO t1 VALUES (3,125,3,125);
-INSERT INTO t1 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t1 (i);
-CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
-INSERT INTO t2 VALUES (1,123,1,123);
-INSERT INTO t2 VALUES (2,124,2,124);
-INSERT INTO t2 VALUES (3,125,3,125);
-INSERT INTO t2 VALUES (4,126,4,126);
-#CREATE INDEX ixi ON t2 (i);
-CREATE VIEW v1 AS SELECT t1.i from t1;
-CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
-FOR EACH ROW BEGIN
-UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
-END;
-|
-COMMIT;
-SELECT @@global.tx_isolation;
-@@global.tx_isolation
-REPEATABLE-READ
-EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
-SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-i
-123
-124
-connection root1;
-UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/readme.txt b/mysql-test/suite/row_lock/readme.txt
deleted file mode 100644
index b43f04ecda4..00000000000
--- a/mysql-test/suite/row_lock/readme.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-All row lock test with InnoDB have to be executed with the options
-
---innodb_lock_wait_timeout=1
---innodb_locks_unsafe_for_binlog
-
-for example
-
-perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2
-
diff --git a/mysql-test/suite/row_lock/summary_of_sel_test.txt b/mysql-test/suite/row_lock/summary_of_sel_test.txt
deleted file mode 100644
index 0fa332e957a..00000000000
--- a/mysql-test/suite/row_lock/summary_of_sel_test.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Test plan:
-Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result.
-
-The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully.
-
-First session
-execute an explain to every select and one of the following selects on the first half of table t1:
-- select <non index columns> ... where ... for update;
-- select <non index columns> ... where ... lock in share mode;
-- select <indexed columns> ... where ... for update;
-- select <indexed columns> ... where ... lock in share mode;
-- select <indexed columns> ... ignore index ... where ... for update;
-- select <indexed columns> ... ignore index ... where ... lock in share mode;
-- select ... where (select...) ... for update;
-- select ... where (select...) ... lock in share mode;
-- (select ... where) union (select ... where) for update;
-- (select ... where) union (select ... where) lock in...;
-- select <view> ... where ... for update;
-- select <view> ... where ... lock in ...;
-- select <join> ... where ... for update;
-- select <join> ... where ... lock in ...;
-Then executes
-- update
-- delete
-- trigger accessing table t1
-- stored procedure accessing table t1
-- stored function accessing table t1
-
-Second session
-executes the same on the last half of table t1
-
-call of mysqld with option
---innodb_locks_unsafe_for_binlog
-
-As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan.
-
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
deleted file mode 100644
index e0440fe2669..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
deleted file mode 100644
index 5cb3ea9f2d9..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
deleted file mode 100644
index 11f4dc423d6..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
deleted file mode 100644
index 0a8ca9c13a0..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
deleted file mode 100644
index 7e411d31649..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
deleted file mode 100644
index 0c5b8b41bd5..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
deleted file mode 100644
index a12a07d82a9..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $nbrows= 40;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_1.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
deleted file mode 100644
index 49e834eb2ce..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $nbrows= 40;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_2.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
deleted file mode 100644
index 225513d3f87..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
deleted file mode 100644
index 88dee5f23f8..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
deleted file mode 100644
index d6381e1da5b..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
deleted file mode 100644
index ee45e683669..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
deleted file mode 100644
index 49cba88dd23..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
deleted file mode 100644
index b07f3a3378a..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
deleted file mode 100644
index d507ff3296f..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
deleted file mode 100644
index a1bfb16055e..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
deleted file mode 100644
index 24c76532d17..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
deleted file mode 100644
index a8a67d77979..00000000000
--- a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_innodb.inc
-SELECT @@global.innodb_table_locks into @table_locks;
-SET @@global.innodb_table_locks= OFF;
-let $engine= InnoDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
-SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
deleted file mode 100644
index 6ac2e829008..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
deleted file mode 100644
index 994ecba96b0..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
deleted file mode 100644
index 2de43c61c2a..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
deleted file mode 100644
index 72b20488c74..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
deleted file mode 100644
index 045f127a4ef..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
deleted file mode 100644
index bf2df104e03..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
deleted file mode 100644
index 4d32991d379..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $nbrows= 200;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_1.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
deleted file mode 100644
index 894a83fc1b0..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $nbrows= 200;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_big_tab_2.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
deleted file mode 100644
index a5586a6101e..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
deleted file mode 100644
index 7af13697ccc..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
deleted file mode 100644
index a1aaf5ab441..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
-
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
deleted file mode 100644
index b8feef693e7..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
deleted file mode 100644
index a97626048d3..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
deleted file mode 100644
index e7a9a715785..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
deleted file mode 100644
index f57bcb3dd1b..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
deleted file mode 100644
index b0aaa38fb93..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
deleted file mode 100644
index 9c4128d78bf..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= CREATE INDEX ixi ON t1 (i);
-let $indext2= CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
deleted file mode 100644
index 38c9472fb3d..00000000000
--- a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_ndb.inc
-let $engine= NDB;
-let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
-let $indext1= #CREATE INDEX ixi ON t1 (i);
-let $indext2= #CREATE INDEX ixi ON t2 (i);
---source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 3ced1087757..bcca122f9f8 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -684,3 +684,15 @@ alter table t1 add column f4 datetime not null default '2002-02-02',
select * from t1;
drop table t1;
set sql_mode= @orig_sql_mode;
+
+#
+# BUG#29957 - alter_table.test fails
+#
+create table t1 (c char(10) default "Two");
+lock table t1 write;
+insert into t1 values ();
+alter table t1 modify c char(10) default "Three";
+unlock tables;
+select * from t1;
+check table t1;
+drop table t1;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 4aef7395184..002dfad9981 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -307,6 +307,6 @@ select -(9223372036854775808);
select -((9223372036854775808));
select -(-(9223372036854775808));
--disable_metadata
---endble_ps_protocol
+--enable_ps_protocol
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
select -(-9223372036854775808), -(-(-9223372036854775808));
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index 8d9d70bd29a..698f6538529 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -36,3 +36,12 @@ Create view v1 as Select * from t1;
Check Table v1,t2;
drop view v1;
drop table t1, t2;
+
+#
+# BUG#26325 - TEMPORARY TABLE "corrupt" after first read, according to CHECK
+# TABLE
+#
+CREATE TEMPORARY TABLE t1(a INT);
+CHECK TABLE t1;
+REPAIR TABLE t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 99f3fea416a..64081c0248a 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1118,5 +1118,34 @@ show create table t1;
drop table t1;
+--echo
+--echo Bug #26104 Bug on foreign key class constructor
+--echo
+--echo Check that ref_columns is initalized correctly in the constructor
+--echo and semantic checks in mysql_prepare_table work.
+--echo
+--echo We do not need a storage engine that supports foreign keys
+--echo for this test, as the checks are purely syntax-based, and the
+--echo syntax is supported for all engines.
+--echo
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1(a int not null, b int not null, primary key (a, b));
+--error ER_WRONG_FK_DEF
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+drop table t1;
+
+#
+# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
+#
+create table t1(f1 int,f2 int);
+insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
+flush status;
+create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
+show status like 'handler_read%';
+drop table t1,t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index f649e0e0e21..63809373822 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -30,25 +30,28 @@ CREATE TABLE federated.t1 (
# test non-existant table
--replace_result $SLAVE_MYPORT SLAVE_PORT
---error 1434
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3';
+--error 1431
+SELECT * FROM federated.t1;
+DROP TABLE federated.t1;
# test bad user/password
--replace_result $SLAVE_MYPORT SLAVE_PORT
---error 1429
eval CREATE TABLE federated.t1 (
`id` int(20) NOT NULL,
`name` varchar(32) NOT NULL default ''
)
ENGINE="FEDERATED" DEFAULT CHARSET=latin1
CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+--error 1429
+SELECT * FROM federated.t1;
+DROP TABLE federated.t1;
-DROP TABLE IF EXISTS federated.t1;
# # correct connection, same named tables
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (
diff --git a/mysql-test/t/federated_bug_25714.test b/mysql-test/t/federated_bug_25714.test
new file mode 100644
index 00000000000..9c185181511
--- /dev/null
+++ b/mysql-test/t/federated_bug_25714.test
@@ -0,0 +1,47 @@
+--source include/have_bug25714.inc
+source include/federated.inc;
+
+
+connection slave;
+--disable_warnings
+DROP TABLE IF EXISTS federated.bug_13118_table;
+--enable_warnings
+
+CREATE TABLE federated.t1 (
+ `id` int auto_increment primary key,
+ `value` int
+ ) ENGINE=MyISAM;
+INSERT INTO federated.t1 SET value=1;
+INSERT INTO federated.t1 SET value=2;
+INSERT INTO federated.t1 SET value=2;
+
+connection master;
+--disable_warnings
+DROP TABLE IF EXISTS federated.t1;
+--enable_warnings
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE federated.t1 (
+ `id` int auto_increment primary key,
+ `value` int
+ ) ENGINE=FEDERATED
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
+
+SELECT * from federated.t1;
+
+INSERT INTO federated.t1 SET value=4;
+
+SELECT LAST_INSERT_ID();
+
+--exec $MYSQL_BUG25714 $SLAVE_MYPORT
+--exec $MYSQL_BUG25714 $MASTER_MYPORT
+
+SELECT * from federated.t1;
+
+DROP TABLE federated.t1;
+connection slave;
+DROP TABLE federated.t1;
+
+
+source include/federated_cleanup.inc;
+
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index da909dc578f..4f35a681228 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -423,11 +423,11 @@ select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
-SET @TMP=NOW();
+SET @TMP='2007-08-01 12:22:49';
CREATE TABLE t1 (d DATETIME);
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
-INSERT INTO t1 VALUES (NOW());
+INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:01');
+INSERT INTO t1 VALUES ('2007-08-01 12:23:20');
SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
DROP TABLE t1;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 538c5cd897d..91e69f9db34 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -633,6 +633,28 @@ SELECT a FROM t1 ORDER BY "a" DESC;
SELECT a FROM t1 ORDER BY `a` DESC;
DROP TABLE t1;
+#
+# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself
+# returns empty
+#
+CREATE TABLE t1 (
+ f1 int(10) unsigned NOT NULL auto_increment primary key,
+ f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+ f1 varchar(10) NOT NULL default '',
+ f2 char(3) NOT NULL default '',
+ PRIMARY KEY (`f1`),
+ KEY `k1` (`f2`,`f1`)
+);
+
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+DROP TABLE t1, t2;
+
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 9bea78a7bca..827b83f11a0 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -151,6 +151,32 @@ EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
DROP table t1;
+#
+# Bug #29911: HAVING clause depending on constant table and evaluated to false
+#
+
+CREATE TABLE t1 (a int PRIMARY KEY);
+CREATE TABLE t2 (b int PRIMARY KEY, a int);
+CREATE TABLE t3 (b int, flag int);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
+INSERT INTO t3(b,flag) VALUES (2, 1);
+
+SELECT t1.a
+ FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+ GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+
+SELECT DISTINCT t1.a, MAX(t3.flag)
+ FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+ GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+
+SELECT DISTINCT t1.a
+ FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
+ GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
+
+DROP TABLE t1,t2,t3;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/innodb-big.test b/mysql-test/t/innodb-big.test
index ade69ffdb45..dcb32cd8e71 100644
--- a/mysql-test/t/innodb-big.test
+++ b/mysql-test/t/innodb-big.test
@@ -44,3 +44,109 @@ INSERT INTO t3 SELECT concat(id),id from t2 ORDER BY -id;
INSERT INTO t4 SELECT * from t3 ORDER BY concat(a);
select sum(id) from t3;
drop table t1,t2,t3,t4;
+
+#
+# Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
+#
+CREATE TABLE t1 (f1 int NOT NULL) ENGINE=InnoDB;
+CREATE TABLE t2 (f2 int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+DELIMITER |;
+CREATE TRIGGER t1_bi before INSERT
+ ON t1 FOR EACH ROW
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+ INSERT INTO t2 (f2) VALUES (1);
+ DELETE FROM t2 WHERE f2 = 1;
+END;|
+
+CREATE PROCEDURE proc24989()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @b:= 'deadlock';
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
+ INSERT INTO t2 (f2) VALUES (1);
+ DELETE FROM t2 WHERE f2 = 1;
+END;|
+
+create procedure proc24989_2()
+ deterministic
+begin
+ declare continue handler for sqlexception
+ select 'Outer handler' as 'exception';
+
+ insert into t1 values(1);
+ select "continued";
+end|
+
+DELIMITER ;|
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+start transaction;
+insert into t1 values(1);
+
+connection con2;
+start transaction;
+insert into t2 values(123);
+send insert into t1 values(1);
+
+connection con1;
+--sleep 1
+insert into t1 values(1);
+
+connection con2;
+--error 1213
+reap;
+select @a;
+# check that the whole transaction was rolled back
+select * from t2;
+
+connection con1;
+commit;
+start transaction;
+insert into t1 values(1);
+
+connection con2;
+start transaction;
+insert into t2 values(123);
+send call proc24989();
+
+connection con1;
+--sleep 1
+insert into t1 values(1);
+
+connection con2;
+reap;
+select @a,@b;
+# check that the whole transaction was rolled back
+select * from t2;
+
+connection con1;
+commit;
+start transaction;
+insert into t1 values(1);
+
+connection con2;
+start transaction;
+insert into t2 values(123);
+send call proc24989_2();
+
+connection con1;
+--sleep 1
+insert into t1 values(1);
+commit;
+
+connection con2;
+reap;
+# check that the whole transaction was rolled back
+select * from t2;
+
+disconnect con1;
+disconnect con2;
+connection default;
+drop procedure proc24989;
+drop procedure proc24989_2;
+drop table t1,t2;
+
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index a9679c01071..04dfa1d0836 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1180,7 +1180,7 @@ drop table t2;
# Clean up filename -- embedded server reports whole path without .frm,
# regular server reports relative path with .frm (argh!)
--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2
---error 1005
+--error ER_WRONG_FK_DEF
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
# bug#3749
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 30b40f52901..adcfec68d3e 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -740,6 +740,8 @@ SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c)
set @@sort_buffer_size=default;
DROP TABLE t1,t2;
+
+
# Bug#27296 Assertion in ALTER TABLE SET DEFAULT in Linux Debug build
# (possible deadlock).
#
@@ -754,6 +756,123 @@ create table t1 (a int) engine=innodb;
alter table t1 alter a set default 1;
drop table t1;
+
+--echo
+--echo Bug#24918 drop table and lock / inconsistent between
+--echo perm and temp tables
+--echo
+--echo Check transactional tables under LOCK TABLES
+--echo
+--disable_warnings
+drop table if exists t24918, t24918_tmp, t24918_trans, t24918_trans_tmp,
+t24918_access;
+--enable_warnings
+create table t24918_access (id int);
+create table t24918 (id int) engine=myisam;
+create temporary table t24918_tmp (id int) engine=myisam;
+create table t24918_trans (id int) engine=innodb;
+create temporary table t24918_trans_tmp (id int) engine=innodb;
+
+lock table t24918 write, t24918_tmp write, t24918_trans write, t24918_trans_tmp write;
+drop table t24918;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+drop table t24918_trans;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+drop table t24918_trans_tmp;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+drop table t24918_tmp;
+--error ER_TABLE_NOT_LOCKED
+select * from t24918_access;
+unlock tables;
+
+drop table t24918_access;
+#
+# Bug #28591: MySQL need not sort the records in case of ORDER BY
+# primary_key on InnoDB table
+#
+
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY bkey (b)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,2),(3,2),(2,2),(4,2),(5,2),(6,2),(7,2),(8,2);
+INSERT INTO t1 SELECT a + 8, 2 FROM t1;
+INSERT INTO t1 SELECT a + 16, 1 FROM t1;
+query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a;
+SELECT * FROM t1 WHERE b=2 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+SELECT * FROM t1 WHERE b BETWEEN 1 AND 2 ORDER BY b,a;
+
+CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a), KEY bkey (b,c))
+ ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,1,1),(3,1,1),(2,1,1),(4,1,1);
+INSERT INTO t2 SELECT a + 4, 1, 1 FROM t2;
+INSERT INTO t2 SELECT a + 8, 1, 1 FROM t2;
+
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a;
+SELECT * FROM t2 WHERE b=1 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY a;
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY b,c,a;
+query_vertical EXPLAIN SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+SELECT * FROM t2 WHERE b=1 AND c=1 ORDER BY c,a;
+
+DROP TABLE t1,t2;
+
+
+#
+# Bug #29644: alter table hangs if records locked in share mode by long
+# running transaction
+#
+
+CREATE TABLE t1 (a INT, PRIMARY KEY (a)) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a + 8 FROM t1;
+INSERT INTO t1 SELECT a + 16 FROM t1;
+
+DELIMITER |;
+CREATE PROCEDURE p1 ()
+BEGIN
+ DECLARE i INT DEFAULT 50;
+ DECLARE cnt INT;
+ START TRANSACTION;
+ ALTER TABLE t1 ENGINE=InnoDB;
+ COMMIT;
+ START TRANSACTION;
+ WHILE (i > 0) DO
+ SET i = i - 1;
+ SELECT COUNT(*) INTO cnt FROM t1 LOCK IN SHARE MODE;
+ END WHILE;
+ COMMIT;
+END;|
+
+DELIMITER ;|
+
+CONNECT (con1,localhost,root,,);
+CONNECT (con2,localhost,root,,);
+
+CONNECTION con1;
+SEND CALL p1();
+CONNECTION con2;
+SEND CALL p1();
+CONNECTION default;
+CALL p1();
+
+CONNECTION con1;
+REAP;
+CONNECTION con2;
+REAP;
+CONNECTION default;
+DISCONNECT con1;
+DISCONNECT con2;
+
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
#
# Bug #28125: ERROR 2013 when adding index.
#
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index bf6dae96847..fcd07a21821 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -239,6 +239,34 @@ show status like 'Handler_read%';
DROP TABLE t1;
+#
+# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty
+#
+
+CREATE TABLE t1 (
+ f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
+ f2 varchar(100) NOT NULL default ''
+);
+CREATE TABLE t2 (
+ f1 varchar(10) NOT NULL default '',
+ f2 char(3) NOT NULL default '',
+ PRIMARY KEY (`f1`),
+ KEY `k1` (`f2`, `f1`)
+);
+
+INSERT INTO t1 values(NULL, '');
+INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
+SELECT COUNT(*) FROM t1;
+
+SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+
+INSERT INTO t1 (f2)
+ SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
+
+SELECT COUNT(*) FROM t1;
+SELECT * FROM t1;
+DROP TABLE t1, t2;
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 428aba92342..f9d7235ff84 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -233,8 +233,6 @@ source include/show_binlog_events.inc;
do release_lock("lock1");
drop table t0,t2;
-# End of 4.1 tests
-
# Test for BUG#16559 (ROLLBACK should always have a zero error code in
# binlog). Has to be here and not earlier, as the SELECTs influence
# XIDs differently between normal and ps-protocol (and SHOW BINLOG
@@ -267,3 +265,123 @@ eval select
@a like "%#%error_code=0%ROLLBACK/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
drop table t1, t2;
+
+#
+# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
+# bug #28960 non-trans temp table changes with insert .. select
+# not binlogged after rollback
+#
+# testing appearence of insert into temp_table in binlog.
+# There are two branches of execution that require different setup.
+
+## send_eof() branch
+
+# prepare
+
+create temporary table tt (a int unique);
+create table ti (a int) engine=innodb;
+reset master;
+show master status;
+
+# action
+
+begin;
+insert into ti values (1);
+insert into ti values (2) ;
+insert into tt select * from ti;
+rollback;
+
+# check
+
+select count(*) from tt /* 2 */;
+show master status;
+--replace_column 2 # 5 #
+show binlog events from 98;
+select count(*) from ti /* zero */;
+insert into ti select * from tt;
+select * from ti /* that is what slave would miss - a bug */;
+
+
+## send_error() branch
+delete from ti;
+delete from tt where a=1;
+reset master;
+show master status;
+
+# action
+
+begin;
+insert into ti values (1);
+insert into ti values (2) /* to make the dup error in the following */;
+--error ER_DUP_ENTRY
+insert into tt select * from ti /* one affected and error */;
+rollback;
+
+# check
+
+show master status;
+--replace_column 2 # 5 #
+show binlog events from 98;
+select count(*) from ti /* zero */;
+insert into ti select * from tt;
+select * from tt /* that is what otherwise slave missed - the bug */;
+
+drop table ti;
+
+
+#
+# Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
+#
+# Testing asserts: if there is a side effect of modifying non-transactional
+# table thd->no_trans_update.stmt must be TRUE;
+# the assert is active with debug build
+#
+
+--disable_warnings
+drop function if exists bug27417;
+drop table if exists t1,t2;
+--enable_warnings
+# side effect table
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM;
+# target tables
+CREATE TABLE t2 (a int NOT NULL auto_increment, PRIMARY KEY (a));
+
+delimiter |;
+create function bug27417(n int)
+RETURNS int(11)
+begin
+ insert into t1 values (null);
+ return n;
+end|
+delimiter ;|
+
+reset master;
+
+# execute
+
+insert into t2 values (bug27417(1));
+insert into t2 select bug27417(2);
+reset master;
+
+--error ER_DUP_ENTRY
+insert into t2 values (bug27417(2));
+show master status; /* only (!) with fixes for #23333 will show there is the query */;
+select count(*) from t1 /* must be 3 */;
+
+reset master;
+select count(*) from t2;
+delete from t2 where a=bug27417(3);
+select count(*) from t2 /* nothing got deleted */;
+show master status; /* the query must be in regardless of #23333 */;
+select count(*) from t1 /* must be 5 */;
+
+--enable_info
+delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
+--disable_info
+select count(*) from t1 /* must be 7 */;
+
+drop function bug27417;
+drop table t1,t2;
+
+--echo end of tests
+
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index bd90dcfb930..451eef17108 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -216,4 +216,25 @@ flush logs;
DROP TABLE t1;
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+#
+# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
+#
+flush logs;
+create table t1(a int);
+insert into t1 values(connection_id());
+let $a= `select a from t1`;
+flush logs;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
+drop table t1;
+connect (con1, localhost, root, , test);
+connection con1;
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
+let $b= `select a from t1`;
+disconnect con1;
+connection default;
+let $c= `select $a=$b`;
+--echo $c
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index d42162541de..3c62577e781 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1555,5 +1555,27 @@ SELECT * FROM v1;
DROP VIEW v1;
--echo #
+--echo # Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
+--echo # the SQL_MODE variable after the dumping of triggers.
+--echo #
+
+CREATE TABLE t1 (c1 INT);
+CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
+
+CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+
+SET @TMP_SQL_MODE = @@SQL_MODE;
+SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
+INSERT INTO t2 VALUES (0), (1), (2);
+SET SQL_MODE = @TMP_SQL_MODE;
+SELECT * FROM t2;
+
+--exec $MYSQL_DUMP --routines test >$MYSQLTEST_VARDIR/tmp/bug29788.sql
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29788.sql
+SELECT * FROM t2;
+
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 5.0 tests
--echo #
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 962f53936a3..3091284d061 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -1029,6 +1029,130 @@ drop table t1;
set GLOBAL query_cache_size= default;
#
+# Bug#29856: Insufficient buffer space led to a server crash.
+#
+SET GLOBAL query_cache_size=64*1024*1024;
+CREATE TABLE t1 (id INT);
+DELIMITER |;
+CREATE PROCEDURE proc29856(IN theUPC TEXT)
+BEGIN
+ SET @stmtStr := '';
+ SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr;
+ PREPARE stmt FROM @stmtStr;
+ EXECUTE stmt;
+END |
+DELIMITER ;|
+CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
+25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
+51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
+77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
+102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
+121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
+140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
+159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,
+178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,
+197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
+216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
+235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
+254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,
+273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,
+292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,
+311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,
+330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,
+349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,
+368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,
+387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,
+406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,
+425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,
+444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,
+463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,
+482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,
+501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,
+520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,
+539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,
+558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,
+577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,
+596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,
+615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,
+634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,
+653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,
+672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,
+691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,
+710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,
+729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,
+748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,
+767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,
+786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,
+805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,
+824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,
+843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,
+862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,
+881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,
+900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,
+919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,
+938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,
+957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,
+976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,
+995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,
+1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,
+1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,
+1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,
+1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
+1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
+1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,
+1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,
+1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,
+1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,
+1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,
+1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,
+1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,
+1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,
+1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,
+1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,
+1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,
+1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,
+1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,
+1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,
+1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,
+1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,
+1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,
+1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,
+1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,
+1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,
+1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,
+1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,
+1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,
+1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,
+1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,
+1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,
+1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,
+1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,
+1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,
+1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,
+1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,
+1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,
+1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,
+1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,
+1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,
+1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,
+1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,
+1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,
+1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,
+1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,
+1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,
+1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,
+1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,
+1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,
+1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,
+1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,
+1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,
+1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,
+1806,1807,1808,1809,1810,1811');
+DROP PROCEDURE proc29856;
+DROP TABLE t1;
+SET GLOBAL query_cache_size= default;
+
+#
# Bug #28249 Query Cache returns wrong result with concurrent insert / certain lock
#
--echo Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock
diff --git a/mysql-test/t/rpl_insert_delayed.test b/mysql-test/t/rpl_insert_delayed.test
index 3f72f3a3625..09e0c5cc2e9 100644
--- a/mysql-test/t/rpl_insert_delayed.test
+++ b/mysql-test/t/rpl_insert_delayed.test
@@ -65,3 +65,33 @@ connection master;
drop table t1;
sync_slave_with_master;
connection master;
+
+#
+# Bug #29571: INSERT DELAYED IGNORE written to binary log on the master but
+# on the slave
+#
+CREATE TABLE t1(a int, UNIQUE(a));
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+INSERT DELAYED IGNORE INTO t1 VALUES(1);
+flush table t1; # to wait for INSERT DELAYED to be done
+
+#must show two INSERT DELAYED
+--replace_column 1 x 2 x 3 x 4 x 5 x
+show binlog events limit 11,100;
+select * from t1;
+
+sync_slave_with_master;
+echo On slave;
+#must show two INSERT DELAYED
+--replace_column 1 x 2 x 3 x 4 x 5 x
+show binlog events limit 12,100;
+select * from t1;
+
+
+# clean up
+connection master;
+drop table t1;
+sync_slave_with_master;
+connection master;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/rpl_session_var.test b/mysql-test/t/rpl_session_var.test
index a6f4b496a23..8231a0dbefd 100644
--- a/mysql-test/t/rpl_session_var.test
+++ b/mysql-test/t/rpl_session_var.test
@@ -40,3 +40,25 @@ drop table t1,t2;
save_master_pos;
connection slave;
sync_with_master;
+
+#
+# Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
+#
+
+connection master;
+CREATE TABLE t1 (
+ `id` int(11) NOT NULL auto_increment,
+ `data` varchar(100),
+ PRIMARY KEY (`id`)
+ ) ENGINE=MyISAM;
+
+INSERT INTO t1(data) VALUES(SESSION_USER());
+save_master_pos;
+connection slave;
+sync_with_master;
+SELECT * FROM t1;
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 28f85635c93..cae3c3e157c 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -559,6 +559,10 @@ show status like 'slow_queries';
# FROM I_S.
#
+#
+# Part 1: check that meta-data specifies not-binary character set.
+#
+
# Ensure that all needed objects are dropped.
--disable_warnings
@@ -767,6 +771,59 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
#
+# Part 2: check that table with non-latin1 characters are dumped/restored
+# correctly.
+#
+
+# Ensure that all needed objects are dropped.
+
+set names koi8r;
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+# Create objects.
+
+CREATE DATABASE mysqltest1;
+
+use mysqltest1;
+
+CREATE TABLE t1(ËÏÌÏÎËÁ1 INT);
+
+# Check:
+# - Dump mysqltest1;
+
+--echo
+--echo ---> Dumping mysqltest1 to show_check.mysqltest1.sql
+
+--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+
+# - Clean mysqltest1;
+
+--echo
+--echo
+
+DROP DATABASE mysqltest1;
+
+# - Restore mysqltest1;
+
+--echo
+--echo
+
+--echo ---> Restoring mysqltest1...
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+
+# - Check definition of the table.
+
+SHOW CREATE TABLE mysqltest1.t1;
+
+# Cleanup.
+
+DROP DATABASE mysqltest1;
+use test;
+
+#
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
#
flush status;
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
index ec5b7fbad7c..966c59a5789 100644
--- a/mysql-test/t/sp-prelocking.test
+++ b/mysql-test/t/sp-prelocking.test
@@ -333,4 +333,58 @@ insert into bug_27907_t1(a) values (1);
drop table bug_27907_t1;
+--echo
+--echo Bug#22427 create table if not exists + stored function results in
+--echo inconsistent behavior
+--echo
+--echo Add a test case, the bug itself was fixed by the patch for
+--echo Bug#20662
+--echo
+--disable_warnings
+drop table if exists t1;
+drop function if exists f_bug22427;
+--enable_warnings
+create table t1 (i int);
+insert into t1 values (1);
+create function f_bug22427() returns int return (select max(i) from t1);
+select f_bug22427();
+# Until this bug was fixed, the following emitted error
+# ERROR 1213: Deadlock found when trying to get lock
+create table if not exists t1 select f_bug22427() as i;
+--error ER_TABLE_EXISTS_ERROR
+create table t1 select f_bug22427() as i;
+drop table t1;
+drop function f_bug22427;
+
+--echo #
+--echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
+--echo #
+--disable_warnings
+DROP table IF EXISTS t1,t2;
+--enable_warnings
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c2 INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+DELIMITER //;
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+BEGIN
+UPDATE t2 SET c2= c2 + 1;
+END//
+DELIMITER ;//
+--echo # Take a table lock on t1.
+--echo # This should pre-lock t2 through the trigger.
+LOCK TABLE t1 WRITE;
+INSERT INTO t1 VALUES (3);
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+--error ER_TABLE_NOT_LOCKED
+INSERT INTO t2 values(4);
+UNLOCK TABLES;
+SELECT * FROM t1;
+SELECT * FROM t2;
+DROP TRIGGER t1_ai;
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests
+
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index ef66f1c98f0..46a1b1dc740 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -23,6 +23,11 @@ use test;
#
--disable_warnings
drop table if exists t1,t2,t3,t4;
+drop view if exists v1;
+drop procedure if exists p1;
+drop procedure if exists p2;
+drop function if exists f1;
+drop function if exists f2;
--enable_warnings
create table t1 (
id char(16) not null default '',
@@ -7098,7 +7103,7 @@ CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
set @a=0;
delimiter |;
-CREATE function bug27354() RETURNS int deterministic
+CREATE function bug27354() RETURNS int not deterministic
begin
insert into t1 values (null);
set @a=@a+1;
@@ -7135,6 +7140,77 @@ DROP FUNCTION metered;
DROP TABLE t1;
#
+# Bug#29834: Accessing a view column by name in SP/PS causes a memory leak.
+#
+# This is leak test. Run with large number assigned to $execute_cnt,
+# $p1_cnt, $p2_cnt, @p1_p2_cnt, $f1_normal_cnt or $f1_prep_cnt variables.
+#
+
+let $execute_cnt= 2;
+let $p1_cnt= 2;
+let $p2_cnt= 2;
+SET @p1_p2_cnt= 2;
+let $f1_normal_cnt= 2;
+let $f1_prep_cnt= 2;
+
+CREATE TABLE t1 (c1 INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+PREPARE s1 FROM 'SELECT c1 FROM v1';
+while ($execute_cnt)
+{
+ EXECUTE s1;
+ dec $execute_cnt;
+}
+
+DELIMITER |;
+
+CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+ WHILE loops > 0 DO
+ SELECT c1 FROM v1;
+ SET loops = loops - 1;
+ END WHILE;
+END|
+
+CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED)
+BEGIN
+ WHILE loops > 0 DO
+ SELECT c1 FROM v1;
+ CALL p1(@p1_p2_cnt);
+ SET loops = loops - 1;
+ END WHILE;
+END|
+
+CREATE FUNCTION f1(loops INT UNSIGNED)
+ RETURNS INT
+BEGIN
+ DECLARE tmp INT;
+ WHILE loops > 0 DO
+ SELECT c1 INTO tmp FROM v1;
+ SET loops = loops - 1;
+ END WHILE;
+ RETURN loops;
+END|
+
+DELIMITER ;|
+
+eval CALL p1($p1_cnt);
+eval CALL p2($p2_cnt);
+
+eval SELECT f1($f1_normal_cnt);
+
+eval PREPARE s1 FROM 'SELECT f1($f1_prep_cnt)';
+EXECUTE s1;
+EXECUTE s1;
+
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP FUNCTION f1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+#
# Bug#28551 "The warning 'No database selected' is reported when calling
# stored procedures"
#
@@ -7172,4 +7248,55 @@ use test;
drop procedure sp_bug29050;
drop table t1;
+#
+# Bug #29338: no optimization for stored functions with a trivial body
+# always returning constant.
+#
+
+CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2;
+CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3;
+
+CREATE TABLE t1 (c1 INT, INDEX(c1));
+
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+
+CREATE VIEW v1 AS SELECT c1 FROM t1;
+
+EXPLAIN SELECT * FROM t1 WHERE c1=1;
+EXPLAIN SELECT * FROM t1 WHERE c1=f1();
+
+EXPLAIN SELECT * FROM v1 WHERE c1=1;
+EXPLAIN SELECT * FROM v1 WHERE c1=f1();
+
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
+EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand());
+
+
+DROP VIEW v1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP TABLE t1;
+
+#
+# Bug #30120 SP with local variables with non-ASCII names crashes server.
+#
+
+SET NAMES latin1;
+
+DELIMITER |;
+
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE áâä INT;
+ SELECT áâä;
+END|
+
+DELIMITER ;|
+
+CALL p1();
+
+SET NAMES default;
+DROP PROCEDURE p1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index a6390036322..2f62ad38621 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2194,4 +2194,27 @@ drop table t1, t2, t1_op_log;
#
# TODO: test LOAD DATA INFILE
+#
+--echo
+--echo Bug#27248 Triggers: error if insert affects temporary table
+--echo
+--echo The bug was fixed by the fix for Bug#26141
+--echo
+--disable_warnings
+drop table if exists t1;
+drop temporary table if exists t2;
+--enable_warnings
+create table t1 (s1 int);
+create temporary table t2 (s1 int);
+create trigger t1_bi before insert on t1 for each row insert into t2 values (0);
+create trigger t1_bd before delete on t1 for each row delete from t2;
+insert into t1 values (0);
+insert into t1 values (0);
+select * from t1;
+select * from t2;
+delete from t1;
+select * from t1;
+select * from t2;
+drop table t1;
+drop temporary table t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index fbba38f926d..3dedb0018b1 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -200,3 +200,27 @@ CREATE TABLE t2 SELECT * FROM t1;
SELECT c1 + 0 FROM t2;
DROP TABLE t1,t2;
+
+#
+# Bug#29661: Lookup by 0 for a primary index over a enum type
+#
+
+CREATE TABLE t1(a enum('a','b','c','d'));
+INSERT INTO t1 VALUES (4),(1),(0),(3);
+
+SELECT a FROM t1;
+
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+SELECT a FROM t1 WHERE a=0;
+
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+
+EXPLAIN SELECT a FROM t1 WHERE a=0;
+SELECT a FROM t1 WHERE a=0;
+
+DROP TABLE t1;
+
+
+
+
+
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index c7f722a18a5..fc3fdc932ba 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3402,5 +3402,18 @@ SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+#
+# Bug#30020: Insufficient check led to a wrong info provided by the
+# information schema table.
+#
+create table t1 (i int);
+insert into t1 values (1), (2), (1), (3), (2), (4);
+create view v1 as select distinct i from t1;
+select * from v1;
+select table_name, is_updatable from information_schema.views
+ where table_name = 'v1';
+drop view v1;
+drop table t1;
+
--echo End of 5.0 tests.
diff --git a/ndb/src/common/util/File.cpp b/ndb/src/common/util/File.cpp
index a75fa5ae463..fe0fdfd1c91 100644
--- a/ndb/src/common/util/File.cpp
+++ b/ndb/src/common/util/File.cpp
@@ -50,7 +50,7 @@ File_class::size(FILE* f)
MY_STAT s;
// Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
- if(my_fstat(::fileno(f), &s, MYF(0)))
+ if(my_fstat(fileno(f), &s, MYF(0)))
return 0;
return s.st_size;
@@ -196,7 +196,7 @@ File_class::flush() const
{
#if defined NDB_OSE || defined NDB_SOFTOSE
::fflush(m_file);
- return ::fsync(::fileno(m_file));
+ return ::fsync(fileno(m_file));
#else
return ::fflush(m_file);;
#endif
diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am
index 99540160341..e1287532a07 100644
--- a/ndb/src/mgmclient/Makefile.am
+++ b/ndb/src/mgmclient/Makefile.am
@@ -36,6 +36,7 @@ INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi \
LDADD_LOC = $(noinst_LTLIBRARIES) \
../common/portlib/libportlib.la \
@readline_link@ \
+ $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am
index 88622c08e53..3d1845957e6 100644
--- a/ndb/src/mgmsrv/Makefile.am
+++ b/ndb/src/mgmsrv/Makefile.am
@@ -38,7 +38,7 @@ INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \
-I$(top_srcdir)/ndb/src/common/mgmcommon \
-I$(top_srcdir)/ndb/src/mgmclient
-LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.o \
+LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.lo \
$(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
diff --git a/ndb/test/ndbapi/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp
index 4973e6e2487..73ee324a888 100644
--- a/ndb/test/ndbapi/benchronja.cpp
+++ b/ndb/test/ndbapi/benchronja.cpp
@@ -41,7 +41,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 8000
#define START_TIMER NdbTimer timer; timer.doStart();
#define STOP_TIMER timer.doStop();
@@ -56,18 +63,18 @@ struct ThreadNdb
Ndb* NdbRef;
};
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static unsigned int tNoOfThreads;
static unsigned int tNoOfOpsPerExecute;
static unsigned int tNoOfRecords;
static unsigned int tNoOfOperations;
-static int ThreadReady[MAXTHREADS];
-static int ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static int ThreadStart[NDB_MAXTHREADS];
NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){
ndb_init();
- ThreadNdb tabThread[MAXTHREADS];
+ ThreadNdb tabThread[NDB_MAXTHREADS];
int i = 0 ;
int cont = 0 ;
Ndb* pMyNdb = NULL ; //( "TEST_DB" );
@@ -84,7 +91,7 @@ NDB_COMMAND(benchronja, "benchronja", "benchronja", "benchronja", 65535){
{
if (strcmp(argv[i], "-t") == 0){
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) goto error_input;
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) goto error_input;
}else if (strcmp(argv[i], "-o") == 0){
tNoOfOperations = atoi(argv[i+1]);
if (tNoOfOperations < 1) goto error_input;
diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp
index 20a157fc2f3..1f52315482f 100644
--- a/ndb/test/ndbapi/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch.cpp
@@ -35,7 +35,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 128
+#define NDB_MAXTHREADS 128
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXPAR 1024
#define MAXATTRSIZE 1000
#define PKSIZE 2
@@ -76,10 +83,10 @@ struct ThreadNdb
int ThreadNo;
};
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static int tNodeId;
-static int ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[MAXTABLES][MAXSTRLEN+1];
static char attrName[MAXATTR][MAXSTRLEN+1];
@@ -160,7 +167,7 @@ NDB_COMMAND(flexAsynch, "flexAsynch", "flexAsynch", "flexAsynch", 65535)
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- pThreadData = new ThreadNdb[MAXTHREADS];
+ pThreadData = new ThreadNdb[NDB_MAXTHREADS];
ndbout << endl << "FLEXASYNCH - Starting normal mode" << endl;
ndbout << "Perform benchmark of insert, update and delete transactions";
@@ -844,7 +851,7 @@ readArguments(int argc, const char** argv){
while (argc > 1){
if (strcmp(argv[i], "-t") == 0){
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){
ndbout_c("Invalid no of threads");
return -1;
}
diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp
index 9abac905f5a..3847bc38b35 100644
--- a/ndb/test/ndbapi/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer.cpp
@@ -69,7 +69,14 @@ ErrorData * flexHammerErrorData;
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 100
// Max number of retries if something fails
#define MaxNoOfAttemptsC 10
@@ -122,8 +129,8 @@ static int tAttributeSize;
static int tNoOfOperations;
static int tNoOfRecords;
static int tNoOfLoops;
-static ReadyType ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static ReadyType ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[MAXTABLES][MAXSTRLEN];
static char attrName[MAXATTR][MAXSTRLEN];
static int theSimpleFlag = 0;
@@ -643,7 +650,7 @@ readArguments (int argc, const char** argv)
while (argc > 1) {
if (strcmp(argv[i], "-t") == 0) {
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS))
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS))
return(1);
}
else if (strcmp(argv[i], "-o") == 0) {
diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp
index cbea90f44f4..4e3def7fb91 100644
--- a/ndb/test/ndbapi/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan.cpp
@@ -68,7 +68,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 64
enum StartType {
@@ -860,7 +867,7 @@ static int readArguments(int argc, const char** argv)
if (strcmp(argv[i], "-t") == 0) {
if (argv[i + 1] != NULL) {
tNoOfThreads = atoi(argv[i + 1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)) {
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)) {
retValue = -1;
} // if
} // if
diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp
index 71d5b6c096e..4373102f77e 100644
--- a/ndb/test/ndbapi/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT.cpp
@@ -35,7 +35,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 128
+#define NDB_MAXTHREADS 128
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXPAR 1024
#define MAXATTRSIZE 1000
#define PKSIZE 1
@@ -101,10 +108,10 @@ static void input_error();
ErrorData * flexTTErrorData;
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static int tNodeId;
-static int ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[1][MAXSTRLEN+1];
static char attrName[5][MAXSTRLEN+1];
@@ -184,7 +191,7 @@ NDB_COMMAND(flexTT, "flexTT", "flexTT", "flexTT", 65535)
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- pThreadData = new ThreadNdb[MAXTHREADS];
+ pThreadData = new ThreadNdb[NDB_MAXTHREADS];
ndbout << endl << "FLEXTT - Starting normal mode" << endl;
ndbout << "Perform TimesTen benchmark" << endl;
@@ -798,7 +805,7 @@ readArguments(int argc, const char** argv){
while (argc > 1){
if (strcmp(argv[i], "-t") == 0){
tNoOfThreads = atoi(argv[i+1]);
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS)){
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS)){
ndbout_c("Invalid no of threads");
return -1;
}
diff --git a/ndb/test/ndbapi/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp
index cc44ab8b237..b6301e59df2 100644
--- a/ndb/test/ndbapi/flexTimedAsynch.cpp
+++ b/ndb/test/ndbapi/flexTimedAsynch.cpp
@@ -57,7 +57,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 1000
#define PKSIZE 1
@@ -95,10 +102,10 @@ static int failed = 0 ; // lame global variable that keeps track of failed trans
// incremented in executeCallback() and reset in main()
/************************************************************* < epaulsa */
-static NdbThread* threadLife[MAXTHREADS];
+static NdbThread* threadLife[NDB_MAXTHREADS];
static int tNodeId;
-static int ThreadReady[MAXTHREADS];
-static StartType ThreadStart[MAXTHREADS];
+static int ThreadReady[NDB_MAXTHREADS];
+static StartType ThreadStart[NDB_MAXTHREADS];
static char tableName[MAXTABLES][MAXSTRLEN+1];
static char attrName[MAXATTR][MAXSTRLEN+1];
static int *getAttrValueTable;
@@ -174,7 +181,7 @@ void deleteAttributeSpace(){
NDB_COMMAND(flexTimedAsynch, "flexTimedAsynch", "flexTimedAsynch [-tpoilcas]", "flexTimedAsynch", 65535)
{
ndb_init();
- ThreadNdb tabThread[MAXTHREADS];
+ ThreadNdb tabThread[NDB_MAXTHREADS];
int tLoops=0;
int returnValue;
//NdbOut flexTimedAsynchNdbOut;
@@ -615,8 +622,8 @@ void readArguments(int argc, const char** argv)
if (strcmp(argv[i], "-t") == 0)
{
tNoOfThreads = atoi(argv[i+1]);
- // if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS))
- if ((tNoOfThreads < 1) || (tNoOfThreads > MAXTHREADS))
+ // if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS))
+ if ((tNoOfThreads < 1) || (tNoOfThreads > NDB_MAXTHREADS))
exit(-1);
}
else if (strcmp(argv[i], "-i") == 0)
@@ -628,7 +635,7 @@ void readArguments(int argc, const char** argv)
else if (strcmp(argv[i], "-p") == 0)
{
tNoOfTransInBatch = atoi(argv[i+1]);
- //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > MAXTHREADS))
+ //if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > NDB_MAXTHREADS))
if ((tNoOfTransInBatch < 1) || (tNoOfTransInBatch > 10000))
exit(-1);
}
diff --git a/ndb/test/ndbapi/initronja.cpp b/ndb/test/ndbapi/initronja.cpp
index 63bbc374c62..f48b1c86da3 100644
--- a/ndb/test/ndbapi/initronja.cpp
+++ b/ndb/test/ndbapi/initronja.cpp
@@ -29,7 +29,14 @@
#define MAXSTRLEN 16
#define MAXATTR 64
#define MAXTABLES 64
-#define MAXTHREADS 256
+#define NDB_MAXTHREADS 256
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
#define MAXATTRSIZE 8000
static unsigned int tNoOfRecords;
diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp
index 1f610cade4a..21151ab5c7f 100644
--- a/ndb/test/ndbapi/testOperations.cpp
+++ b/ndb/test/ndbapi/testOperations.cpp
@@ -98,11 +98,6 @@ OperationTestCase matrix[] = {
break; }
#define C3(b) if (!(b)) { \
- g_err << "ERR: "<< step->getName() \
- << " failed on line " << __LINE__ << endl; \
- abort(); return NDBT_FAILED; }
-
-#define C3(b) if (!(b)) { \
g_err << "ERR: failed on line " << __LINE__ << endl; \
return NDBT_FAILED; }
diff --git a/ndb/test/ndbapi/testScanFilter.cpp b/ndb/test/ndbapi/testScanFilter.cpp
index 5098d83745b..81aa6b82fa0 100644
--- a/ndb/test/ndbapi/testScanFilter.cpp
+++ b/ndb/test/ndbapi/testScanFilter.cpp
@@ -49,7 +49,15 @@ const char COL_LEN = 7;
* there are six columns, 'i', 'j', 'k', 'l', 'm', 'n', and each on is equal to 1 or 1,
* Since each tuple should be unique in this case, then TUPLE_NUM = 2 power 6 = 64
*/
-const int TUPLE_NUM = (int)pow(2, COL_LEN-1);
+#ifdef _AIX
+/*
+ IBM xlC_r breaks on the initialization with pow():
+ "The expression must be an integral constant expression."
+*/
+const int TUPLE_NUM = 64;
+#else
+const int TUPLE_NUM = (int)pow(2, COL_LEN-1);
+#endif
/*
* the recursive level of random scan filter, can
@@ -479,7 +487,7 @@ int get_column_id(char ch)
*/
bool check_col_equal_one(int tuple_no, int col_id)
{
- int i = (int)pow(2, 6 - col_id);
+ int i = (int)pow((double)2, (double)(6 - col_id));
int j = tuple_no / i;
if(j % 2)
return true;
diff --git a/ndb/test/odbc/SQL99_test/SQL99_test.cpp b/ndb/test/odbc/SQL99_test/SQL99_test.cpp
index 039a77f4d53..fb77220773d 100644
--- a/ndb/test/odbc/SQL99_test/SQL99_test.cpp
+++ b/ndb/test/odbc/SQL99_test/SQL99_test.cpp
@@ -27,7 +27,14 @@ using namespace std; //
#define MAXROW 64
#define DEFROW 8
-#define MAXTHREADS 24
+/*
+ NDB_MAXTHREADS used to be just MAXTHREADS, which collides with a
+ #define from <sys/thread.h> on AIX (IBM compiler). We explicitly
+ #undef it here lest someone use it by habit and get really funny
+ results. K&R says we may #undef non-existent symbols, so let's go.
+*/
+#undef MAXTHREADS
+#define NDB_MAXTHREADS 24
#define DEFTHREADS 2
#define MAXTABLES 16
@@ -83,7 +90,7 @@ int main(int argc, char* argv[]){
char* szTableNames = (char*)malloc(sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ;
memset(szTableNames, 0, sizeof(char)*nNoOfTables*MAX_TABLE_NAME) ;
- UintPtr pThreadHandles[MAXTHREADS] = { NULL } ;
+ UintPtr pThreadHandles[NDB_MAXTHREADS] = { NULL } ;
AssignTableNames(szTableNames, nNoOfTables) ;
@@ -313,7 +320,7 @@ void ParseArguments(int argc, const char** argv){
if (strcmp(argv[i], "-t") == 0)
{
nNoOfThreads = atoi(argv[i+1]);
- if ((nNoOfThreads < 1) || (nNoOfThreads > MAXTHREADS))
+ if ((nNoOfThreads < 1) || (nNoOfThreads > NDB_MAXTHREADS))
nNoOfThreads = DEFTHREADS ;
}
else if (strcmp(argv[i], "-c") == 0)
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index 9584721682f..a87bb03526d 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -257,7 +257,7 @@ if [ $BASE_SYSTEM = "netware" ] ; then
rm -f $BASE/lib/*.la
fi
-copyfileto $BASE/include config.h include/*
+copyfileto $BASE/include include/*
rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
if [ $BASE_SYSTEM != "netware" ] ; then
@@ -318,7 +318,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then
copyfileto $BASE/bin scripts/*
$BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \
./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \
- @HOSTNAME@ \@pkgdatadir\@ ./support-files \
+ @HOSTNAME@ \@pkgdatadir\@ ./share \
< scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
$BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \
\@sbindir\@ ./bin \@libexecdir\@ ./bin \
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 934d245db15..a66129af1d3 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -18,26 +18,68 @@
#
# All unrecognized arguments to this script are passed to mysqld.
-in_rpm=0
-windows=0
+basedir=""
+ldata=""
+srcdir=""
+
+args=""
defaults=""
+mysqld_opt=""
user=""
-case "$1" in
- --no-defaults|--defaults-file=*|--defaults-extra-file=*)
- defaults="$1"; shift
- ;;
-esac
+force=0
+in_rpm=0
+ip_only=0
+windows=0
+
+usage()
+{
+ cat <<EOF
+Usage: $0 [OPTIONS]
+ --basedir=path The path to the MySQL installation directory.
+ --datadir=path The path to the MySQL data directory.
+ --force Causes mysql_install_db to run even if DNS does not
+ work. In that case, grant table entries that normally
+ use hostnames will use IP addresses.
+ --ldata=path The path to the MySQL data directory.
+ --rpm For internal use. This option is used by RPM files
+ during the MySQL installation process.
+ --skip-name-resolve Use IP addresses rather than hostnames when creating
+ grant table entries. This option can be useful if
+ your DNS does not work.
+ --srcdir=path For internal use. The directory under which
+ mysql_install_db looks for support files such as the
+ error message file and the file for popoulating the
+ help tables.
+ --user=user_name The login username to use for running mysqld. Files
+ and directories created by mysqld will be owned by this
+ user. You must be root to use this option. By default
+ mysqld runs using your current login name and files and
+ directories that it creates will be owned by you.
+ --windows For internal use. This option is used for creating
+ Windows distributions.
+
+All other options are passed to the mysqld program
+
+EOF
+ exit 1
+}
s_echo()
{
if test "$in_rpm" -eq 0 -a "$windows" -eq 0
then
- echo $1
+ echo "$1"
fi
}
-parse_arguments() {
+parse_arg()
+{
+ echo "$1" | sed -e 's/^[^=]*=//'
+}
+
+parse_arguments()
+{
# We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on
# the command line) into the args variable.
@@ -48,20 +90,24 @@ parse_arguments() {
shift
fi
- for arg do
+ for arg
+ do
case "$arg" in
--force) force=1 ;;
- --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --srcdir=*) srcdir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
- --ldata=*|--datadir=*) ldata=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ --basedir=*) basedir=`parse_arg "$arg"` ;;
+ --srcdir=*) srcdir=`parse_arg "$arg"` ;;
+ --ldata=*|--datadir=*) ldata=`parse_arg "$arg"` ;;
--user=*)
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
- user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+ user=`parse_arg "$arg"` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;;
+ --help) usage ;;
+ --no-defaults|--defaults-file=*|--defaults-extra-file=*)
+ defaults="$arg" ;;
--windows)
# This is actually a "cross bootstrap" argument used when
@@ -89,137 +135,152 @@ parse_arguments() {
done
}
-# Get first arguments from the my.cfg file, groups [mysqld] and
-# [mysql_install_db], and then merge with the command line arguments
-if test -x ./bin/my_print_defaults
-then
- print_defaults="./bin/my_print_defaults"
-elif test -x ./extra/my_print_defaults
-then
- print_defaults="./extra/my_print_defaults"
-elif test -x @bindir@/my_print_defaults
-then
- print_defaults="@bindir@/my_print_defaults"
-elif test -x @bindir@/mysql_print_defaults
-then
- print_defaults="@bindir@/mysql_print_defaults"
-else
- print_defaults="my_print_defaults"
-fi
+# Try to find a specific file within --basedir which can either be a binary
+# release or installed source directory and return the path.
+find_in_basedir()
+{
+ case "$1" in
+ --dir)
+ return_dir=1; shift
+ ;;
+ esac
-args=
-ldata=
-execdir=
-bindir=
-basedir=
-srcdir=
-force=0
+ file=$1; shift
-parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
+ for dir in "$@"
+ do
+ if test -f "$basedir/$dir/$file"
+ then
+ if test -n "$return_dir"
+ then
+ echo "$basedir/$dir"
+ else
+ echo "$basedir/$dir/$file"
+ fi
+ break
+ fi
+ done
+}
+
+missing_in_basedir()
+{
+ echo "FATAL ERROR: Could not find $* inside --basedir"
+ echo
+ echo "When using --basedir you must point either into a MySQL binary"
+ echo "distribution directory or a compiled tree previously populated"
+ echo "by 'make install'"
+}
+
+# Ok, let's go. We first need to parse arguments which are required by
+# my_print_defaults so that we can execute it first, then later re-parse
+# the command line to add any extra bits that we need.
parse_arguments PICK-ARGS-FROM-ARGV "$@"
-test -z "$ldata" && ldata=@localstatedir@
-if test -z "$basedir"
+# We can now find my_print_defaults, either in the supplied --basedir
+# location or in the installed area.
+if test -n "$basedir"
then
- basedir=@prefix@
- bindir=@bindir@
- execdir=@libexecdir@
- pkgdatadir=@pkgdatadir@
-else
- bindir="$basedir/bin"
- if test -x "$basedir/libexec/mysqld"
+ print_defaults=`find_in_basedir my_print_defaults bin extra`
+ if ! test -x "$print_defaults"
then
- execdir="$basedir/libexec"
- elif test -x "$basedir/sbin/mysqld"
+ missing_in_basedir my_print_defaults
+ exit 1
+ fi
+else
+ print_defaults="@bindir@/my_print_defaults"
+ if ! test -x "$print_defaults"
then
- execdir="$basedir/sbin"
- else
- execdir="$basedir/bin"
+ echo "FATAL ERROR: Could not find $print_defaults"
+ echo
+ echo "If you are using a binary release, you must run this script from"
+ echo "within the directory the archive extracted into. If you compiled"
+ echo "MySQL yourself you must run 'make install' first."
+ exit 1
fi
fi
-# Find SQL scripts needed for bootstrap
-fill_help_tables="fill_help_tables.sql"
-create_system_tables="mysql_system_tables.sql"
-fill_system_tables="mysql_system_tables_data.sql"
-if test -n "$srcdir"
+# Now we can get arguments from the groups [mysqld] and [mysql_install_db]
+# in the my.cfg file, then re-run to merge with command line arguments.
+parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
+parse_arguments PICK-ARGS-FROM-ARGV "$@"
+
+# Path to MySQL installation directory
+if test -z "$basedir"
then
- fill_help_tables=$srcdir/scripts/$fill_help_tables
- create_system_tables=$srcdir/scripts/$create_system_tables
- fill_system_tables=$srcdir/scripts/$fill_system_tables
+ basedir="@prefix@"
+ bindir="@bindir@"
+ mysqld="@libexecdir@/mysqld"
+ pkgdatadir="@pkgdatadir@"
else
- for i in $basedir/support-files $basedir/share $basedir/share/mysql \
- $basedir/scripts `pwd` `pwd`/scripts @pkgdatadir@
- do
- if test -f $i/$fill_help_tables
+ bindir="$basedir/bin"
+ # We set up bootstrap-specific paths later, so skip this for --windows
+ if test "$windows" -eq 0
+ then
+ pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
+ if test -z "$pkgdatadir"
then
- pkgdatadir=$i
- break
+ missing_in_basedir fill_help_tables.sql
+ exit 1
fi
- done
-
- fill_help_tables=$pkgdatadir/$fill_help_tables
- create_system_tables=$pkgdatadir/$create_system_tables
- fill_system_tables=$pkgdatadir/$fill_system_tables
+ mysqld=`find_in_basedir mysqld libexec sbin bin`
+ if ! test -x "$mysqld"
+ then
+ missing_in_basedir mysqld
+ exit 1
+ fi
+ fi
fi
-if test ! -f $create_system_tables
+# Path to data directory
+if test -z "$ldata"
then
- echo "FATAL ERROR: Could not find SQL file '$create_system_tables' in"
- echo "@pkgdatadir@ or inside $basedir"
- exit 1;
+ ldata="@localstatedir@"
fi
-if test ! -f $fill_help_tables
+# Set up paths to SQL scripts required for bootstrap and ensure they exist.
+if test -n "$srcdir"
then
- echo "FATAL ERROR: Could not find help file '$fill_help_tables' in"
- echo "@pkgdatadir@ or inside $basedir"
- exit 1;
+ pkgdatadir="$srcdir/scripts"
fi
-if test ! -f $fill_system_tables
-then
- echo "FATAL ERROR: Could not find help file '$fill_system_tables' in"
- echo "@pkgdatadir@ or inside $basedir"
- exit 1;
-fi
+fill_help_tables="$pkgdatadir/fill_help_tables.sql"
+create_system_tables="$pkgdatadir/mysql_system_tables.sql"
+fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
-# Find executables and paths
-mysqld=$execdir/mysqld
-mysqld_opt=""
-scriptdir=$bindir
+for f in $fill_help_tables $create_system_tables $fill_system_tables
+do
+ if test ! -f "$f"
+ then
+ echo "FATAL ERROR: Could not find SQL file '$f'"
+ exit 1
+ fi
+done
-if test "$windows" = 1
+# Set up Windows-specific paths
+if test "$windows" -eq 1
then
mysqld="./sql/mysqld"
- if test -n "$srcdir" -a -f $srcdir/sql/share/english/errmsg.sys
+ if test -n "$srcdir" -a -f "$srcdir/sql/share/english/errmsg.sys"
then
- langdir=$srcdir/sql/share/english
+ mysqld_opt="--language=$srcdir/sql/share/english"
else
- langdir=./sql/share/english
+ mysqld_opt="--language=./sql/share/english"
fi
- mysqld_opt="--language=$langdir"
- scriptdir="./scripts"
fi
-if test ! -x $mysqld
+# Make sure mysqld is available in default location (--basedir option is
+# already tested above).
+if test ! -x "$mysqld"
then
- if test "$in_rpm" = 1
- then
- echo "FATAL ERROR $mysqld not found!"
- exit 1
- else
- echo "FATAL ERROR Didn't find $mysqld"
- echo "You should do a 'make install' before executing this script"
- exit 1
- fi
+ echo "FATAL ERROR: $mysqld not found!"
+ exit 1
fi
# Try to determine the hostname
hostname=`@HOSTNAME@`
# Check if hostname is valid
-if test "$windows" = 0 -a "$in_rpm" = 0 -a $force = 0
+if test "$windows" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then
resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ]
@@ -244,39 +305,35 @@ then
fi
fi
-if test "$ip_only" = "1"
+if test "$ip_only" -eq 1
then
- ip=`echo "$resolved" | awk '/ /{print $6}'`
- hostname=$ip
+ hostname=`echo "$resolved" | awk '/ /{print $6}'`
fi
# Create database directories mysql & test
-if test ! -d $ldata; then
- mkdir $ldata;
- chmod 700 $ldata ;
-fi
-if test ! -d $ldata/mysql; then
- mkdir $ldata/mysql;
- chmod 700 $ldata/mysql ;
-fi
-if test ! -d $ldata/test; then
- mkdir $ldata/test;
- chmod 700 $ldata/test ;
-fi
-if test -w / -a ! -z "$user"; then
- chown $user $ldata $ldata/mysql $ldata/test;
-fi
+for dir in $ldata $ldata/mysql $ldata/test
+do
+ if test ! -d $dir
+ then
+ mkdir -p $dir
+ chmod 700 $dir
+ fi
+ if test -w / -a ! -z "$user"
+ then
+ chown $user $dir
+ fi
+done
-if test -n "$user"; then
+if test -n "$user"
+then
args="$args --user=$user"
fi
# Peform the install of system tables
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
---basedir=$basedir --datadir=$ldata --skip-innodb \
---skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M \
---net_buffer_length=16K"
+ --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \
+ --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K"
# Pipe mysql_system_tables.sql to "mysqld --bootstrap"
s_echo "Installing MySQL system tables..."
@@ -284,23 +341,20 @@ if `(echo "use mysql;"; cat $create_system_tables $fill_system_tables) | $mysqld
then
s_echo "OK"
- if test -n "$fill_help_tables"
+ s_echo "Filling help tables..."
+ # Pipe fill_help_tables.sql to "mysqld --bootstrap"
+ if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line`
then
- s_echo "Filling help tables..."
- # Pipe fill_help_tables.sql to "mysqld --bootstrap"
- if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line`
- then
- # Fill suceeded
- s_echo "OK"
- else
- echo ""
- echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
- echo "The \"HELP\" command might not work properly"
- echo ""
- fi
+ # Fill suceeded
+ s_echo "OK"
+ else
+ echo
+ echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!"
+ echo "The \"HELP\" command might not work properly"
+ echo
fi
- s_echo ""
+ s_echo
s_echo "To start mysqld at boot time you have to copy"
s_echo "support-files/mysql.server to the right place for your system"
s_echo
@@ -319,7 +373,7 @@ then
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo "See the manual for more instructions."
- if test "$in_rpm" = "0"
+ if test "$in_rpm" -eq 0
then
echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &"
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index 9699cd28047..1f5509f9955 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -19,13 +19,14 @@
## 1.3 Applied patch provided by Martin Mokrejs <mmokrejs@natur.cuni.cz>
## (General code cleanup, use the GRANT statement instead of updating
## the privilege tables directly, added option to revoke privileges)
+## 1.4 Remove option 6 which attempted to erroneously grant global privileges
#### TODO
#
# empty ... suggestions ... mail them to me ...
-$version="1.3";
+$version="1.4";
use DBI;
use Getopt::Long;
@@ -103,13 +104,9 @@ sub q1 { # first question ...
print " existing database and host combination (user can do\n";
print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,\n";
print " LOCK TABLES,CREATE TEMPORARY TABLES)\n";
- print " 6. Create/append database administrative privileges for an\n";
- print " existing database and host combination (user can do\n";
- print " SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,\n";
- print " CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)\n";
- print " 7. Create/append full privileges for an existing database\n";
+ print " 6. Create/append full privileges for an existing database\n";
print " and host combination (user has FULL privilege)\n";
- print " 8. Remove all privileges for for an existing database and\n";
+ print " 7. Remove all privileges for for an existing database and\n";
print " host combination.\n";
print " (user will have all permission fields set to N)\n";
print " 0. exit this program\n";
@@ -117,10 +114,10 @@ sub q1 { # first question ...
while (<STDIN>) {
$answer = $_;
chomp($answer);
- if ($answer =~ /^[12345678]$/) {
+ if ($answer =~ /^[1234567]$/) {
if ($answer == 1) {
setpwd();
- } elsif ($answer =~ /^[2345678]$/) {
+ } elsif ($answer =~ /^[234567]$/) {
addall($answer);
} else {
print "Sorry, something went wrong. With such option number you should not get here.\n\n";
@@ -233,7 +230,7 @@ sub addall {
}
}
- if ( ( !$todo ) or not ( $todo =~ m/^[2-8]$/ ) ) {
+ if ( ( !$todo ) or not ( $todo =~ m/^[2-7]$/ ) ) {
print STDERR "Sorry, select option $todo isn't known inside the program .. See ya\n";
quit();
}
@@ -256,12 +253,9 @@ sub addall {
# user privileges: SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES
$sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
} elsif ($todo == 6) {
- # admin privileges: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS
- $sth = $dbh->do("GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS ON $db.* TO $user@\"$host\" IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
- } elsif ($todo == 7) {
# all privileges
$sth = $dbh->do("GRANT ALL ON $db.* TO \'$user\'\@\'$host\' IDENTIFIED BY \'$pass\'") || die $dbh->errstr;
- } elsif ($todo == 8) {
+ } elsif ($todo == 7) {
# all privileges set to N
$sth = $dbh->do("REVOKE ALL ON *.* FROM \'$user\'\@\'$host\'") || die $dbh->errstr;
}
diff --git a/sql-common/client.c b/sql-common/client.c
index a5dbeb66658..cb1d224ef2e 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1226,12 +1226,12 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
/* fields count may be wrong */
DBUG_ASSERT((uint) (field - result) < fields);
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
- field->catalog = strdup_root(alloc,(char*) row->data[0]);
- field->db = strdup_root(alloc,(char*) row->data[1]);
- field->table = strdup_root(alloc,(char*) row->data[2]);
- field->org_table= strdup_root(alloc,(char*) row->data[3]);
- field->name = strdup_root(alloc,(char*) row->data[4]);
- field->org_name = strdup_root(alloc,(char*) row->data[5]);
+ field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]);
+ field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]);
+ field->table= strmake_root(alloc,(char*) row->data[2], lengths[2]);
+ field->org_table= strmake_root(alloc,(char*) row->data[3], lengths[3]);
+ field->name= strmake_root(alloc,(char*) row->data[4], lengths[4]);
+ field->org_name= strmake_root(alloc,(char*) row->data[5], lengths[5]);
field->catalog_length= lengths[0];
field->db_length= lengths[1];
@@ -1252,7 +1252,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
field->flags|= NUM_FLAG;
if (default_value && row->data[7])
{
- field->def=strdup_root(alloc,(char*) row->data[7]);
+ field->def=strmake_root(alloc,(char*) row->data[7], lengths[7]);
field->def_length= lengths[7];
}
else
diff --git a/sql/field.cc b/sql/field.cc
index 78b2515c55f..3f74210807b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7641,8 +7641,11 @@ int Field_enum::store(longlong nr, bool unsigned_val)
if ((ulonglong) nr > typelib->count || nr == 0)
{
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
- nr=0;
- error=1;
+ if (nr != 0 || table->in_use->count_cuted_fields)
+ {
+ nr= 0;
+ error= 1;
+ }
}
store_type((ulonglong) (uint) nr);
return error;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index f8868ed6927..db73ede99b0 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -1430,7 +1430,8 @@ get_addon_fields(THD *thd, Field **ptabfield, uint sortlength, uint *plength)
doesn't work for alter table
*/
if (thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_INSERT_SELECT)
+ thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
+ thd->lex->sql_command != SQLCOM_CREATE_TABLE)
return 0;
for (pfield= ptabfield; (field= *pfield) ; pfield++)
{
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 2a5fe775ca6..fbfd5031656 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -2646,7 +2646,11 @@ ha_rows ha_berkeley::estimate_rows_upper_bound()
int ha_berkeley::cmp_ref(const byte *ref1, const byte *ref2)
{
if (hidden_primary_key)
- return memcmp(ref1, ref2, BDB_HIDDEN_PRIMARY_KEY_LENGTH);
+ {
+ ulonglong a=uint5korr((char*) ref1);
+ ulonglong b=uint5korr((char*) ref2);
+ return a < b ? -1 : (a > b ? 1 : 0);
+ }
int result;
Field *field;
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 3cf9c2a8b99..d8ffd6c55f8 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -497,105 +497,6 @@ err:
}
-/*
- Check (in create) whether the tables exists, and that it can be connected to
-
- SYNOPSIS
- check_foreign_data_source()
- share pointer to FEDERATED share
- table_create_flag tells us that ::create is the caller,
- therefore, return CANT_CREATE_FEDERATED_TABLE
-
- DESCRIPTION
- This method first checks that the connection information that parse url
- has populated into the share will be sufficient to connect to the foreign
- table, and if so, does the foreign table exist.
-*/
-
-static int check_foreign_data_source(FEDERATED_SHARE *share,
- bool table_create_flag)
-{
- char query_buffer[FEDERATED_QUERY_BUFFER_SIZE];
- char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
- uint error_code;
- String query(query_buffer, sizeof(query_buffer), &my_charset_bin);
- MYSQL *mysql;
- DBUG_ENTER("ha_federated::check_foreign_data_source");
-
- /* Zero the length, otherwise the string will have misc chars */
- query.length(0);
-
- /* error out if we can't alloc memory for mysql_init(NULL) (per Georg) */
- if (!(mysql= mysql_init(NULL)))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- /* check if we can connect */
- if (!mysql_real_connect(mysql,
- share->hostname,
- share->username,
- share->password,
- share->database,
- share->port,
- share->socket, 0))
- {
- /*
- we want the correct error message, but it to return
- ER_CANT_CREATE_FEDERATED_TABLE if called by ::create
- */
- error_code= (table_create_flag ?
- ER_CANT_CREATE_FEDERATED_TABLE :
- ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
-
- my_sprintf(error_buffer,
- (error_buffer,
- "database: '%s' username: '%s' hostname: '%s'",
- share->database, share->username, share->hostname));
-
- my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), error_buffer);
- goto error;
- }
- else
- {
- /*
- Since we do not support transactions at this version, we can let the
- client API silently reconnect. For future versions, we will need more
- logic to deal with transactions
- */
- mysql->reconnect= 1;
- /*
- Note: I am not using INORMATION_SCHEMA because this needs to work with
- versions prior to 5.0
-
- if we can connect, then make sure the table exists
-
- the query will be: SELECT * FROM `tablename` WHERE 1=0
- */
- query.append(FEDERATED_SELECT);
- query.append(FEDERATED_STAR);
- query.append(FEDERATED_FROM);
- append_ident(&query, share->table_name, share->table_name_length,
- ident_quote_char);
- query.append(FEDERATED_WHERE);
- query.append(FEDERATED_FALSE);
-
- if (mysql_real_query(mysql, query.ptr(), query.length()))
- {
- error_code= table_create_flag ?
- ER_CANT_CREATE_FEDERATED_TABLE : ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST;
- my_sprintf(error_buffer, (error_buffer, "error: %d '%s'",
- mysql_errno(mysql), mysql_error(mysql)));
-
- my_error(error_code, MYF(0), error_buffer);
- goto error;
- }
- }
- error_code=0;
-
-error:
- mysql_close(mysql);
- DBUG_RETURN(error_code);
-}
-
-
static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num)
{
char buf[FEDERATED_QUERY_BUFFER_SIZE];
@@ -1478,36 +1379,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(1);
thr_lock_data_init(&share->lock, &lock, NULL);
- /* Connect to foreign database mysql_real_connect() */
- mysql= mysql_init(0);
-
- /*
- BUG# 17044 Federated Storage Engine is not UTF8 clean
- Add set names to whatever charset the table is at open
- of table
- */
- /* this sets the csname like 'set names utf8' */
- mysql_options(mysql,MYSQL_SET_CHARSET_NAME,
- this->table->s->table_charset->csname);
-
- if (!mysql || !mysql_real_connect(mysql,
- share->hostname,
- share->username,
- share->password,
- share->database,
- share->port,
- share->socket, 0))
- {
- free_share(share);
- DBUG_RETURN(stash_remote_error());
- }
- /*
- Since we do not support transactions at this version, we can let the client
- API silently reconnect. For future versions, we will need more logic to
- deal with transactions
- */
-
- mysql->reconnect= 1;
+ DBUG_ASSERT(mysql == NULL);
ref_length= (table->s->primary_key != MAX_KEY ?
table->key_info[table->s->primary_key].key_length :
@@ -1543,8 +1415,8 @@ int ha_federated::close(void)
stored_result= 0;
}
/* Disconnect from mysql */
- if (mysql) // QQ is this really needed
- mysql_close(mysql);
+ mysql_close(mysql);
+ mysql= NULL;
retval= free_share(share);
DBUG_RETURN(retval);
@@ -1774,7 +1646,7 @@ int ha_federated::write_row(byte *buf)
if (bulk_insert.length + values_string.length() + bulk_padding >
mysql->net.max_packet_size && bulk_insert.length)
{
- error= mysql_real_query(mysql, bulk_insert.str, bulk_insert.length);
+ error= real_query(bulk_insert.str, bulk_insert.length);
bulk_insert.length= 0;
}
else
@@ -1798,8 +1670,7 @@ int ha_federated::write_row(byte *buf)
}
else
{
- error= mysql_real_query(mysql, values_string.ptr(),
- values_string.length());
+ error= real_query(values_string.ptr(), values_string.length());
}
if (error)
@@ -1811,8 +1682,13 @@ int ha_federated::write_row(byte *buf)
field, then store the last_insert_id() value from the foreign server
*/
if (auto_increment_update_required)
+ {
update_auto_increment();
+ /* mysql_insert() uses this for protocol return value */
+ table->next_number_field->store(auto_increment_value, 1);
+ }
+
DBUG_RETURN(0);
}
@@ -1842,6 +1718,13 @@ void ha_federated::start_bulk_insert(ha_rows rows)
if (rows == 1)
DBUG_VOID_RETURN;
+ /*
+ Make sure we have an open connection so that we know the
+ maximum packet size.
+ */
+ if (!mysql && real_connect())
+ DBUG_VOID_RETURN;
+
page_size= (uint) my_getpagesize();
if (init_dynamic_string(&bulk_insert, NULL, page_size, page_size))
@@ -1870,7 +1753,7 @@ int ha_federated::end_bulk_insert()
if (bulk_insert.str && bulk_insert.length)
{
- if (mysql_real_query(mysql, bulk_insert.str, bulk_insert.length))
+ if (real_query(bulk_insert.str, bulk_insert.length))
error= stash_remote_error();
else
if (table->next_number_field)
@@ -1896,7 +1779,8 @@ void ha_federated::update_auto_increment(void)
THD *thd= current_thd;
DBUG_ENTER("ha_federated::update_auto_increment");
- thd->insert_id(mysql->last_used_con->insert_id);
+ ha_federated::info(HA_STATUS_AUTO);
+ thd->insert_id(auto_increment_value);
DBUG_PRINT("info",("last_insert_id: %ld", (long) auto_increment_value));
DBUG_VOID_RETURN;
@@ -1915,7 +1799,7 @@ int ha_federated::optimize(THD* thd, HA_CHECK_OPT* check_opt)
append_ident(&query, share->table_name, share->table_name_length,
ident_quote_char);
- if (mysql_real_query(mysql, query.ptr(), query.length()))
+ if (real_query(query.ptr(), query.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -1943,7 +1827,7 @@ int ha_federated::repair(THD* thd, HA_CHECK_OPT* check_opt)
if (check_opt->sql_flags & TT_USEFRM)
query.append(FEDERATED_USE_FRM);
- if (mysql_real_query(mysql, query.ptr(), query.length()))
+ if (real_query(query.ptr(), query.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2081,7 +1965,7 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
if (!has_a_primary_key)
update_string.append(FEDERATED_LIMIT1);
- if (mysql_real_query(mysql, update_string.ptr(), update_string.length()))
+ if (real_query(update_string.ptr(), update_string.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2146,7 +2030,7 @@ int ha_federated::delete_row(const byte *buf)
delete_string.append(FEDERATED_LIMIT1);
DBUG_PRINT("info",
("Delete sql: %s", delete_string.c_ptr_quick()));
- if (mysql_real_query(mysql, delete_string.ptr(), delete_string.length()))
+ if (real_query(delete_string.ptr(), delete_string.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2255,7 +2139,7 @@ int ha_federated::index_read_idx_with_result_set(byte *buf, uint index,
NULL, 0);
sql_query.append(index_string);
- if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
+ if (real_query(sql_query.ptr(), sql_query.length()))
{
my_sprintf(error_buffer, (error_buffer, "error: %d '%s'",
mysql_errno(mysql), mysql_error(mysql)));
@@ -2321,7 +2205,7 @@ int ha_federated::read_range_first(const key_range *start_key,
mysql_free_result(stored_result);
stored_result= 0;
}
- if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
+ if (real_query(sql_query.ptr(), sql_query.length()))
{
retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
goto error;
@@ -2421,9 +2305,7 @@ int ha_federated::rnd_init(bool scan)
stored_result= 0;
}
- if (mysql_real_query(mysql,
- share->select_query,
- strlen(share->select_query)))
+ if (real_query(share->select_query, strlen(share->select_query)))
goto error;
stored_result= mysql_store_result(mysql);
@@ -2640,8 +2522,7 @@ int ha_federated::info(uint flag)
append_ident(&status_query_string, share->table_name,
share->table_name_length, value_quote_char);
- if (mysql_real_query(mysql, status_query_string.ptr(),
- status_query_string.length()))
+ if (real_query(status_query_string.ptr(), status_query_string.length()))
goto error;
status_query_string.length(0);
@@ -2688,18 +2569,27 @@ int ha_federated::info(uint flag)
block_size= 4096;
}
- if (result)
- mysql_free_result(result);
+ if (flag & HA_STATUS_AUTO)
+ auto_increment_value= mysql->last_used_con->insert_id;
+
+ mysql_free_result(result);
DBUG_RETURN(0);
error:
- if (result)
- mysql_free_result(result);
-
- my_sprintf(error_buffer, (error_buffer, ": %d : %s",
- mysql_errno(mysql), mysql_error(mysql)));
- my_error(error_code, MYF(0), error_buffer);
+ mysql_free_result(result);
+ if (mysql)
+ {
+ my_sprintf(error_buffer, (error_buffer, ": %d : %s",
+ mysql_errno(mysql), mysql_error(mysql)));
+ my_error(error_code, MYF(0), error_buffer);
+ }
+ else
+ if (remote_error_number != -1 /* error already reported */)
+ {
+ error_code= remote_error_number;
+ my_error(error_code, MYF(0), ER(error_code));
+ }
DBUG_RETURN(error_code);
}
@@ -2777,7 +2667,7 @@ int ha_federated::delete_all_rows()
/*
TRUNCATE won't return anything in mysql_affected_rows
*/
- if (mysql_real_query(mysql, query.ptr(), query.length()))
+ if (real_query(query.ptr(), query.length()))
{
DBUG_RETURN(stash_remote_error());
}
@@ -2866,8 +2756,7 @@ int ha_federated::create(const char *name, TABLE *table_arg,
FEDERATED_SHARE tmp_share; // Only a temporary share, to test the url
DBUG_ENTER("ha_federated::create");
- if (!(retval= parse_url(&tmp_share, table_arg, 1)))
- retval= check_foreign_data_source(&tmp_share, 1);
+ retval= parse_url(&tmp_share, table_arg, 1);
my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
DBUG_RETURN(retval);
@@ -2875,9 +2764,114 @@ int ha_federated::create(const char *name, TABLE *table_arg,
}
+int ha_federated::real_connect()
+{
+ char buffer[FEDERATED_QUERY_BUFFER_SIZE];
+ String sql_query(buffer, sizeof(buffer), &my_charset_bin);
+ DBUG_ENTER("ha_federated::real_connect");
+
+ /*
+ Bug#25679
+ Ensure that we do not hold the LOCK_open mutex while attempting
+ to establish Federated connection to guard against a trivial
+ Denial of Service scenerio.
+ */
+ safe_mutex_assert_not_owner(&LOCK_open);
+
+ DBUG_ASSERT(mysql == NULL);
+
+ if (!(mysql= mysql_init(NULL)))
+ {
+ remote_error_number= HA_ERR_OUT_OF_MEM;
+ DBUG_RETURN(-1);
+ }
+
+ /*
+ BUG# 17044 Federated Storage Engine is not UTF8 clean
+ Add set names to whatever charset the table is at open
+ of table
+ */
+ /* this sets the csname like 'set names utf8' */
+ mysql_options(mysql,MYSQL_SET_CHARSET_NAME,
+ this->table->s->table_charset->csname);
+
+ sql_query.length(0);
+
+ if (!mysql_real_connect(mysql,
+ share->hostname,
+ share->username,
+ share->password,
+ share->database,
+ share->port,
+ share->socket, 0))
+ {
+ stash_remote_error();
+ mysql_close(mysql);
+ mysql= NULL;
+ my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), remote_error_buf);
+ remote_error_number= -1;
+ DBUG_RETURN(-1);
+ }
+
+ /*
+ We have established a connection, lets try a simple dummy query just
+ to check that the table and expected columns are present.
+ */
+ sql_query.append(share->select_query);
+ sql_query.append(FEDERATED_WHERE);
+ sql_query.append(FEDERATED_FALSE);
+ if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
+ {
+ sql_query.length(0);
+ sql_query.append("error: ");
+ sql_query.qs_append(mysql_errno(mysql));
+ sql_query.append(" '");
+ sql_query.append(mysql_error(mysql));
+ sql_query.append("'");
+ mysql_close(mysql);
+ mysql= NULL;
+ my_error(ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST, MYF(0), sql_query.ptr());
+ remote_error_number= -1;
+ DBUG_RETURN(-1);
+ }
+
+ /* Just throw away the result, no rows anyways but need to keep in sync */
+ mysql_free_result(mysql_store_result(mysql));
+
+ /*
+ Since we do not support transactions at this version, we can let the client
+ API silently reconnect. For future versions, we will need more logic to
+ deal with transactions
+ */
+
+ mysql->reconnect= 1;
+ DBUG_RETURN(0);
+}
+
+
+int ha_federated::real_query(const char *query, uint length)
+{
+ int rc= 0;
+ DBUG_ENTER("ha_federated::real_query");
+
+ if (!mysql && (rc= real_connect()))
+ goto end;
+
+ if (!query || !length)
+ goto end;
+
+ rc= mysql_real_query(mysql, query, length);
+
+end:
+ DBUG_RETURN(rc);
+}
+
+
int ha_federated::stash_remote_error()
{
DBUG_ENTER("ha_federated::stash_remote_error()");
+ if (!mysql)
+ DBUG_RETURN(remote_error_number);
remote_error_number= mysql_errno(mysql);
strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1);
if (remote_error_number == ER_DUP_ENTRY ||
diff --git a/sql/ha_federated.h b/sql/ha_federated.h
index 2e510fa87da..dc4f976c578 100644
--- a/sql/ha_federated.h
+++ b/sql/ha_federated.h
@@ -183,6 +183,8 @@ private:
uint key_len,
ha_rkey_function find_flag,
MYSQL_RES **result);
+ int real_query(const char *query, uint length);
+ int real_connect();
public:
ha_federated(TABLE *table_arg);
~ha_federated()
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index b03dc9bb986..f87d47174ac 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -455,9 +455,7 @@ convert_error_code_to_mysql(
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
- if (thd) {
- ha_rollback(thd);
- }
+ mark_transaction_to_rollback(thd, TRUE);
return(HA_ERR_LOCK_DEADLOCK);
@@ -467,9 +465,8 @@ convert_error_code_to_mysql(
latest SQL statement in a lock wait timeout. Previously, we
rolled back the whole transaction. */
- if (thd && row_rollback_on_timeout) {
- ha_rollback(thd);
- }
+ mark_transaction_to_rollback(thd,
+ (bool)row_rollback_on_timeout);
return(HA_ERR_LOCK_WAIT_TIMEOUT);
@@ -521,9 +518,7 @@ convert_error_code_to_mysql(
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
- if (thd) {
- ha_rollback(thd);
- }
+ mark_transaction_to_rollback(thd, TRUE);
return(HA_ERR_LOCK_TABLE_FULL);
} else {
@@ -6721,17 +6716,6 @@ ha_innobase::store_lock(
&& !thd->tablespace_op
&& thd->lex->sql_command != SQLCOM_TRUNCATE
&& thd->lex->sql_command != SQLCOM_OPTIMIZE
-
-#ifdef __WIN__
- /* For alter table on win32 for succesful operation
- completion it is used TL_WRITE(=10) lock instead of
- TL_WRITE_ALLOW_READ(=6), however here in innodb handler
- TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
- race condition when several clients do alter table
- simultaneously (bug #17264). This fix avoids the problem. */
- && thd->lex->sql_command != SQLCOM_ALTER_TABLE
-#endif
-
&& thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
lock_type = TL_WRITE_ALLOW_WRITE;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 357b797ec75..a00dd6c505c 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -3732,7 +3732,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
{
m_transaction_on= FALSE;
/* Would be simpler if has_transactions() didn't always say "yes" */
- thd->no_trans_update.all= thd->no_trans_update.stmt= TRUE;
+ thd->transaction.all.modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table= TRUE;
}
else if (!thd->transaction.on)
m_transaction_on= FALSE;
diff --git a/sql/handler.cc b/sql/handler.cc
index f8aec72ec90..8ef14ce8906 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -821,6 +821,9 @@ int ha_rollback_trans(THD *thd, bool all)
}
}
#endif /* USING_TRANSACTIONS */
+ if (all)
+ thd->transaction_rollback_request= FALSE;
+
/*
If a non-transactional table was updated, warn; don't warn if this is a
slave thread (because when a slave thread executes a ROLLBACK, it has
@@ -830,7 +833,7 @@ int ha_rollback_trans(THD *thd, bool all)
the error log; but we don't want users to wonder why they have this
message in the error log, so we don't send it.
*/
- if (is_real_trans && thd->no_trans_update.all &&
+ if (is_real_trans && thd->transaction.all.modified_non_trans_table &&
!thd->slave_thread)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
@@ -858,6 +861,8 @@ int ha_autocommit_or_rollback(THD *thd, int error)
if (ha_commit_stmt(thd))
error=1;
}
+ else if (thd->transaction_rollback_request && !thd->in_sub_stmt)
+ (void) ha_rollback(thd);
else
(void) ha_rollback_stmt(thd);
@@ -1997,7 +2002,13 @@ static bool update_frm_version(TABLE *table, bool needs_lock)
int result= 1;
DBUG_ENTER("update_frm_version");
- if (table->s->mysql_version != MYSQL_VERSION_ID)
+ /*
+ No need to update frm version in case table was created or checked
+ by server with the same version. This also ensures that we do not
+ update frm version for temporary tables as this code doesn't support
+ temporary tables.
+ */
+ if (table->s->mysql_version == MYSQL_VERSION_ID)
DBUG_RETURN(0);
strxnmov(path, sizeof(path)-1, mysql_data_home, "/", table->s->db, "/",
diff --git a/sql/handler.h b/sql/handler.h
index a3767573178..74c09d2d9ee 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -420,6 +420,35 @@ typedef struct st_thd_trans
bool no_2pc;
/* storage engines that registered themselves for this transaction */
handlerton *ht[MAX_HA];
+ /*
+ The purpose of this flag is to keep track of non-transactional
+ tables that were modified in scope of:
+ - transaction, when the variable is a member of
+ THD::transaction.all
+ - top-level statement or sub-statement, when the variable is a
+ member of THD::transaction.stmt
+ This member has the following life cycle:
+ * stmt.modified_non_trans_table is used to keep track of
+ modified non-transactional tables of top-level statements. At
+ the end of the previous statement and at the beginning of the session,
+ it is reset to FALSE. If such functions
+ as mysql_insert, mysql_update, mysql_delete etc modify a
+ non-transactional table, they set this flag to TRUE. At the
+ end of the statement, the value of stmt.modified_non_trans_table
+ is merged with all.modified_non_trans_table and gets reset.
+ * all.modified_non_trans_table is reset at the end of transaction
+
+ * Since we do not have a dedicated context for execution of a
+ sub-statement, to keep track of non-transactional changes in a
+ sub-statement, we re-use stmt.modified_non_trans_table.
+ At entrance into a sub-statement, a copy of the value of
+ stmt.modified_non_trans_table (containing the changes of the
+ outer statement) is saved on stack. Then
+ stmt.modified_non_trans_table is reset to FALSE and the
+ substatement is executed. Then the new value is merged with the
+ saved value.
+ */
+ bool modified_non_trans_table;
} THD_TRANS;
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
@@ -508,6 +537,29 @@ class handler :public Sql_alloc
*/
virtual int rnd_init(bool scan) =0;
virtual int rnd_end() { return 0; }
+ /**
+ Is not invoked for non-transactional temporary tables.
+
+ Tells the storage engine that we intend to read or write data
+ from the table. This call is prefixed with a call to handler::store_lock()
+ and is invoked only for those handler instances that stored the lock.
+
+ Calls to rnd_init/index_init are prefixed with this call. When table
+ IO is complete, we call external_lock(F_UNLCK).
+ A storage engine writer should expect that each call to
+ ::external_lock(F_[RD|WR]LOCK is followed by a call to
+ ::external_lock(F_UNLCK). If it is not, it is a bug in MySQL.
+
+ The name and signature originate from the first implementation
+ in MyISAM, which would call fcntl to set/clear an advisory
+ lock on the data file in this method.
+
+ @param lock_type F_RDLCK, F_WRLCK, F_UNLCK
+
+ @return non-0 in case of failure, 0 in case of success.
+ When lock_type is F_UNLCK, the return value is ignored.
+ */
+ virtual int external_lock(THD *thd, int lock_type) { return 0; }
public:
const handlerton *ht; /* storage engine of this handler */
@@ -548,6 +600,7 @@ public:
uint raid_type,raid_chunks;
FT_INFO *ft_handler;
enum {NONE=0, INDEX, RND} inited;
+ bool locked;
bool auto_increment_column_changed;
bool implicit_emptied; /* Can be !=0 only if HEAP */
const COND *pushed_cond;
@@ -560,10 +613,11 @@ public:
create_time(0), check_time(0), update_time(0),
key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
ref_length(sizeof(my_off_t)), block_size(0),
- raid_type(0), ft_handler(0), inited(NONE), implicit_emptied(0),
+ raid_type(0), ft_handler(0), inited(NONE),
+ locked(FALSE), implicit_emptied(0),
pushed_cond(NULL)
{}
- virtual ~handler(void) { /* TODO: DBUG_ASSERT(inited == NONE); */ }
+ virtual ~handler(void) { DBUG_ASSERT(locked == FALSE); /* TODO: DBUG_ASSERT(inited == NONE); */ }
virtual handler *clone(MEM_ROOT *mem_root);
int ha_open(const char *name, int mode, int test_if_locked);
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
@@ -597,6 +651,12 @@ public:
virtual const char *index_type(uint key_number) { DBUG_ASSERT(0); return "";}
+ int ha_external_lock(THD *thd, int lock_type)
+ {
+ DBUG_ENTER("ha_external_lock");
+ locked= lock_type != F_UNLCK;
+ DBUG_RETURN(external_lock(thd, lock_type));
+ }
int ha_index_init(uint idx)
{
DBUG_ENTER("ha_index_init");
@@ -689,7 +749,6 @@ public:
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
{ return extra(operation); }
virtual int reset() { return extra(HA_EXTRA_RESET); }
- virtual int external_lock(THD *thd, int lock_type) { return 0; }
virtual void unlock_row() {}
virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
/*
@@ -837,6 +896,9 @@ public:
/* lock_count() can be more than one if the table is a MERGE */
virtual uint lock_count(void) const { return 1; }
+ /**
+ Is not invoked for non-transactional temporary tables.
+ */
virtual THR_LOCK_DATA **store_lock(THD *thd,
THR_LOCK_DATA **to,
enum thr_lock_type lock_type)=0;
diff --git a/sql/item.cc b/sql/item.cc
index 2fc58eebe75..9612fbc5243 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -336,6 +336,37 @@ int Item::save_date_in_field(Field *field)
}
+/*
+ Store the string value in field directly
+
+ SYNOPSIS
+ Item::save_str_value_in_field()
+ field a pointer to field where to store
+ result the pointer to the string value to be stored
+
+ DESCRIPTION
+ The method is used by Item_*::save_in_field implementations
+ when we don't need to calculate the value to store
+ See Item_string::save_in_field() implementation for example
+
+ IMPLEMENTATION
+ Check if the Item is null and stores the NULL or the
+ result value in the field accordingly.
+
+ RETURN
+ Nonzero value if error
+*/
+
+int Item::save_str_value_in_field(Field *field, String *result)
+{
+ if (null_value)
+ return set_field_to_null(field);
+ field->set_notnull();
+ return field->store(result->ptr(), result->length(),
+ collation.collation);
+}
+
+
Item::Item():
rsize(0), name(0), orig_name(0), name_length(0), fixed(0),
is_autogenerated_name(TRUE),
@@ -1022,9 +1053,9 @@ bool Item_sp_variable::is_null()
Item_splocal::Item_splocal(const LEX_STRING &sp_var_name,
uint sp_var_idx,
enum_field_types sp_var_type,
- uint pos_in_q)
+ uint pos_in_q, uint len_in_q)
:Item_sp_variable(sp_var_name.str, sp_var_name.length),
- m_var_idx(sp_var_idx), pos_in_query(pos_in_q)
+ m_var_idx(sp_var_idx), pos_in_query(pos_in_q), len_in_query(len_in_q)
{
maybe_null= TRUE;
@@ -3009,16 +3040,6 @@ my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value)
}
-
-int Item_copy_string::save_in_field(Field *field, bool no_conversions)
-{
- if (null_value)
- return set_field_to_null(field);
- field->set_notnull();
- return field->store(str_value.ptr(),str_value.length(),
- collation.collation);
-}
-
/*
Functions to convert item to field (for send_fields)
*/
@@ -4417,6 +4438,12 @@ int Item_null::save_safe_in_field(Field *field)
}
+/*
+ This implementation can lose str_value content, so if the
+ Item uses str_value to store something, it should
+ reimplement it's ::save_in_field() as Item_string, for example, does
+*/
+
int Item::save_in_field(Field *field, bool no_conversions)
{
int error;
@@ -4474,10 +4501,7 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
{
String *result;
result=val_str(&str_value);
- if (null_value)
- return set_field_to_null(field);
- field->set_notnull();
- return field->store(result->ptr(),result->length(),collation.collation);
+ return save_str_value_in_field(field, result);
}
diff --git a/sql/item.h b/sql/item.h
index 5b1a80a5f03..23f6977a0f8 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -612,6 +612,7 @@ public:
int save_time_in_field(Field *field);
int save_date_in_field(Field *field);
+ int save_str_value_in_field(Field *field, String *result);
virtual Field *get_tmp_table_field() { return 0; }
/* This is also used to create fields in CREATE ... SELECT: */
@@ -959,9 +960,18 @@ public:
SP variable in query text.
*/
uint pos_in_query;
+ /*
+ Byte length of SP variable name in the statement (see pos_in_query).
+ The value of this field may differ from the name_length value because
+ name_length contains byte length of UTF8-encoded item name, but
+ the query string (see sp_instr_stmt::m_query) is currently stored with
+ a charset from the SET NAMES statement.
+ */
+ uint len_in_query;
Item_splocal(const LEX_STRING &sp_var_name, uint sp_var_idx,
- enum_field_types sp_var_type, uint pos_in_q= 0);
+ enum_field_types sp_var_type,
+ uint pos_in_q= 0, uint len_in_q= 0);
bool is_splocal() { return 1; } /* Needed for error checking */
@@ -2166,7 +2176,10 @@ public:
my_decimal *val_decimal(my_decimal *);
void make_field(Send_field *field) { item->make_field(field); }
void copy();
- int save_in_field(Field *field, bool no_conversions);
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ return save_str_value_in_field(field, &str_value);
+ }
table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; }
bool is_null() { return null_value; }
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 50db1c37371..561613032bc 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -70,7 +70,8 @@ Item *create_func_ceiling(Item* a)
Item *create_func_connection_id(void)
{
- current_thd->lex->safe_to_cache_query= 0;
+ THD *thd= current_thd;
+ thd->lex->safe_to_cache_query= 0;
return new Item_func_connection_id();
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index b256ce4624a..c70cfa1ce2a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -649,16 +649,8 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref)
{
if (Item_int_func::fix_fields(thd, ref))
return TRUE;
-
- /*
- To replicate CONNECTION_ID() properly we should use
- pseudo_thread_id on slave, which contains the value of thread_id
- on master.
- */
- value= ((thd->slave_thread) ?
- thd->variables.pseudo_thread_id :
- thd->thread_id);
-
+ thd->thread_specific_used= TRUE;
+ value= thd->variables.pseudo_thread_id;
return FALSE;
}
@@ -5591,5 +5583,15 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
#endif /* ! NO_EMBEDDED_ACCESS_CHECKS */
}
+ if (!m_sp->m_chistics->detistic)
+ used_tables_cache |= RAND_TABLE_BIT;
DBUG_RETURN(res);
}
+
+
+void Item_func_sp::update_used_tables()
+{
+ Item_func::update_used_tables();
+ if (!m_sp->m_chistics->detistic)
+ used_tables_cache |= RAND_TABLE_BIT;
+}
diff --git a/sql/item_func.h b/sql/item_func.h
index 9a0201cb28b..56b5e75652c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1467,7 +1467,7 @@ public:
virtual ~Item_func_sp()
{}
- table_map used_tables() const { return RAND_TABLE_BIT; }
+ void update_used_tables();
void cleanup();
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index d7c4a3eddef..6ca0b89a22b 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -434,6 +434,10 @@ public:
}
const char *func_name() const { return "user"; }
const char *fully_qualified_func_name() const { return "user()"; }
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ return save_str_value_in_field(field, &str_value);
+ }
};
diff --git a/sql/lock.cc b/sql/lock.cc
index 93358e56701..f730ac56d35 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -151,7 +151,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
}
thd->proc_info="System lock";
- if (lock_external(thd, tables, count))
+ if (sql_lock->table_count && lock_external(thd, sql_lock->table,
+ sql_lock->table_count))
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data(sql_lock);
@@ -246,12 +247,12 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
(*tables)->reginfo.lock_type <= TL_READ_NO_INSERT))
lock_type=F_RDLCK;
- if ((error=(*tables)->file->external_lock(thd,lock_type)))
+ if ((error= (*tables)->file->ha_external_lock(thd,lock_type)))
{
print_lock_error(error, (*tables)->file->table_type());
for (; i-- ; tables--)
{
- (*tables)->file->external_lock(thd, F_UNLCK);
+ (*tables)->file->ha_external_lock(thd, F_UNLCK);
(*tables)->current_lock=F_UNLCK;
}
DBUG_RETURN(error);
@@ -353,10 +354,28 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
}
+/**
+ Try to find the table in the list of locked tables.
+ In case of success, unlock the table and remove it from this list.
-void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
+ @note This function has a legacy side effect: the table is
+ unlocked even if it is not found in the locked list.
+ It's not clear if this side effect is intentional or still
+ desirable. It might lead to unmatched calls to
+ unlock_external(). Moreover, a discrepancy can be left
+ unnoticed by the storage engine, because in
+ unlock_external() we call handler::external_lock(F_UNLCK) only
+ if table->current_lock is not F_UNLCK.
+
+ @param always_unlock specify explicitly if the legacy side
+ effect is desired.
+*/
+
+void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
+ bool always_unlock)
{
- mysql_unlock_some_tables(thd, &table,1);
+ if (always_unlock == TRUE)
+ mysql_unlock_some_tables(thd, &table, /* table count */ 1);
if (locked)
{
reg1 uint i;
@@ -370,6 +389,10 @@ void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table)
DBUG_ASSERT(table->lock_position == i);
+ /* Unlock if not yet unlocked */
+ if (always_unlock == FALSE)
+ mysql_unlock_some_tables(thd, &table, /* table count */ 1);
+
/* Decrement table_count in advance, making below expressions easier */
old_tables= --locked->table_count;
@@ -623,7 +646,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
if ((*table)->current_lock != F_UNLCK)
{
(*table)->current_lock = F_UNLCK;
- if ((error=(*table)->file->external_lock(thd, F_UNLCK)))
+ if ((error= (*table)->file->ha_external_lock(thd, F_UNLCK)))
{
error_code=error;
print_lock_error(error_code, (*table)->file->table_type());
diff --git a/sql/log.cc b/sql/log.cc
index 744d2a3ca65..e9aa273676a 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -162,7 +162,7 @@ static int binlog_rollback(THD *thd, bool all)
table. Such cases should be rare (updating a
non-transactional table inside a transaction...)
*/
- if (unlikely(thd->no_trans_update.all))
+ if (unlikely(thd->transaction.all.modified_non_trans_table))
{
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
@@ -217,7 +217,7 @@ static int binlog_savepoint_rollback(THD *thd, void *sv)
non-transactional table. Otherwise, truncate the binlog cache starting
from the SAVEPOINT command.
*/
- if (unlikely(thd->no_trans_update.all))
+ if (unlikely(thd->transaction.all.modified_non_trans_table))
{
Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE);
DBUG_RETURN(mysql_bin_log.write(&qinfo));
@@ -1833,6 +1833,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event)
/* NULL would represent nothing to replicate after ROLLBACK */
DBUG_ASSERT(commit_event != NULL);
+ DBUG_ASSERT(is_open());
if (likely(is_open())) // Should always be true
{
uint length, group, carry, hdr_offs, val;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index c37df31ae00..1ef765f607f 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1303,8 +1303,9 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
ulong query_length, bool using_trans,
bool suppress_use, THD::killed_state killed_status_arg)
:Log_event(thd_arg,
- ((thd_arg->tmp_table_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0)
- | (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0)),
+ ((thd_arg->tmp_table_used || thd_arg->thread_specific_used) ?
+ LOG_EVENT_THREAD_SPECIFIC_F : 0) |
+ (suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0),
using_trans),
data_buf(0), query(query_arg), catalog(thd_arg->catalog),
db(thd_arg->db), q_len((uint32) query_length),
@@ -2689,8 +2690,10 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
List<Item> &fields_arg,
enum enum_duplicates handle_dup,
bool ignore, bool using_trans)
- :Log_event(thd_arg, !thd_arg->tmp_table_used ?
- 0 : LOG_EVENT_THREAD_SPECIFIC_F, using_trans),
+ :Log_event(thd_arg,
+ (thd_arg->tmp_table_used || thd_arg->thread_specific_used) ?
+ LOG_EVENT_THREAD_SPECIFIC_F : 0,
+ using_trans),
thread_id(thd_arg->thread_id),
slave_proxy_id(thd_arg->variables.pseudo_thread_id),
num_fields(0),fields(0),
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d14aab57489..ca6aa8ecab0 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1452,7 +1452,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
-void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
+void mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table,
+ bool always_unlock);
void mysql_lock_abort(THD *thd, TABLE *table);
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 247f0eada49..d978c8882ac 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -972,7 +972,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file,
free_file));
file->reset();
- file->external_lock(current_thd, F_UNLCK);
+ file->ha_external_lock(current_thd, F_UNLCK);
file->close();
}
}
@@ -1142,7 +1142,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
/* Caller will free the memory */
goto failure; /* purecov: inspected */
}
- if (file->external_lock(thd, F_RDLCK))
+ if (file->ha_external_lock(thd, F_RDLCK))
goto failure;
if (!head->no_keyread)
{
@@ -1152,7 +1152,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) ||
init() || reset())
{
- file->external_lock(thd, F_UNLCK);
+ file->ha_external_lock(thd, F_UNLCK);
file->close();
goto failure;
}
diff --git a/sql/set_var.cc b/sql/set_var.cc
index b30aa008366..e1246617d84 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -2901,14 +2901,14 @@ static bool set_option_autocommit(THD *thd, set_var *var)
{
/* We changed to auto_commit mode */
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
if (ha_commit(thd))
return 1;
}
else
{
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
}
}
diff --git a/sql/sp.cc b/sql/sp.cc
index c0e7d5e2271..75d6fa4618f 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -273,7 +273,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
goto done;
- if (table->s->fields != MYSQL_PROC_FIELD_COUNT)
+ if (table->s->fields < MYSQL_PROC_FIELD_COUNT)
{
ret= SP_GET_FIELD_FAILED;
goto done;
@@ -523,7 +523,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
strxmov(definer, thd->lex->definer->user.str, "@",
thd->lex->definer->host.str, NullS);
- if (table->s->fields != MYSQL_PROC_FIELD_COUNT)
+ if (table->s->fields < MYSQL_PROC_FIELD_COUNT)
{
ret= SP_GET_FIELD_FAILED;
goto done;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 0ac1db336d0..5ad6625efb8 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -337,13 +337,13 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
bool save_abort_on_warning= thd->abort_on_warning;
- bool save_no_trans_update_stmt= thd->no_trans_update.stmt;
+ bool save_stmt_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
thd->abort_on_warning=
thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
- thd->no_trans_update.stmt= FALSE;
+ thd->transaction.stmt.modified_non_trans_table= FALSE;
/* Save the value in the field. Convert the value if needed. */
@@ -351,7 +351,7 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
thd->count_cuted_fields= save_count_cuted_fields;
thd->abort_on_warning= save_abort_on_warning;
- thd->no_trans_update.stmt= save_no_trans_update_stmt;
+ thd->transaction.stmt.modified_non_trans_table= save_stmt_modified_non_trans_table;
if (thd->net.report_error)
{
@@ -795,7 +795,8 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
/*
- Replace thd->query{_length} with a string that one can write to the binlog.
+ Replace thd->query{_length} with a string that one can write to the binlog
+ or the query cache.
SYNOPSIS
subst_spvars()
@@ -807,7 +808,9 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
DESCRIPTION
The binlog-suitable string is produced by replacing references to SP local
- variables with NAME_CONST('sp_var_name', value) calls.
+ variables with NAME_CONST('sp_var_name', value) calls. To make this string
+ suitable for the query cache this function allocates some additional space
+ for the query cache flags.
RETURN
FALSE on success
@@ -820,80 +823,89 @@ static bool
subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
{
DBUG_ENTER("subst_spvars");
- if (thd->prelocked_mode == NON_PRELOCKED && mysql_bin_log.is_open())
- {
- Dynamic_array<Item_splocal*> sp_vars_uses;
- char *pbuf, *cur, buffer[512];
- String qbuf(buffer, sizeof(buffer), &my_charset_bin);
- int prev_pos, res;
- /* Find all instances of Item_splocal used in this statement */
- for (Item *item= instr->free_list; item; item= item->next)
- {
- if (item->is_splocal())
- {
- Item_splocal *item_spl= (Item_splocal*)item;
- if (item_spl->pos_in_query)
- sp_vars_uses.append(item_spl);
- }
- }
- if (!sp_vars_uses.elements())
- DBUG_RETURN(FALSE);
-
- /* Sort SP var refs by their occurences in the query */
- sp_vars_uses.sort(cmp_splocal_locations);
+ Dynamic_array<Item_splocal*> sp_vars_uses;
+ char *pbuf, *cur, buffer[512];
+ String qbuf(buffer, sizeof(buffer), &my_charset_bin);
+ int prev_pos, res, buf_len;
- /*
- Construct a statement string where SP local var refs are replaced
- with "NAME_CONST(name, value)"
- */
- qbuf.length(0);
- cur= query_str->str;
- prev_pos= res= 0;
- for (Item_splocal **splocal= sp_vars_uses.front();
- splocal < sp_vars_uses.back(); splocal++)
+ /* Find all instances of Item_splocal used in this statement */
+ for (Item *item= instr->free_list; item; item= item->next)
+ {
+ if (item->is_splocal())
{
- Item *val;
+ Item_splocal *item_spl= (Item_splocal*)item;
+ if (item_spl->pos_in_query)
+ sp_vars_uses.append(item_spl);
+ }
+ }
+ if (!sp_vars_uses.elements())
+ DBUG_RETURN(FALSE);
+
+ /* Sort SP var refs by their occurences in the query */
+ sp_vars_uses.sort(cmp_splocal_locations);
- char str_buffer[STRING_BUFFER_USUAL_SIZE];
- String str_value_holder(str_buffer, sizeof(str_buffer),
- &my_charset_latin1);
- String *str_value;
-
- /* append the text between sp ref occurences */
- res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos);
- prev_pos= (*splocal)->pos_in_query + (*splocal)->m_name.length;
-
- /* append the spvar substitute */
- res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('"));
- res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length);
- res|= qbuf.append(STRING_WITH_LEN("',"));
- res|= (*splocal)->fix_fields(thd, (Item **) splocal);
+ /*
+ Construct a statement string where SP local var refs are replaced
+ with "NAME_CONST(name, value)"
+ */
+ qbuf.length(0);
+ cur= query_str->str;
+ prev_pos= res= 0;
+ for (Item_splocal **splocal= sp_vars_uses.front();
+ splocal < sp_vars_uses.back(); splocal++)
+ {
+ Item *val;
- if (res)
- break;
+ char str_buffer[STRING_BUFFER_USUAL_SIZE];
+ String str_value_holder(str_buffer, sizeof(str_buffer),
+ &my_charset_latin1);
+ String *str_value;
+
+ /* append the text between sp ref occurences */
+ res|= qbuf.append(cur + prev_pos, (*splocal)->pos_in_query - prev_pos);
+ prev_pos= (*splocal)->pos_in_query + (*splocal)->len_in_query;
+
+ /* append the spvar substitute */
+ res|= qbuf.append(STRING_WITH_LEN(" NAME_CONST('"));
+ res|= qbuf.append((*splocal)->m_name.str, (*splocal)->m_name.length);
+ res|= qbuf.append(STRING_WITH_LEN("',"));
+ res|= (*splocal)->fix_fields(thd, (Item **) splocal);
- val= (*splocal)->this_item();
- DBUG_PRINT("info", ("print %p", val));
- str_value= sp_get_item_value(thd, val, &str_value_holder);
- if (str_value)
- res|= qbuf.append(*str_value);
- else
- res|= qbuf.append(STRING_WITH_LEN("NULL"));
- res|= qbuf.append(')');
- if (res)
- break;
- }
- res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos);
if (res)
- DBUG_RETURN(TRUE);
+ break;
- if (!(pbuf= thd->strmake(qbuf.ptr(), qbuf.length())))
- DBUG_RETURN(TRUE);
+ val= (*splocal)->this_item();
+ DBUG_PRINT("info", ("print %p", val));
+ str_value= sp_get_item_value(thd, val, &str_value_holder);
+ if (str_value)
+ res|= qbuf.append(*str_value);
+ else
+ res|= qbuf.append(STRING_WITH_LEN("NULL"));
+ res|= qbuf.append(')');
+ if (res)
+ break;
+ }
+ res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos);
+ if (res)
+ DBUG_RETURN(TRUE);
- thd->query= pbuf;
- thd->query_length= qbuf.length();
+ /*
+ Allocate additional space at the end of the new query string for the
+ query_cache_send_result_to_client function.
+ */
+ buf_len= qbuf.length() + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE + 1;
+ if ((pbuf= alloc_root(thd->mem_root, buf_len)))
+ {
+ memcpy(pbuf, qbuf.ptr(), qbuf.length());
+ pbuf[qbuf.length()]= 0;
}
+ else
+ DBUG_RETURN(TRUE);
+
+ thd->query= pbuf;
+ thd->query_length= qbuf.length();
+
DBUG_RETURN(FALSE);
}
@@ -2388,7 +2400,13 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
bool open_tables, sp_instr* instr)
{
int res= 0;
-
+ /*
+ The flag is saved at the entry to the following substatement.
+ It's reset further in the common code part.
+ It's merged with the saved parent's value at the exit of this func.
+ */
+ bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
+ thd->transaction.stmt.modified_non_trans_table= FALSE;
DBUG_ASSERT(!thd->derived_tables);
DBUG_ASSERT(thd->change_list.is_empty());
/*
@@ -2455,7 +2473,11 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
/* Update the state of the active arena. */
thd->stmt_arena->state= Query_arena::EXECUTED;
-
+ /*
+ Merge here with the saved parent's values
+ what is needed from the substatement gained
+ */
+ thd->transaction.stmt.modified_non_trans_table |= parent_modified_non_trans_table;
/*
Unlike for PS we should not call Item's destructors for newly created
items after execution of each instruction in stored routine. This is
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index e49c4eb1240..ac7c46c9fe5 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -37,6 +37,7 @@ sp_rcontext::sp_rcontext(sp_pcontext *root_parsing_ctx,
m_var_items(0),
m_return_value_fld(return_value_fld),
m_return_value_set(FALSE),
+ in_sub_stmt(FALSE),
m_hcount(0),
m_hsp(0),
m_ihsp(0),
@@ -67,6 +68,8 @@ sp_rcontext::~sp_rcontext()
bool sp_rcontext::init(THD *thd)
{
+ in_sub_stmt= thd->in_sub_stmt;
+
if (init_var_table(thd) || init_var_items())
return TRUE;
@@ -191,7 +194,7 @@ sp_rcontext::set_return_value(THD *thd, Item **return_value_item)
*/
bool
-sp_rcontext::find_handler(uint sql_errno,
+sp_rcontext::find_handler(THD *thd, uint sql_errno,
MYSQL_ERROR::enum_warning_level level)
{
if (m_hfound >= 0)
@@ -200,6 +203,15 @@ sp_rcontext::find_handler(uint sql_errno,
const char *sqlstate= mysql_errno_to_sqlstate(sql_errno);
int i= m_hcount, found= -1;
+ /*
+ If this is a fatal sub-statement error, and this runtime
+ context corresponds to a sub-statement, no CONTINUE/EXIT
+ handlers from this context are applicable: try to locate one
+ in the outer scope.
+ */
+ if (thd->is_fatal_sub_stmt_error && in_sub_stmt)
+ i= 0;
+
/* Search handlers from the latest (innermost) to the oldest (outermost) */
while (i--)
{
@@ -252,7 +264,7 @@ sp_rcontext::find_handler(uint sql_errno,
*/
if (m_prev_runtime_ctx && IS_EXCEPTION_CONDITION(sqlstate) &&
level == MYSQL_ERROR::WARN_LEVEL_ERROR)
- return m_prev_runtime_ctx->find_handler(sql_errno, level);
+ return m_prev_runtime_ctx->find_handler(thd, sql_errno, level);
return FALSE;
}
m_hfound= found;
@@ -298,7 +310,7 @@ sp_rcontext::handle_error(uint sql_errno,
elevated_level= MYSQL_ERROR::WARN_LEVEL_ERROR;
}
- if (find_handler(sql_errno, elevated_level))
+ if (find_handler(thd, sql_errno, elevated_level))
{
if (elevated_level == MYSQL_ERROR::WARN_LEVEL_ERROR)
{
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index fbf479f52aa..0104b71a648 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -125,7 +125,7 @@ class sp_rcontext : public Sql_alloc
// Returns 1 if a handler was found, 0 otherwise.
bool
- find_handler(uint sql_errno,MYSQL_ERROR::enum_warning_level level);
+ find_handler(THD *thd, uint sql_errno,MYSQL_ERROR::enum_warning_level level);
// If there is an error handler for this error, handle it and return TRUE.
bool
@@ -236,6 +236,10 @@ private:
during execution.
*/
bool m_return_value_set;
+ /**
+ TRUE if the context is created for a sub-statement.
+ */
+ bool in_sub_stmt;
sp_handler_t *m_handler; // Visible handlers
uint m_hcount; // Stack pointer for m_handler
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index bf1c6d7cb0d..1c01248c283 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -62,11 +62,11 @@ Prelock_error_handler::handle_error(uint sql_errno,
if (sql_errno == ER_NO_SUCH_TABLE)
{
m_handled_errors++;
- return TRUE; // 'TRUE', as per coding style
+ return TRUE;
}
m_unhandled_errors++;
- return FALSE; // 'FALSE', as per coding style
+ return FALSE;
}
@@ -1037,6 +1037,31 @@ TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name)
return 0; // Not a temporary table
}
+
+/**
+ Drop a temporary table.
+
+ Try to locate the table in the list of thd->temporary_tables.
+ If the table is found:
+ - if the table is in thd->locked_tables, unlock it and
+ remove it from the list of locked tables. Currently only transactional
+ temporary tables are present in the locked_tables list.
+ - Close the temporary table, remove its .FRM
+ - remove the table from the list of temporary tables
+
+ This function is used to drop user temporary tables, as well as
+ internal tables created in CREATE TEMPORARY TABLE ... SELECT
+ or ALTER TABLE. Even though part of the work done by this function
+ is redundant when the table is internal, as long as we
+ link both internal and user temporary tables into the same
+ thd->temporary_tables list, it's impossible to tell here whether
+ we're dealing with an internal or a user temporary table.
+
+ @retval TRUE the table was not found in the list of temporary tables
+ of this thread
+ @retval FALSE the table was found and dropped successfully.
+*/
+
bool close_temporary_table(THD *thd, const char *db, const char *table_name)
{
TABLE *table,**prev;
@@ -1045,6 +1070,11 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name)
return 1;
table= *prev;
*prev= table->next;
+ /*
+ If LOCK TABLES list is not empty and contains this table,
+ unlock the table and remove the table from this list.
+ */
+ mysql_lock_remove(thd, thd->locked_tables, table, FALSE);
close_temporary(table, 1);
if (thd->slave_thread)
--slave_open_temp_tables;
@@ -1120,7 +1150,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
!memcmp(list->s->table_cache_key, key, key_length))
{
if (thd->locked_tables)
- mysql_lock_remove(thd, thd->locked_tables,list);
+ mysql_lock_remove(thd, thd->locked_tables, list, TRUE);
VOID(hash_delete(&open_cache,(byte*) list)); // Close table
}
else
@@ -1151,6 +1181,8 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
dropped is already unlocked. In the former case it will
also remove lock on the table. But one should not rely on
this behaviour as it may change in future.
+ Currently, however, this function is never called for a
+ table that was locked with LOCK TABLES.
*/
void drop_open_table(THD *thd, TABLE *table, const char *db_name,
@@ -2099,7 +2131,7 @@ bool close_data_tables(THD *thd,const char *db, const char *table_name)
if (!strcmp(table->s->table_name, table_name) &&
!strcmp(table->s->db, db))
{
- mysql_lock_remove(thd, thd->locked_tables,table);
+ mysql_lock_remove(thd, thd->locked_tables, table, TRUE);
table->file->close();
table->db_stat=0;
}
@@ -2239,7 +2271,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool morph_locks,
instances of this table.
*/
mysql_lock_abort(thd, table);
- mysql_lock_remove(thd, thd->locked_tables, table);
+ mysql_lock_remove(thd, thd->locked_tables, table, TRUE);
/*
We want to protect the table from concurrent DDL operations
(like RENAME TABLE) until we will re-open and re-lock it.
@@ -2343,7 +2375,7 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name)
if (!strcmp(table->s->table_name, table_name) &&
!strcmp(table->s->db, db))
{
- mysql_lock_remove(thd, thd->locked_tables,table);
+ mysql_lock_remove(thd, thd->locked_tables, table, TRUE);
VOID(hash_delete(&open_cache,(byte*) table));
found=1;
}
@@ -2674,7 +2706,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
*/
for (tables= *start; tables ;tables= tables->next_global)
{
- safe_to_ignore_table= FALSE; // 'FALSE', as per coding style
+ safe_to_ignore_table= FALSE;
if (tables->lock_type == TL_WRITE_DEFAULT)
{
@@ -2938,13 +2970,6 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
if (table)
{
-#if defined( __WIN__) || defined(OS2)
- /* Win32 can't drop a file that is open */
- if (lock_type == TL_WRITE_ALLOW_READ)
- {
- lock_type= TL_WRITE;
- }
-#endif /* __WIN__ || OS2 */
table_list->lock_type= lock_type;
table_list->table= table;
table->grant= table_list->grant;
@@ -3435,7 +3460,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
table_list->alias, name, item_name, (ulong) ref));
Field_iterator_view field_it;
field_it.set(table_list);
- Query_arena *arena, backup;
+ Query_arena *arena= 0, backup;
DBUG_ASSERT(table_list->schema_table_reformed ||
(ref != 0 && table_list->view != 0));
@@ -3444,14 +3469,14 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
if (!my_strcasecmp(system_charset_info, field_it.name(), name))
{
// in PS use own arena or data will be freed after prepare
- if (register_tree_change)
+ if (register_tree_change && thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
arena= thd->activate_stmt_arena_if_needed(&backup);
/*
create_item() may, or may not create a new Item, depending on
the column reference. See create_view_field() for details.
*/
Item *item= field_it.create_item(thd);
- if (register_tree_change && arena)
+ if (arena)
thd->restore_active_arena(arena, &backup);
if (!item)
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index ee4e1ea149c..b67f63778dc 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -173,6 +173,7 @@ THD::THD()
Open_tables_state(refresh_version),
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
+ transaction_rollback_request(0), is_fatal_sub_stmt_error(0),
rand_used(0), time_zone_used(0),
last_insert_id_used(0), last_insert_id_used_bin_log(0), insert_id_used(0),
clear_next_insert_id(0), in_lock_tables(0), bootstrap(0),
@@ -197,7 +198,7 @@ THD::THD()
count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED;
db_length= col_access=0;
- query_error= tmp_table_used= 0;
+ query_error= tmp_table_used= thread_specific_used= 0;
next_insert_id=last_insert_id=0;
hash_clear(&handler_tables_hash);
tmp_table=0;
@@ -339,7 +340,7 @@ void THD::init(void)
if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;
options= thd_startup_options;
- no_trans_update.stmt= no_trans_update.all= FALSE;
+ transaction.all.modified_non_trans_table= transaction.stmt.modified_non_trans_table= FALSE;
open_options=ha_open_options;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
@@ -976,7 +977,7 @@ void select_send::abort()
{
DBUG_ENTER("select_send::abort");
if (status && thd->spcont &&
- thd->spcont->find_handler(thd->net.last_errno,
+ thd->spcont->find_handler(thd, thd->net.last_errno,
MYSQL_ERROR::WARN_LEVEL_ERROR))
{
/*
@@ -2211,6 +2212,13 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
limit_found_rows= backup->limit_found_rows;
sent_row_count= backup->sent_row_count;
client_capabilities= backup->client_capabilities;
+ /*
+ If we've left sub-statement mode, reset the fatal error flag.
+ Otherwise keep the current value, to propagate it up the sub-statement
+ stack.
+ */
+ if (!in_sub_stmt)
+ is_fatal_sub_stmt_error= FALSE;
if ((options & OPTION_BIN_LOG) && is_update_query(lex->sql_command))
mysql_bin_log.stop_union_events(this);
@@ -2224,6 +2232,18 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
}
+/**
+ Mark transaction to rollback and mark error as fatal to a sub-statement.
+
+ @param thd Thread handle
+ @param all TRUE <=> rollback main transaction.
+*/
+
+void mark_transaction_to_rollback(THD *thd, bool all)
+{
+ thd->is_fatal_sub_stmt_error= TRUE;
+ thd->transaction_rollback_request= all;
+}
/***************************************************************************
Handling of XA id cacheing
***************************************************************************/
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 445a3ce437c..4fac86dc405 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -450,7 +450,7 @@ public:
Table_ident *table, List<key_part_spec> &ref_cols,
uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
:Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, 0, cols),
- ref_table(table), ref_columns(cols),
+ ref_table(table), ref_columns(ref_cols),
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
match_opt(match_opt_arg)
{}
@@ -995,13 +995,25 @@ enum prelocked_mode_type {NON_PRELOCKED= 0, PRELOCKED= 1,
class Open_tables_state
{
public:
- /*
- open_tables - list of regular tables in use by this thread
- temporary_tables - list of temp tables in use by this thread
- handler_tables - list of tables that were opened with HANDLER OPEN
- and are still in use by this thread
+ /**
+ List of regular tables in use by this thread. Contains temporary and
+ base tables that were opened with @see open_tables().
+ */
+ TABLE *open_tables;
+ /**
+ List of temporary tables used by this thread. Contains user-level
+ temporary tables, created with CREATE TEMPORARY TABLE, and
+ internal temporary tables, created, e.g., to resolve a SELECT,
+ or for an intermediate table used in ALTER.
+ XXX Why are internal temporary tables added to this list?
*/
- TABLE *open_tables, *temporary_tables, *handler_tables, *derived_tables;
+ TABLE *temporary_tables;
+ /**
+ List of tables that were opened with HANDLER OPEN and are
+ still in use by this thread.
+ */
+ TABLE *handler_tables;
+ TABLE *derived_tables;
/*
During a MySQL session, one can lock tables in two modes: automatic
or manual. In automatic mode all necessary tables are locked just before
@@ -1421,7 +1433,33 @@ public:
bool slave_thread, one_shot_set;
bool locked, some_tables_deleted;
bool last_cuted_field;
- bool no_errors, password, is_fatal_error;
+ bool no_errors, password;
+ /**
+ Set to TRUE if execution of the current compound statement
+ can not continue. In particular, disables activation of
+ CONTINUE or EXIT handlers of stored routines.
+ Reset in the end of processing of the current user request, in
+ @see mysql_reset_thd_for_next_command().
+ */
+ bool is_fatal_error;
+ /**
+ Set by a storage engine to request the entire
+ transaction (that possibly spans multiple engines) to
+ rollback. Reset in ha_rollback.
+ */
+ bool transaction_rollback_request;
+ /**
+ TRUE if we are in a sub-statement and the current error can
+ not be safely recovered until we left the sub-statement mode.
+ In particular, disables activation of CONTINUE and EXIT
+ handlers inside sub-statements. E.g. if it is a deadlock
+ error and requires a transaction-wide rollback, this flag is
+ raised (traditionally, MySQL first has to close all the reads
+ via @see handler::ha_index_or_rnd_end() and only then perform
+ the rollback).
+ Reset to FALSE when we leave the sub-statement mode.
+ */
+ bool is_fatal_sub_stmt_error;
bool query_start_used, rand_used, time_zone_used;
/*
@@ -1457,13 +1495,12 @@ public:
bool in_lock_tables;
bool query_error, bootstrap, cleanup_done;
bool tmp_table_used;
+
+ /** is set if some thread specific value(s) used in a statement. */
+ bool thread_specific_used;
bool charset_is_system_charset, charset_is_collation_connection;
bool charset_is_character_set_filesystem;
bool enable_slow_log; /* enable slow log for current statement */
- struct {
- bool all:1;
- bool stmt:1;
- } no_trans_update;
bool abort_on_warning;
bool got_warning; /* Set on call to push_warning() */
bool no_warnings_for_error; /* no warnings on call to my_error() */
@@ -1714,7 +1751,7 @@ public:
inline bool really_abort_on_warning()
{
return (abort_on_warning &&
- (!no_trans_update.stmt ||
+ (!transaction.stmt.modified_non_trans_table ||
(variables.sql_mode & MODE_STRICT_ALL_TABLES)));
}
void set_status_var_init();
@@ -2397,3 +2434,5 @@ public:
/* Functions in sql_class.cc */
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
+void mark_transaction_to_rollback(THD *thd, bool all);
+
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index bccd4d4cafe..56edfa6c5b2 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -315,6 +315,9 @@ cleanup:
delete select;
transactional_table= table->file->has_transactions();
+ if (!transactional_table && deleted > 0)
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
+
/* See similar binlogging code in sql_update.cc, for comments */
if ((error < 0) || (deleted && !transactional_table))
{
@@ -327,9 +330,10 @@ cleanup:
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1;
}
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
if (transactional_table)
{
@@ -642,20 +646,22 @@ bool multi_delete::send_data(List<Item> &values)
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
table->status|= STATUS_DELETED;
if (!(error=table->file->delete_row(table->record[0])))
{
- deleted++;
+ deleted++;
+ if (!table->file->has_transactions())
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE))
- DBUG_RETURN(1);
+ DBUG_RETURN(1);
}
else
{
- table->file->print_error(error,MYF(0));
- DBUG_RETURN(1);
+ table->file->print_error(error,MYF(0));
+ DBUG_RETURN(1);
}
}
else
@@ -705,6 +711,7 @@ void multi_delete::send_error(uint errcode,const char *err)
error= 1;
send_eof();
}
+ DBUG_ASSERT(!normal_tables || !deleted || thd->transaction.stmt.modified_non_trans_table);
DBUG_VOID_RETURN;
}
@@ -732,6 +739,7 @@ int multi_delete::do_deletes()
for (; table_being_deleted;
table_being_deleted= table_being_deleted->next_local, counter++)
{
+ ha_rows last_deleted= deleted;
TABLE *table = table_being_deleted->table;
if (tempfiles[counter]->get(table))
{
@@ -769,6 +777,8 @@ int multi_delete::do_deletes()
break;
}
}
+ if (last_deleted != deleted && !table->file->has_transactions())
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
end_read_record(&info);
if (thd->killed && !local_error)
local_error= 1;
@@ -807,7 +817,6 @@ bool multi_delete::send_eof()
{
query_cache_invalidate3(thd, delete_tables, 1);
}
-
if ((local_error == 0) || (deleted && normal_tables))
{
if (mysql_bin_log.is_open())
@@ -819,9 +828,11 @@ bool multi_delete::send_eof()
if (mysql_bin_log.write(&qinfo) && !normal_tables)
local_error=1; // Log write failed: roll back the SQL statement
}
- if (!transactional_tables)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(!normal_tables || !deleted || thd->transaction.stmt.modified_non_trans_table);
+
/* Commit or rollback the current SQL statement */
if (transactional_tables)
if (ha_autocommit_or_rollback(thd,local_error > 0))
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 73f8c5e4418..5edce08e481 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -560,6 +560,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
int error, res;
bool transactional_table, joins_freed= FALSE;
bool changed;
+ bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED);
uint value_count;
ulong counter = 1;
ulonglong id;
@@ -732,7 +733,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
table->file->start_bulk_insert(values_list.elements);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
@@ -859,14 +859,16 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
transactional_table= table->file->has_transactions();
- if ((changed= (info.copied || info.deleted || info.updated)))
+ if ((changed= (info.copied || info.deleted || info.updated)) ||
+ was_insert_delayed)
{
/*
Invalidate the table in the query cache if something changed.
For the transactional algorithm to work the invalidation must be
before binlog writing and ha_autocommit_or_rollback
*/
- query_cache_invalidate3(thd, table_list, 1);
+ if (changed)
+ query_cache_invalidate3(thd, table_list, 1);
if (error <= 0 || !transactional_table)
{
if (mysql_bin_log.is_open())
@@ -904,10 +906,12 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1;
}
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
}
+ DBUG_ASSERT(transactional_table || !changed ||
+ thd->transaction.stmt.modified_non_trans_table);
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
@@ -1308,7 +1312,7 @@ static int last_uniq_key(TABLE *table,uint keynr)
then both on update triggers will work instead. Similarly both on
delete triggers will be invoked if we will delete conflicting records.
- Sets thd->no_trans_update.stmt to TRUE if table which is updated didn't have
+ Sets thd->transaction.stmt.modified_non_trans_table to TRUE if table which is updated didn't have
transactions.
RETURN VALUE
@@ -1475,7 +1479,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto err;
info->deleted++;
if (!table->file->has_transactions())
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, TRUE))
@@ -1507,7 +1511,7 @@ ok_or_after_trg_err:
if (key)
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
if (!table->file->has_transactions())
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
DBUG_RETURN(trg_error);
err:
@@ -1702,18 +1706,18 @@ Delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
thd->proc_info="waiting for delay_list";
pthread_mutex_lock(&LOCK_delayed_insert); // Protect master list
I_List_iterator<Delayed_insert> it(delayed_threads);
- Delayed_insert *tmp;
- while ((tmp=it++))
+ Delayed_insert *di;
+ while ((di= it++))
{
- if (!strcmp(tmp->thd.db,table_list->db) &&
- !strcmp(table_list->table_name,tmp->table->s->table_name))
+ if (!strcmp(table_list->db, di->table_list.db) &&
+ !strcmp(table_list->table_name, di->table_list.table_name))
{
- tmp->lock();
+ di->lock();
break;
}
}
pthread_mutex_unlock(&LOCK_delayed_insert); // For unlink from list
- return tmp;
+ return di;
}
@@ -1739,21 +1743,41 @@ Delayed_insert *find_handler(THD *thd, TABLE_LIST *table_list)
Two latter cases indicate a request for lock upgrade.
XXX: why do we regard INSERT DELAYED into a view as an error and
- do not simply a lock upgrade?
+ do not simply perform a lock upgrade?
+
+ TODO: The approach with using two mutexes to work with the
+ delayed thread list -- LOCK_delayed_insert and
+ LOCK_delayed_create -- is redundant, and we only need one of
+ them to protect the list. The reason we have two locks is that
+ we do not want to block look-ups in the list while we're waiting
+ for the newly created thread to open the delayed table. However,
+ this wait itself is redundant -- we always call get_local_table
+ later on, and there wait again until the created thread acquires
+ a table lock.
+
+ As is redundant the concept of locks_in_memory, since we already
+ have another counter with similar semantics - tables_in_use,
+ both of them are devoted to counting the number of producers for
+ a given consumer (delayed insert thread), only at different
+ stages of producer-consumer relationship.
+
+ 'dead' and 'status' variables in Delayed_insert are redundant
+ too, since there is already 'di->thd.killed' and
+ di->stacked_inserts.
*/
static
bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
{
int error;
- Delayed_insert *tmp;
+ Delayed_insert *di;
DBUG_ENTER("delayed_get_table");
/* Must be set in the parser */
DBUG_ASSERT(table_list->db);
/* Find the thread which handles this table. */
- if (!(tmp=find_handler(thd,table_list)))
+ if (!(di= find_handler(thd, table_list)))
{
/*
No match. Create a new thread to handle the table, but
@@ -1767,9 +1791,9 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
The first search above was done without LOCK_delayed_create.
Another thread might have created the handler in between. Search again.
*/
- if (! (tmp= find_handler(thd, table_list)))
+ if (! (di= find_handler(thd, table_list)))
{
- if (!(tmp=new Delayed_insert()))
+ if (!(di= new Delayed_insert()))
{
my_error(ER_OUTOFMEMORY,MYF(0),sizeof(Delayed_insert));
thd->fatal_error();
@@ -1778,28 +1802,30 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
pthread_mutex_lock(&LOCK_thread_count);
thread_count++;
pthread_mutex_unlock(&LOCK_thread_count);
- tmp->thd.set_db(table_list->db, strlen(table_list->db));
- tmp->thd.query= my_strdup(table_list->table_name,MYF(MY_WME));
- if (tmp->thd.db == NULL || tmp->thd.query == NULL)
+ di->thd.set_db(table_list->db, strlen(table_list->db));
+ di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME));
+ if (di->thd.db == NULL || di->thd.query == NULL)
{
/* The error is reported */
- delete tmp;
+ delete di;
thd->fatal_error();
goto end_create;
}
- tmp->table_list= *table_list; // Needed to open table
- tmp->table_list.alias= tmp->table_list.table_name= tmp->thd.query;
- tmp->lock();
- pthread_mutex_lock(&tmp->mutex);
- if ((error=pthread_create(&tmp->thd.real_id,&connection_attrib,
- handle_delayed_insert,(void*) tmp)))
+ di->table_list= *table_list; // Needed to open table
+ /* Replace volatile strings with local copies */
+ di->table_list.alias= di->table_list.table_name= di->thd.query;
+ di->table_list.db= di->thd.db;
+ di->lock();
+ pthread_mutex_lock(&di->mutex);
+ if ((error= pthread_create(&di->thd.real_id, &connection_attrib,
+ handle_delayed_insert, (void*) di)))
{
DBUG_PRINT("error",
("Can't create thread to handle delayed insert (error %d)",
error));
- pthread_mutex_unlock(&tmp->mutex);
- tmp->unlock();
- delete tmp;
+ pthread_mutex_unlock(&di->mutex);
+ di->unlock();
+ delete di;
my_error(ER_CANT_CREATE_THREAD, MYF(0), error);
thd->fatal_error();
goto end_create;
@@ -1807,15 +1833,15 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
/* Wait until table is open */
thd->proc_info="waiting for handler open";
- while (!tmp->thd.killed && !tmp->table && !thd->killed)
+ while (!di->thd.killed && !di->table && !thd->killed)
{
- pthread_cond_wait(&tmp->cond_client,&tmp->mutex);
+ pthread_cond_wait(&di->cond_client, &di->mutex);
}
- pthread_mutex_unlock(&tmp->mutex);
+ pthread_mutex_unlock(&di->mutex);
thd->proc_info="got old table";
- if (tmp->thd.killed)
+ if (di->thd.killed)
{
- if (tmp->thd.net.report_error)
+ if (di->thd.net.report_error)
{
/*
Copy the error message. Note that we don't treat fatal
@@ -1823,31 +1849,34 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
main thread. Use of my_message will enable stored
procedures continue handlers.
*/
- my_message(tmp->thd.net.last_errno, tmp->thd.net.last_error,
+ my_message(di->thd.net.last_errno, di->thd.net.last_error,
MYF(0));
}
- tmp->unlock();
+ di->unlock();
goto end_create;
}
if (thd->killed)
{
- tmp->unlock();
+ di->unlock();
goto end_create;
}
+ pthread_mutex_lock(&LOCK_delayed_insert);
+ delayed_threads.append(di);
+ pthread_mutex_unlock(&LOCK_delayed_insert);
}
pthread_mutex_unlock(&LOCK_delayed_create);
}
- pthread_mutex_lock(&tmp->mutex);
- table_list->table= tmp->get_local_table(thd);
- pthread_mutex_unlock(&tmp->mutex);
+ pthread_mutex_lock(&di->mutex);
+ table_list->table= di->get_local_table(thd);
+ pthread_mutex_unlock(&di->mutex);
if (table_list->table)
{
DBUG_ASSERT(thd->net.report_error == 0);
- thd->di=tmp;
+ thd->di= di;
}
/* Unlock the delayed insert object after its last access. */
- tmp->unlock();
+ di->unlock();
DBUG_RETURN(table_list->table == NULL);
end_create:
@@ -2077,26 +2106,26 @@ void kill_delayed_threads(void)
VOID(pthread_mutex_lock(&LOCK_delayed_insert)); // For unlink from list
I_List_iterator<Delayed_insert> it(delayed_threads);
- Delayed_insert *tmp;
- while ((tmp=it++))
+ Delayed_insert *di;
+ while ((di= it++))
{
- tmp->thd.killed= THD::KILL_CONNECTION;
- if (tmp->thd.mysys_var)
+ di->thd.killed= THD::KILL_CONNECTION;
+ if (di->thd.mysys_var)
{
- pthread_mutex_lock(&tmp->thd.mysys_var->mutex);
- if (tmp->thd.mysys_var->current_cond)
+ pthread_mutex_lock(&di->thd.mysys_var->mutex);
+ if (di->thd.mysys_var->current_cond)
{
/*
We need the following test because the main mutex may be locked
in handle_delayed_insert()
*/
- if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
- pthread_mutex_lock(tmp->thd.mysys_var->current_mutex);
- pthread_cond_broadcast(tmp->thd.mysys_var->current_cond);
- if (&tmp->mutex != tmp->thd.mysys_var->current_mutex)
- pthread_mutex_unlock(tmp->thd.mysys_var->current_mutex);
+ if (&di->mutex != di->thd.mysys_var->current_mutex)
+ pthread_mutex_lock(di->thd.mysys_var->current_mutex);
+ pthread_cond_broadcast(di->thd.mysys_var->current_cond);
+ if (&di->mutex != di->thd.mysys_var->current_mutex)
+ pthread_mutex_unlock(di->thd.mysys_var->current_mutex);
}
- pthread_mutex_unlock(&tmp->thd.mysys_var->mutex);
+ pthread_mutex_unlock(&di->thd.mysys_var->mutex);
}
}
VOID(pthread_mutex_unlock(&LOCK_delayed_insert)); // For unlink from list
@@ -2176,11 +2205,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
}
di->table->copy_blobs=1;
- /* One can now use this */
- pthread_mutex_lock(&LOCK_delayed_insert);
- delayed_threads.append(di);
- pthread_mutex_unlock(&LOCK_delayed_insert);
-
/* Tell client that the thread is initialized */
pthread_cond_signal(&di->cond_client);
@@ -2767,7 +2791,6 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
if (info.handle_duplicates == DUP_UPDATE)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -2904,7 +2927,8 @@ void select_insert::send_error(uint errcode,const char *err)
bool select_insert::send_eof()
{
- int error,error2;
+ int error, error2;
+ bool changed, transactional_table= table->file->has_transactions();
DBUG_ENTER("select_insert::send_eof");
error= (!thd->prelocked_mode) ? table->file->end_bulk_insert():0;
@@ -2916,12 +2940,14 @@ bool select_insert::send_eof()
and ha_autocommit_or_rollback
*/
- if (info.copied || info.deleted || info.updated)
+ if (changed= (info.copied || info.deleted || info.updated))
{
query_cache_invalidate3(thd, table, 1);
- if (!(table->file->has_transactions() || table->s->tmp_table))
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(transactional_table || !changed ||
+ thd->transaction.stmt.modified_non_trans_table);
if (last_insert_id)
thd->insert_id(info.copied ? last_insert_id : 0); // For binary log
@@ -2931,7 +2957,7 @@ bool select_insert::send_eof()
if (!error)
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions(), FALSE);
+ transactional_table, FALSE);
mysql_bin_log.write(&qinfo);
}
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
@@ -2957,6 +2983,7 @@ bool select_insert::send_eof()
void select_insert::abort()
{
+ bool changed, transactional_table;
DBUG_ENTER("select_insert::abort");
if (!table)
@@ -2967,6 +2994,7 @@ void select_insert::abort()
*/
DBUG_VOID_RETURN;
}
+ transactional_table= table->file->has_transactions();
if (!thd->prelocked_mode)
table->file->end_bulk_insert();
/*
@@ -2975,21 +3003,22 @@ void select_insert::abort()
error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop).
*/
- if ((info.copied || info.deleted || info.updated) &&
- !table->file->has_transactions())
+ if ((changed= info.copied || info.deleted || info.updated) &&
+ !transactional_table)
{
if (last_insert_id)
thd->insert_id(last_insert_id); // For binary log
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions(), FALSE);
+ transactional_table, FALSE);
mysql_bin_log.write(&qinfo);
}
- if (!table->s->tmp_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
- if (info.copied || info.deleted || info.updated)
+ DBUG_ASSERT(transactional_table || !changed || thd->transaction.stmt.modified_non_trans_table);
+ if (changed)
{
query_cache_invalidate3(thd, table, 1);
}
@@ -3236,7 +3265,6 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE);
if (!thd->prelocked_mode)
table->file->start_bulk_insert((ha_rows) 0);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c37d77345b6..a62d8b383a5 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2035,12 +2035,129 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl)
/**
- Update the parsed tree with information about triggers that
- may be fired when executing this statement.
+ @brief Set the initial purpose of this TABLE_LIST object in the list of used
+ tables.
+
+ We need to track this information on table-by-table basis, since when this
+ table becomes an element of the pre-locked list, it's impossible to identify
+ which SQL sub-statement it has been originally used in.
+
+ E.g.:
+
+ User request: SELECT * FROM t1 WHERE f1();
+ FUNCTION f1(): DELETE FROM t2; RETURN 1;
+ BEFORE DELETE trigger on t2: INSERT INTO t3 VALUES (old.a);
+
+ For this user request, the pre-locked list will contain t1, t2, t3
+ table elements, each needed for different DML.
+
+ The trigger event map is updated to reflect INSERT, UPDATE, DELETE,
+ REPLACE, LOAD DATA, CREATE TABLE .. SELECT, CREATE TABLE ..
+ REPLACE SELECT statements, and additionally ON DUPLICATE KEY UPDATE
+ clause.
*/
void st_lex::set_trg_event_type_for_tables()
{
+ uint8 new_trg_event_map= 0;
+
+ /*
+ Some auxiliary operations
+ (e.g. GRANT processing) create TABLE_LIST instances outside
+ the parser. Additionally, some commands (e.g. OPTIMIZE) change
+ the lock type for a table only after parsing is done. Luckily,
+ these do not fire triggers and do not need to pre-load them.
+ For these TABLE_LISTs set_trg_event_type is never called, and
+ trg_event_map is always empty. That means that the pre-locking
+ algorithm will ignore triggers defined on these tables, if
+ any, and the execution will either fail with an assert in
+ sql_trigger.cc or with an error that a used table was not
+ pre-locked, in case of a production build.
+
+ TODO: this usage pattern creates unnecessary module dependencies
+ and should be rewritten to go through the parser.
+ Table list instances created outside the parser in most cases
+ refer to mysql.* system tables. It is not allowed to have
+ a trigger on a system table, but keeping track of
+ initialization provides extra safety in case this limitation
+ is circumvented.
+ */
+
+ switch (sql_command) {
+ case SQLCOM_LOCK_TABLES:
+ /*
+ On a LOCK TABLE, all triggers must be pre-loaded for this TABLE_LIST
+ when opening an associated TABLE.
+ */
+ new_trg_event_map= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_INSERT)) |
+ static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_UPDATE)) |
+ static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_DELETE));
+ break;
+ /*
+ Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
+ clause, it will be handled later in this method.
+ */
+ case SQLCOM_INSERT: /* fall through */
+ case SQLCOM_INSERT_SELECT:
+ /*
+ LOAD DATA ... INFILE is expected to fire BEFORE/AFTER INSERT
+ triggers.
+ If the statement also has REPLACE clause, it will be
+ handled later in this method.
+ */
+ case SQLCOM_LOAD: /* fall through */
+ /*
+ REPLACE is semantically equivalent to INSERT. In case
+ of a primary or unique key conflict, it deletes the old
+ record and inserts a new one. So we also may need to
+ fire ON DELETE triggers. This functionality is handled
+ later in this method.
+ */
+ case SQLCOM_REPLACE: /* fall through */
+ case SQLCOM_REPLACE_SELECT:
+ /*
+ CREATE TABLE ... SELECT defaults to INSERT if the table or
+ view already exists. REPLACE option of CREATE TABLE ...
+ REPLACE SELECT is handled later in this method.
+ */
+ case SQLCOM_CREATE_TABLE:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_INSERT));
+ break;
+ /* Basic update and multi-update */
+ case SQLCOM_UPDATE: /* fall through */
+ case SQLCOM_UPDATE_MULTI:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ break;
+ /* Basic delete and multi-delete */
+ case SQLCOM_DELETE: /* fall through */
+ case SQLCOM_DELETE_MULTI:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_DELETE));
+ break;
+ default:
+ break;
+ }
+
+ switch (duplicates) {
+ case DUP_UPDATE:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_UPDATE));
+ break;
+ case DUP_REPLACE:
+ new_trg_event_map|= static_cast<uint8>
+ (1 << static_cast<int>(TRG_EVENT_DELETE));
+ break;
+ case DUP_ERROR:
+ default:
+ break;
+ }
+
+
/*
Do not iterate over sub-selects, only the tables in the outermost
SELECT_LEX can be modified, if any.
@@ -2049,7 +2166,17 @@ void st_lex::set_trg_event_type_for_tables()
while (tables)
{
- tables->set_trg_event_type(this);
+ /*
+ This is a fast check to filter out statements that do
+ not change data, or tables on the right side, in case of
+ INSERT .. SELECT, CREATE TABLE .. SELECT and so on.
+ Here we also filter out OPTIMIZE statement and non-updateable
+ views, for which lock_type is TL_UNLOCK or TL_READ after
+ parsing.
+ */
+ if (static_cast<int>(tables->lock_type) >=
+ static_cast<int>(TL_WRITE_ALLOW_WRITE))
+ tables->trg_event_map= new_trg_event_map;
tables= tables->next_local;
}
}
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7b1799baaad..55cbbf1c540 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -377,7 +377,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->file->start_bulk_insert((ha_rows) 0);
table->copy_blobs=1;
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= (!ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -411,7 +410,6 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
ha_autocommit_...
*/
query_cache_invalidate3(thd, table_list, 0);
-
if (error)
{
if (read_file_from_client)
@@ -466,8 +464,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
sprintf(name, ER(ER_LOAD_INFO), (ulong) info.records, (ulong) info.deleted,
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
{
@@ -488,6 +486,8 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
/* ok to client sent only after binlog write and engine commit */
send_ok(thd, info.copied + info.deleted, 0L, name);
err:
+ DBUG_ASSERT(transactional_table || !(info.copied || info.deleted) ||
+ thd->transaction.stmt.modified_non_trans_table);
if (thd->lock)
{
mysql_unlock_tables(thd, thd->lock);
@@ -532,7 +532,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
Item_field *sql_field;
TABLE *table= table_list->table;
ulonglong id;
- bool no_trans_update_stmt, err;
+ bool err;
DBUG_ENTER("read_fixed_length");
id= 0;
@@ -560,7 +560,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
#ifdef HAVE_purify
read_info.row_end[0]=0;
#endif
- no_trans_update_stmt= !table->file->has_transactions();
restore_record(table, s->default_values);
/*
@@ -630,7 +629,6 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
table->auto_increment_field_not_null= FALSE;
if (err)
DBUG_RETURN(1);
- thd->no_trans_update.stmt= no_trans_update_stmt;
/*
If auto_increment values are used, save the first one for
@@ -673,12 +671,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
TABLE *table= table_list->table;
uint enclosed_length;
ulonglong id;
- bool no_trans_update_stmt, err;
+ bool err;
DBUG_ENTER("read_sep_field");
enclosed_length=enclosed.length();
id= 0;
- no_trans_update_stmt= !table->file->has_transactions();
for (;;it.rewind())
{
@@ -821,7 +818,6 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
We don't need to reset auto-increment field since we are restoring
its default value at the beginning of each loop iteration.
*/
- thd->no_trans_update.stmt= no_trans_update_stmt;
if (read_info.next_line()) // Skip to next line
break;
if (read_info.line_cuted)
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ae3bc0f5597..25ead88ac53 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -149,7 +149,7 @@ static bool end_active_trans(THD *thd)
if (ha_commit(thd))
error=1;
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
}
DBUG_RETURN(error);
}
@@ -173,7 +173,7 @@ static bool begin_trans(THD *thd)
else
{
LEX *lex= thd->lex;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->options|= (ulong) OPTION_BEGIN;
thd->server_status|= SERVER_STATUS_IN_TRANS;
if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
@@ -1471,7 +1471,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
res= ha_commit(thd);
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
break;
case COMMIT_RELEASE:
do_release= 1; /* fall through */
@@ -1489,7 +1489,7 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
if (ha_rollback(thd))
res= -1;
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
if (!res && (completion == ROLLBACK_AND_CHAIN))
res= begin_trans(thd);
break;
@@ -2600,6 +2600,8 @@ mysql_execute_command(THD *thd)
statistic_increment(thd->status_var.com_stat[lex->sql_command],
&LOCK_status);
+ DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
+
switch (lex->sql_command) {
case SQLCOM_SELECT:
{
@@ -2937,7 +2939,7 @@ mysql_execute_command(THD *thd)
else
{
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
- thd->no_trans_update.all= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
DBUG_ASSERT(first_table == all_tables && first_table != 0);
bool link_to_local;
@@ -3720,7 +3722,7 @@ end_with_restore_list:
lex->drop_if_exists= 1;
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
- thd->no_trans_update.all= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
/* DDL and binlog write order protected by LOCK_open */
res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
@@ -4322,7 +4324,7 @@ end_with_restore_list:
res= TRUE; // cannot happen
else
{
- if (thd->no_trans_update.all &&
+ if (thd->transaction.all.modified_non_trans_table &&
!thd->slave_thread)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARNING_NOT_COMPLETE_ROLLBACK,
@@ -4969,7 +4971,7 @@ create_sp_error:
thd->transaction.xid_state.xa_state=XA_ACTIVE;
thd->transaction.xid_state.xid.set(thd->lex->xid);
xid_cache_insert(&thd->transaction.xid_state);
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->options|= (ulong) OPTION_BEGIN;
thd->server_status|= SERVER_STATUS_IN_TRANS;
send_ok(thd);
@@ -5064,7 +5066,7 @@ create_sp_error:
break;
}
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state=XA_NOTR;
@@ -5095,7 +5097,7 @@ create_sp_error:
else
send_ok(thd);
thd->options&= ~(ulong) OPTION_BEGIN;
- thd->no_trans_update.all= FALSE;
+ thd->transaction.all.modified_non_trans_table= FALSE;
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
xid_cache_delete(&thd->transaction.xid_state);
thd->transaction.xid_state.xa_state=XA_NOTR;
@@ -5845,6 +5847,7 @@ void mysql_reset_thd_for_next_command(THD *thd)
SERVER_QUERY_NO_GOOD_INDEX_USED);
DBUG_ASSERT(thd->security_ctx== &thd->main_security_ctx);
thd->tmp_table_used= 0;
+ thd->thread_specific_used= FALSE;
if (!thd->in_sub_stmt)
{
if (opt_bin_log)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index d8bf8466f58..ac8dc84f118 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1121,6 +1121,7 @@ JOIN::optimize()
order=0; // The output has only one row
simple_order=1;
select_distinct= 0; // No need in distinct for 1 row
+ group_optimized_away= 1;
}
calc_group_buffer(this, group_list);
@@ -2416,7 +2417,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if ((table->s->system || table->file->records <= 1) && ! s->dependent &&
!(table->file->table_flags() & HA_NOT_EXACT_COUNT) &&
- !table->fulltext_searched)
+ !table->fulltext_searched && !join->no_const_tables)
{
set_position(join,const_count++,s,(KEYUSE*) 0);
}
@@ -11461,7 +11462,8 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if (!join->first_record || end_of_records ||
(idx=test_if_group_changed(join->group_fields)) >= 0)
{
- if (join->first_record || (end_of_records && !join->group))
+ if (join->first_record ||
+ (end_of_records && !join->group && !join->group_optimized_away))
{
if (join->procedure)
join->procedure->end_group();
@@ -12009,6 +12011,7 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
key_part_end=key_part+table->key_info[idx].key_parts;
key_part_map const_key_parts=table->const_key_parts[idx];
int reverse=0;
+ my_bool on_primary_key= FALSE;
DBUG_ENTER("test_if_order_by_key");
for (; order ; order=order->next, const_key_parts>>=1)
@@ -12023,7 +12026,30 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
for (; const_key_parts & 1 ; const_key_parts>>= 1)
key_part++;
- if (key_part == key_part_end || key_part->field != field)
+ if (key_part == key_part_end)
+ {
+ /*
+ We are at the end of the key. Check if the engine has the primary
+ key as a suffix to the secondary keys. If it has continue to check
+ the primary key as a suffix.
+ */
+ if (!on_primary_key &&
+ (table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
+ table->s->primary_key != MAX_KEY)
+ {
+ on_primary_key= TRUE;
+ key_part= table->key_info[table->s->primary_key].key_part;
+ key_part_end=key_part+table->key_info[table->s->primary_key].key_parts;
+ const_key_parts=table->const_key_parts[table->s->primary_key];
+
+ for (; const_key_parts & 1 ; const_key_parts>>= 1)
+ key_part++;
+ }
+ else
+ DBUG_RETURN(0);
+ }
+
+ if (key_part->field != field)
DBUG_RETURN(0);
/* set flag to 1 if we can use read-next on key, else to -1 */
@@ -12034,7 +12060,8 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
reverse=flag; // Remember if reverse
key_part++;
}
- *used_key_parts= (uint) (key_part - table->key_info[idx].key_part);
+ *used_key_parts= on_primary_key ? table->key_info[idx].key_parts :
+ (uint) (key_part - table->key_info[idx].key_part);
if (reverse == -1 && !(table->file->index_flags(idx, *used_key_parts-1, 1) &
HA_READ_PREV))
reverse= 0; // Index can't be used
@@ -12738,7 +12765,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
field_count++;
}
- if (!field_count && !(join->select_options & OPTION_FOUND_ROWS))
+ if (!field_count && !(join->select_options & OPTION_FOUND_ROWS) && !having)
{ // only const items with no OPTION_FOUND_ROWS
join->unit->select_limit_cnt= 1; // Only send first row
DBUG_RETURN(0);
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4f9f6e9ed48..d84fbcb8c2d 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -277,11 +277,27 @@ public:
SELECT_LEX_UNIT *unit;
// select that processed
SELECT_LEX *select_lex;
+ /*
+ TRUE <=> optimizer must not mark any table as a constant table.
+ This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..):
+ when we optimize the select that reads the results of the union from a
+ temporary table, we must not mark the temp. table as constant because
+ the number of rows in it may vary from one subquery execution to another.
+ */
+ bool no_const_tables;
JOIN *tmp_join; // copy of this JOIN to be used with temporary tables
ROLLUP rollup; // Used with rollup
bool select_distinct; // Set if SELECT DISTINCT
+ /*
+ If we have the GROUP BY statement in the query,
+ but the group_list was emptied by optimizer, this
+ flag is TRUE.
+ It happens when fields in the GROUP BY are from
+ constant table
+ */
+ bool group_optimized_away;
/*
simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
@@ -390,6 +406,7 @@ public:
zero_result_cause= 0;
optimized= 0;
cond_equal= 0;
+ group_optimized_away= 0;
all_fields= fields_arg;
fields_list= fields_arg;
@@ -397,6 +414,8 @@ public:
tmp_table_param.init();
tmp_table_param.end_write_records= HA_POS_ERROR;
rollup.state= ROLLUP::STATE_NONE;
+
+ no_const_tables= FALSE;
}
int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index b91412390bc..05a847b3830 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3211,7 +3211,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
Item *item;
Item_field *field;
/*
- chech that at least one coulmn in view is updatable
+ check that at least one column in view is updatable
*/
while ((item= it++))
{
@@ -3222,6 +3222,8 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
break;
}
}
+ if (updatable_view && !tables->view->can_be_merged())
+ updatable_view= 0;
}
if (updatable_view)
table->field[5]->store(STRING_WITH_LEN("YES"), cs);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6adb1872c17..18c58d3a36a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3793,11 +3793,9 @@ view_err:
{
VOID(pthread_mutex_lock(&LOCK_open));
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- table->file->external_lock(thd, F_WRLCK);
+ VOID(pthread_mutex_unlock(&LOCK_open));
alter_table_manage_keys(table, table->file->indexes_are_disabled(),
alter_info->keys_onoff);
- table->file->external_lock(thd, F_UNLCK);
- VOID(pthread_mutex_unlock(&LOCK_open));
error= ha_commit_stmt(thd);
if (ha_commit(thd))
error= 1;
@@ -3815,7 +3813,7 @@ view_err:
The following function call will free the new_table pointer,
in close_temporary_table(), so we can safely directly jump to err
*/
- close_temporary_table(thd,new_db,tmp_name);
+ close_temporary_table(thd, new_db, tmp_name);
goto err;
}
/* Close lock if this is a transactional table */
@@ -4088,14 +4086,13 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if (!(copy= new Copy_field[to->s->fields]))
DBUG_RETURN(-1); /* purecov: inspected */
- if (to->file->external_lock(thd, F_WRLCK))
+ if (to->file->ha_external_lock(thd, F_WRLCK))
DBUG_RETURN(-1);
/* We need external lock before we can disable/enable keys */
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
/* We can abort alter table for any table type */
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES));
@@ -4240,7 +4237,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
free_io_cache(from);
*copied= found_count;
*deleted=delete_count;
- if (to->file->external_lock(thd,F_UNLCK))
+ if (to->file->ha_external_lock(thd,F_UNLCK))
error=1;
DBUG_RETURN(error > 0 ? -1 : 0);
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 373b03d45e6..25a0540e4dd 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -545,6 +545,10 @@ bool st_select_lex_unit::exec()
/*
allocate JOIN for fake select only once (prevent
mysql_select automatic allocation)
+ TODO: The above is nonsense. mysql_select() will not allocate the
+ join if one already exists. There must be some other reason why we
+ don't let it allocate the join. Perhaps this is because we need
+ some special parameter values passed to join constructor?
*/
if (!(fake_select_lex->join= new JOIN(thd, item_list,
fake_select_lex->options, result)))
@@ -552,33 +556,52 @@ bool st_select_lex_unit::exec()
fake_select_lex->table_list.empty();
DBUG_RETURN(TRUE);
}
+ fake_select_lex->join->no_const_tables= TRUE;
/*
Fake st_select_lex should have item list for correctref_array
allocation.
*/
fake_select_lex->item_list= item_list;
+ saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
+ &result_table_list,
+ 0, item_list, NULL,
+ global_parameters->order_list.elements,
+ (ORDER*)global_parameters->order_list.first,
+ (ORDER*) NULL, NULL, (ORDER*) NULL,
+ fake_select_lex->options | SELECT_NO_UNLOCK,
+ result, this, fake_select_lex);
}
else
{
- JOIN_TAB *tab,*end;
- for (tab=join->join_tab, end=tab+join->tables ;
- tab && tab != end ;
- tab++)
- {
- delete tab->select;
- delete tab->quick;
- }
- join->init(thd, item_list, fake_select_lex->options, result);
+ if (describe)
+ {
+ /*
+ In EXPLAIN command, constant subqueries that do not use any
+ tables are executed two times:
+ - 1st time is a real evaluation to get the subquery value
+ - 2nd time is to produce EXPLAIN output rows.
+ 1st execution sets certain members (e.g. select_result) to perform
+ subquery execution rather than EXPLAIN line production. In order
+ to reset them back, we re-do all of the actions (yes it is ugly):
+ */
+ join->init(thd, item_list, fake_select_lex->options, result);
+ saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
+ &result_table_list,
+ 0, item_list, NULL,
+ global_parameters->order_list.elements,
+ (ORDER*)global_parameters->order_list.first,
+ (ORDER*) NULL, NULL, (ORDER*) NULL,
+ fake_select_lex->options | SELECT_NO_UNLOCK,
+ result, this, fake_select_lex);
+ }
+ else
+ {
+ join->examined_rows= 0;
+ saved_error= join->reinit();
+ join->exec();
+ }
}
- saved_error= mysql_select(thd, &fake_select_lex->ref_pointer_array,
- &result_table_list,
- 0, item_list, NULL,
- global_parameters->order_list.elements,
- (ORDER*)global_parameters->order_list.first,
- (ORDER*) NULL, NULL, (ORDER*) NULL,
- fake_select_lex->options | SELECT_NO_UNLOCK,
- result, this, fake_select_lex);
fake_select_lex->table_list.empty();
if (!saved_error)
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index f4239afc4cd..c78e246f518 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -430,7 +430,6 @@ int mysql_update(THD *thd,
query_id=thd->query_id;
transactional_table= table->file->has_transactions();
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= test(!ignore &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
@@ -487,7 +486,6 @@ int mysql_update(THD *thd,
(byte*) table->record[0])))
{
updated++;
- thd->no_trans_update.stmt= !transactional_table;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
@@ -522,6 +520,10 @@ int mysql_update(THD *thd,
thd->row_count++;
}
+ if (!transactional_table && updated > 0)
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
+
+
/*
todo bug#27571: to avoid asynchronization of `error' and
`error_code' of binlog event constructor
@@ -589,9 +591,10 @@ int mysql_update(THD *thd,
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1; // Rollback update
}
- if (!transactional_table)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
+ DBUG_ASSERT(transactional_table || !updated || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
if (transactional_table)
{
@@ -955,7 +958,6 @@ bool mysql_multi_update(THD *thd,
handle_duplicates, ignore)))
DBUG_RETURN(TRUE);
- thd->no_trans_update.stmt= FALSE;
thd->abort_on_warning= test(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES));
@@ -1331,9 +1333,8 @@ multi_update::~multi_update()
if (copy_field)
delete [] copy_field;
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
- if (!trans_safe) // todo: remove since redundant
- thd->no_trans_update.all= TRUE;
- DBUG_ASSERT(trans_safe || thd->no_trans_update.all);
+ DBUG_ASSERT(trans_safe || !updated ||
+ thd->transaction.all.modified_non_trans_table);
}
@@ -1426,7 +1427,7 @@ bool multi_update::send_data(List<Item> &not_used_values)
else
{
trans_safe= 0;
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
}
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
@@ -1489,7 +1490,6 @@ void multi_update::send_error(uint errcode,const char *err)
/* Something already updated so we have to invalidate cache */
query_cache_invalidate3(thd, update_tables, 1);
-
/*
If all tables that has been updated are trans safe then just do rollback.
If not attempt to do remaining updates.
@@ -1502,7 +1502,7 @@ void multi_update::send_error(uint errcode,const char *err)
}
else
{
- DBUG_ASSERT(thd->no_trans_update.stmt);
+ DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table);
if (do_update && table_count > 1)
{
/* Add warning here */
@@ -1513,7 +1513,7 @@ void multi_update::send_error(uint errcode,const char *err)
VOID(do_updates(0));
}
}
- if (thd->no_trans_update.stmt)
+ if (thd->transaction.stmt.modified_non_trans_table)
{
/*
The query has to binlog because there's a modified non-transactional table
@@ -1526,9 +1526,9 @@ void multi_update::send_error(uint errcode,const char *err)
mysql_bin_log.write(&qinfo);
}
if (!trans_safe)
- thd->no_trans_update.all= TRUE;
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
- DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
+ DBUG_ASSERT(trans_safe || !updated || thd->transaction.stmt.modified_non_trans_table);
if (transactional_tables)
{
@@ -1664,7 +1664,7 @@ int multi_update::do_updates(bool from_send_error)
else
{
trans_safe= 0; // Can't do safe rollback
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
}
}
(void) table->file->ha_rnd_end();
@@ -1697,7 +1697,7 @@ err2:
else
{
trans_safe= 0;
- thd->no_trans_update.stmt= TRUE;
+ thd->transaction.stmt.modified_non_trans_table= TRUE;
}
}
DBUG_RETURN(1);
@@ -1722,7 +1722,6 @@ bool multi_update::send_eof()
{
query_cache_invalidate3(thd, update_tables, 1);
}
-
/*
Write the SQL statement to the binlog if we updated
rows and we succeeded or if we updated some non
@@ -1732,8 +1731,9 @@ bool multi_update::send_eof()
either from the query's list or via a stored routine: bug#13270,23333
*/
- DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
- if (local_error == 0 || thd->no_trans_update.stmt)
+ DBUG_ASSERT(trans_safe || !updated ||
+ thd->transaction.stmt.modified_non_trans_table);
+ if (local_error == 0 || thd->transaction.stmt.modified_non_trans_table)
{
if (mysql_bin_log.is_open())
{
@@ -1746,8 +1746,8 @@ bool multi_update::send_eof()
if (mysql_bin_log.write(&qinfo) && trans_safe)
local_error= 1; // Rollback update
}
- if (!trans_safe)
- thd->no_trans_update.all= TRUE;
+ if (thd->transaction.stmt.modified_non_trans_table)
+ thd->transaction.all.modified_non_trans_table= TRUE;
}
if (transactional_tables)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6fbd521e302..638da3b1bb0 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5567,7 +5567,7 @@ join_table:
so that [INNER | CROSS] JOIN is properly nested as other
left-associative joins.
*/
- table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
+ table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
{ MYSQL_YYABORT_UNLESS($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor
{ MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
@@ -7708,7 +7708,8 @@ simple_ident:
Item_splocal *splocal;
splocal= new Item_splocal($1, spv->offset, spv->type,
lip->tok_start_prev -
- lex->sphead->m_tmp_query);
+ lex->sphead->m_tmp_query,
+ lip->tok_end - lip->tok_start_prev);
#ifndef DBUG_OFF
if (splocal)
splocal->m_sp= lex->sphead;
diff --git a/sql/table.cc b/sql/table.cc
index f24f5c6fbcc..a393f1a676b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -780,7 +780,11 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
the primary key, then we can use any key to find this column
*/
if (ha_option & HA_PRIMARY_KEY_IN_READ_INDEX)
+ {
field->part_of_key= share->keys_in_use;
+ if (field->part_of_sortkey.is_set(key))
+ field->part_of_sortkey= share->keys_in_use;
+ }
}
if (field->key_length() != key_part->length)
{
@@ -1776,135 +1780,6 @@ void st_table::reset_item_list(List<Item> *item_list) const
}
}
-
-/**
- Set the initial purpose of this TABLE_LIST object in the list of
- used tables. We need to track this information on table-by-
- table basis, since when this table becomes an element of the
- pre-locked list, it's impossible to identify which SQL
- sub-statement it has been originally used in.
-
- E.g.:
-
- User request: SELECT * FROM t1 WHERE f1();
- FUNCTION f1(): DELETE FROM t2; RETURN 1;
- BEFORE DELETE trigger on t2: INSERT INTO t3 VALUES (old.a);
-
- For this user request, the pre-locked list will contain t1, t2, t3
- table elements, each needed for different DML.
-
- This method is called immediately after parsing for tables
- of the table list of the top-level select lex.
-
- The trigger event map is updated to reflect INSERT, UPDATE, DELETE,
- REPLACE, LOAD DATA, CREATE TABLE .. SELECT, CREATE TABLE ..
- REPLACE SELECT statements, and additionally ON DUPLICATE KEY UPDATE
- clause.
-*/
-
-void
-TABLE_LIST::set_trg_event_type(const st_lex *lex)
-{
- enum trg_event_type trg_event;
-
- /*
- Some auxiliary operations
- (e.g. GRANT processing) create TABLE_LIST instances outside
- the parser. Additionally, some commands (e.g. OPTIMIZE) change
- the lock type for a table only after parsing is done. Luckily,
- these do not fire triggers and do not need to pre-load them.
- For these TABLE_LISTs set_trg_event_type is never called, and
- trg_event_map is always empty. That means that the pre-locking
- algorithm will ignore triggers defined on these tables, if
- any, and the execution will either fail with an assert in
- sql_trigger.cc or with an error that a used table was not
- pre-locked, in case of a production build.
-
- TODO: this usage pattern creates unnecessary module dependencies
- and should be rewritten to go through the parser.
- Table list instances created outside the parser in most cases
- refer to mysql.* system tables. It is not allowed to have
- a trigger on a system table, but keeping track of
- initialization provides extra safety in case this limitation
- is circumvented.
- */
-
- /*
- This is a fast check to filter out statements that do
- not change data, or tables on the right side, in case of
- INSERT .. SELECT, CREATE TABLE .. SELECT and so on.
- Here we also filter out OPTIMIZE statement and non-updateable
- views, for which lock_type is TL_UNLOCK or TL_READ after
- parsing.
- */
- if (static_cast<int>(lock_type) < static_cast<int>(TL_WRITE_ALLOW_WRITE))
- return;
-
- switch (lex->sql_command) {
- /*
- Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
- clause, it will be handled later in this method.
- */
- case SQLCOM_INSERT: /* fall through */
- case SQLCOM_INSERT_SELECT:
- /*
- LOAD DATA ... INFILE is expected to fire BEFORE/AFTER INSERT
- triggers.
- If the statement also has REPLACE clause, it will be
- handled later in this method.
- */
- case SQLCOM_LOAD: /* fall through */
- /*
- REPLACE is semantically equivalent to INSERT. In case
- of a primary or unique key conflict, it deletes the old
- record and inserts a new one. So we also may need to
- fire ON DELETE triggers. This functionality is handled
- later in this method.
- */
- case SQLCOM_REPLACE: /* fall through */
- case SQLCOM_REPLACE_SELECT:
- /*
- CREATE TABLE ... SELECT defaults to INSERT if the table or
- view already exists. REPLACE option of CREATE TABLE ...
- REPLACE SELECT is handled later in this method.
- */
- case SQLCOM_CREATE_TABLE:
- trg_event= TRG_EVENT_INSERT;
- break;
- /* Basic update and multi-update */
- case SQLCOM_UPDATE: /* fall through */
- case SQLCOM_UPDATE_MULTI:
- trg_event= TRG_EVENT_UPDATE;
- break;
- /* Basic delete and multi-delete */
- case SQLCOM_DELETE: /* fall through */
- case SQLCOM_DELETE_MULTI:
- trg_event= TRG_EVENT_DELETE;
- break;
- default:
- /*
- OK to return, since value of 'duplicates' is irrelevant
- for non-updating commands.
- */
- return;
- }
- trg_event_map|= static_cast<uint8>(1 << static_cast<int>(trg_event));
-
- switch (lex->duplicates) {
- case DUP_UPDATE:
- trg_event= TRG_EVENT_UPDATE;
- break;
- case DUP_REPLACE:
- trg_event= TRG_EVENT_DELETE;
- break;
- case DUP_ERROR:
- default:
- return;
- }
- trg_event_map|= static_cast<uint8>(1 << static_cast<int>(trg_event));
-}
-
-
/*
calculate md5 of query
diff --git a/sql/table.h b/sql/table.h
index f8f7d7f06b7..f411ce489c4 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -770,7 +770,6 @@ struct TABLE_LIST
void reinit_before_use(THD *thd);
Item_subselect *containing_subselect();
- void set_trg_event_type(const st_lex *lex);
private:
bool prep_check_option(THD *thd, uint8 check_opt_type);
bool prep_where(THD *thd, Item **conds, bool no_where_clause);
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 5eade93621b..7559ca9ec6b 100755
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -22,3 +22,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(mysql_client_test mysql_client_test.c)
TARGET_LINK_LIBRARIES(mysql_client_test dbug mysys mysqlclient yassl taocrypt zlib wsock32)
+
+ADD_EXECUTABLE(bug25714 bug25714.c)
+TARGET_LINK_LIBRARIES(bug25714 dbug mysys mysqlclient yassl taocrypt zlib wsock32)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bd56570d8d4..1c39a3630dd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,7 +28,7 @@ EXTRA_DIST = auto_increment.res auto_increment.tst \
CMakeLists.txt
bin_PROGRAMS = mysql_client_test
-noinst_PROGRAMS = insert_test select_test thread_test
+noinst_PROGRAMS = insert_test select_test thread_test bug25714
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes)
@@ -45,6 +45,9 @@ select_test_SOURCES= select_test.c
insert_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
select_test_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+bug25714_SOURCES= bug25714.c
+bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
+
# Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK
diff --git a/tests/bug25714.c b/tests/bug25714.c
new file mode 100644
index 00000000000..e9b2be44209
--- /dev/null
+++ b/tests/bug25714.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2007 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include <my_global.h>
+#include <my_sys.h>
+#include <mysql.h>
+#include <m_string.h>
+#include <assert.h>
+
+int main (int argc, char **argv)
+{
+ MYSQL conn;
+ int OK;
+
+ const char* query4= "INSERT INTO federated.t1 SET Value=54";
+ const char* query5= "INSERT INTO federated.t1 SET Value=55";
+
+ MY_INIT(argv[0]);
+
+ if (argc != 2)
+ return -1;
+
+ mysql_init(&conn);
+ if (!mysql_real_connect(
+ &conn,
+ "127.0.0.1",
+ "root",
+ "",
+ "test",
+ atoi(argv[1]),
+ NULL,
+ CLIENT_FOUND_ROWS))
+ {
+ fprintf(stderr, "Failed to connect to database: Error: %s\n",
+ mysql_error(&conn));
+ return 1;
+ } else {
+ printf("%s\n", mysql_error(&conn));
+ }
+
+ OK = mysql_real_query (&conn, query4, strlen(query4));
+
+ assert(0 == OK);
+
+ printf("%ld inserted\n",
+ (long) mysql_insert_id(&conn));
+
+ OK = mysql_real_query (&conn, query5, strlen(query5));
+
+ assert(0 == OK);
+
+ printf("%ld inserted\n",
+ (long) mysql_insert_id(&conn));
+
+ mysql_close(&conn);
+ my_end(0);
+
+ return 0;
+};