summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-03-23 05:21:45 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2009-03-23 05:21:45 +0100
commitaeb9747a95dd77c983d58f553637812c99507753 (patch)
treef5252fb21d5ea7c6e6f19beba5ee34903fc4ee47
parent4093dcfb03e3f39bdfc7c65bea866a070bf3d11d (diff)
parentde750af17dee6b2e7cbcb77b5fa03cd81560d9a2 (diff)
downloadmariadb-git-aeb9747a95dd77c983d58f553637812c99507753.tar.gz
auto-merge
-rwxr-xr-xCMakeLists.txt8
-rw-r--r--client/my_readline.h2
-rw-r--r--client/mysql.cc45
-rw-r--r--client/mysql_upgrade.c2
-rw-r--r--client/mysqladmin.cc2
-rw-r--r--client/mysqlbinlog.cc16
-rw-r--r--client/mysqlcheck.c9
-rw-r--r--client/mysqldump.c70
-rw-r--r--client/mysqlmanager-pwgen.c5
-rw-r--r--client/mysqltest.c78
-rw-r--r--client/readline.cc46
-rw-r--r--client/sql_string.cc21
-rw-r--r--configure.in8
-rw-r--r--extra/comp_err.c2
-rw-r--r--extra/perror.c11
-rw-r--r--extra/yassl/src/buffer.cpp4
-rw-r--r--extra/yassl/src/cert_wrapper.cpp14
-rw-r--r--extra/yassl/src/ssl.cpp6
-rw-r--r--extra/yassl/src/yassl_imp.cpp2
-rw-r--r--extra/yassl/src/yassl_int.cpp12
-rw-r--r--extra/yassl/taocrypt/include/block.hpp2
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp2
-rw-r--r--extra/yassl/taocrypt/src/asn.cpp2
-rw-r--r--heap/hp_write.c2
-rw-r--r--include/config-win.h9
-rw-r--r--include/my_base.h1
-rw-r--r--include/my_global.h38
-rw-r--r--include/my_md5.h90
-rw-r--r--include/my_sys.h3
-rw-r--r--innobase/buf/buf0lru.c127
-rw-r--r--innobase/dict/dict0crea.c3
-rw-r--r--innobase/include/db0err.h5
-rw-r--r--innobase/include/pars0pars.h2
-rw-r--r--innobase/include/rem0rec.h11
-rw-r--r--innobase/include/rem0rec.ic19
-rw-r--r--innobase/include/trx0undo.h13
-rw-r--r--innobase/pars/pars0pars.c4
-rw-r--r--innobase/rem/rem0cmp.c2
-rw-r--r--innobase/row/row0mysql.c3
-rw-r--r--innobase/trx/trx0rec.c15
-rw-r--r--innobase/trx/trx0undo.c105
-rw-r--r--libmysql/libmysql.c10
-rw-r--r--libmysql/manager.c4
-rw-r--r--myisam/mi_check.c6
-rw-r--r--myisam/mi_open.c5
-rw-r--r--myisam/mi_packrec.c2
-rw-r--r--myisam/mi_search.c2
-rw-r--r--myisam/rt_index.c10
-rw-r--r--mysql-test/include/master-slave-end.inc6
-rw-r--r--mysql-test/include/ndb_backup.inc43
-rw-r--r--mysql-test/include/start_slave.inc21
-rw-r--r--mysql-test/include/stop_slave.inc21
-rw-r--r--mysql-test/include/wait_for_slave_sql_error.inc40
-rw-r--r--mysql-test/include/wait_for_slave_sql_error_and_skip.inc39
-rw-r--r--mysql-test/include/wait_show_condition.inc78
-rw-r--r--mysql-test/include/wait_until_count_sessions.inc36
-rw-r--r--mysql-test/r/archive_gis.result6
-rw-r--r--mysql-test/r/backup.result2
-rw-r--r--mysql-test/r/bdb_gis.result6
-rw-r--r--mysql-test/r/check.result3
-rw-r--r--mysql-test/r/consistent_snapshot.result32
-rw-r--r--mysql-test/r/ctype_collate.result19
-rw-r--r--mysql-test/r/dirty_close.result10
-rw-r--r--mysql-test/r/explain.result4
-rw-r--r--mysql-test/r/federated.result20
-rw-r--r--mysql-test/r/flush_block_commit.result74
-rw-r--r--mysql-test/r/flush_block_commit_notembedded.result30
-rw-r--r--mysql-test/r/flush_read_lock_kill.result17
-rw-r--r--mysql-test/r/fulltext.result4
-rw-r--r--mysql-test/r/func_group.result8
-rw-r--r--mysql-test/r/func_math.result40
-rw-r--r--mysql-test/r/func_str.result10
-rw-r--r--mysql-test/r/gis.result10
-rw-r--r--mysql-test/r/grant.result34
-rw-r--r--mysql-test/r/grant2.result2
-rw-r--r--mysql-test/r/group_min_max.result15
-rw-r--r--mysql-test/r/information_schema.result24
-rw-r--r--mysql-test/r/information_schema_db.result2
-rw-r--r--mysql-test/r/innodb_bug42419.result17
-rw-r--r--mysql-test/r/innodb_gis.result6
-rw-r--r--mysql-test/r/lock_multi.result8
-rw-r--r--mysql-test/r/lowercase_utf8.result9
-rw-r--r--mysql-test/r/multi_update.result14
-rw-r--r--mysql-test/r/mysql.result13
-rw-r--r--mysql-test/r/mysqlbinlog.result36
-rw-r--r--mysql-test/r/mysqldump-max.result72
-rw-r--r--mysql-test/r/mysqldump.result482
-rw-r--r--mysql-test/r/mysqltest.result2
-rw-r--r--mysql-test/r/ndb_gis.result12
-rw-r--r--mysql-test/r/ndb_restore.result6
-rw-r--r--mysql-test/r/ndb_restore_print.result18
-rw-r--r--mysql-test/r/openssl_1.result18
-rw-r--r--mysql-test/r/packet.result4
-rw-r--r--mysql-test/r/preload.result4
-rw-r--r--mysql-test/r/ps.result14
-rw-r--r--mysql-test/r/read_only.result2
-rw-r--r--mysql-test/r/repair.result2
-rw-r--r--mysql-test/r/row.result14
-rw-r--r--mysql-test/r/rpl_failed_optimize.result2
-rw-r--r--mysql-test/r/rpl_filter_tables_not_exist.result151
-rw-r--r--mysql-test/r/select.result14
-rw-r--r--mysql-test/r/show_check.result8
-rw-r--r--mysql-test/r/skip_name_resolve.result6
-rw-r--r--mysql-test/r/sp-security.result16
-rw-r--r--mysql-test/r/sp.result12
-rw-r--r--mysql-test/r/subselect.result220
-rw-r--r--mysql-test/r/synchronization.result44
-rw-r--r--mysql-test/r/trigger-compat.result4
-rw-r--r--mysql-test/r/type_float.result18
-rw-r--r--mysql-test/r/union.result16
-rw-r--r--mysql-test/r/variables.result46
-rw-r--r--mysql-test/r/view.result66
-rw-r--r--mysql-test/r/view_grant.result34
-rw-r--r--mysql-test/r/windows.result18
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result8
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result8
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result4
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views.result8
-rw-r--r--mysql-test/t/alter_table-big.test7
-rw-r--r--mysql-test/t/backup.test15
-rw-r--r--mysql-test/t/check.test24
-rw-r--r--mysql-test/t/compress.test11
-rw-r--r--mysql-test/t/connect.test38
-rw-r--r--mysql-test/t/consistent_snapshot.test44
-rw-r--r--mysql-test/t/ctype_collate.test14
-rw-r--r--mysql-test/t/dirty_close.test21
-rw-r--r--mysql-test/t/explain.test13
-rw-r--r--mysql-test/t/federated.test22
-rw-r--r--mysql-test/t/flush_block_commit.test96
-rw-r--r--mysql-test/t/flush_block_commit_notembedded.test47
-rw-r--r--mysql-test/t/flush_read_lock_kill.test35
-rw-r--r--mysql-test/t/fulltext.test8
-rw-r--r--mysql-test/t/func_math.test20
-rw-r--r--mysql-test/t/func_str.test9
-rw-r--r--mysql-test/t/gis.test3
-rw-r--r--mysql-test/t/grant.test182
-rw-r--r--mysql-test/t/grant2.test2
-rw-r--r--mysql-test/t/group_min_max.test23
-rw-r--r--mysql-test/t/information_schema.test151
-rw-r--r--mysql-test/t/init_connect.test10
-rw-r--r--mysql-test/t/innodb_bug42419.test77
-rw-r--r--mysql-test/t/lock_multi.test203
-rw-r--r--mysql-test/t/lowercase_utf8-master.opt4
-rw-r--r--mysql-test/t/lowercase_utf8.test9
-rw-r--r--mysql-test/t/multi_update.test55
-rw-r--r--mysql-test/t/mysql.test106
-rw-r--r--mysql-test/t/mysqlbinlog.test87
-rw-r--r--mysql-test/t/mysqldump-compat.test8
-rw-r--r--mysql-test/t/mysqldump.test32
-rw-r--r--mysql-test/t/mysqltest.test133
-rw-r--r--mysql-test/t/ndb_autodiscover.test6
-rw-r--r--mysql-test/t/overflow.test10
-rw-r--r--mysql-test/t/packet.test20
-rw-r--r--mysql-test/t/ps.test9
-rw-r--r--mysql-test/t/query_cache_notembedded.test18
-rw-r--r--mysql-test/t/read_only.test28
-rw-r--r--mysql-test/t/row.test18
-rw-r--r--mysql-test/t/rpl_filter_tables_not_exist-slave.opt1
-rw-r--r--mysql-test/t/rpl_filter_tables_not_exist.test206
-rw-r--r--mysql-test/t/rpl_trigger.test3
-rw-r--r--mysql-test/t/show_check.test81
-rw-r--r--mysql-test/t/skip_name_resolve.test18
-rw-r--r--mysql-test/t/sp-security.test60
-rw-r--r--mysql-test/t/sp-threads.test29
-rw-r--r--mysql-test/t/sp_notembedded.test40
-rw-r--r--mysql-test/t/ssl-big.test28
-rw-r--r--mysql-test/t/ssl.test8
-rw-r--r--mysql-test/t/ssl_compress.test10
-rw-r--r--mysql-test/t/status.test7
-rw-r--r--mysql-test/t/subselect.test567
-rw-r--r--mysql-test/t/synchronization.test22
-rw-r--r--mysql-test/t/timezone_grant.test41
-rw-r--r--mysql-test/t/trigger-compat.test24
-rw-r--r--mysql-test/t/type_bit_innodb.test4
-rw-r--r--mysql-test/t/type_float.test9
-rw-r--r--mysql-test/t/union.test43
-rw-r--r--mysql-test/t/user_limits.test41
-rw-r--r--mysql-test/t/variables.test38
-rw-r--r--mysql-test/t/view.test837
-rw-r--r--mysql-test/t/view_grant.test234
-rw-r--r--mysql-test/t/wait_timeout.test5
-rwxr-xr-xmysql-test/t/windows.test31
-rw-r--r--mysql-test/t/xa.test28
-rw-r--r--mysys/base64.c2
-rw-r--r--mysys/default.c8
-rw-r--r--mysys/errors.c16
-rw-r--r--mysys/md5.c567
-rw-r--r--mysys/mf_iocache2.c4
-rw-r--r--mysys/my_fstream.c6
-rw-r--r--mysys/my_new.cc5
-rw-r--r--mysys/my_pread.c6
-rw-r--r--mysys/my_static.c4
-rw-r--r--mysys/my_write.c6
-rw-r--r--mysys/safemalloc.c2
-rw-r--r--mysys/string.c4
-rw-r--r--scripts/mysqldumpslow.sh4
-rw-r--r--server-tools/instance-manager/buffer.cc2
-rw-r--r--server-tools/instance-manager/commands.cc18
-rw-r--r--server-tools/instance-manager/instance.cc2
-rw-r--r--server-tools/instance-manager/instance_map.cc2
-rw-r--r--server-tools/instance-manager/instance_options.cc8
-rw-r--r--server-tools/instance-manager/listener.cc33
-rw-r--r--server-tools/instance-manager/mysql_connection.cc4
-rw-r--r--server-tools/instance-manager/options.cc2
-rw-r--r--server-tools/instance-manager/parse.cc2
-rw-r--r--server-tools/instance-manager/parse.h2
-rw-r--r--server-tools/instance-manager/parse_output.cc8
-rw-r--r--server-tools/instance-manager/protocol.cc12
-rw-r--r--server-tools/instance-manager/user_map.cc2
-rw-r--r--sql-bench/TODO21
-rw-r--r--sql-common/client.c2
-rw-r--r--sql-common/my_user.c4
-rw-r--r--sql/gen_lex_hash.cc6
-rw-r--r--sql/ha_archive.cc6
-rw-r--r--sql/ha_federated.cc30
-rw-r--r--sql/ha_innodb.cc19
-rw-r--r--sql/handler.cc7
-rw-r--r--sql/item.cc98
-rw-r--r--sql/item.h2
-rw-r--r--sql/item_cmpfunc.cc13
-rw-r--r--sql/item_func.cc9
-rw-r--r--sql/item_strfunc.cc19
-rw-r--r--sql/item_strfunc.h2
-rw-r--r--sql/item_sum.cc3
-rw-r--r--sql/item_timefunc.cc64
-rw-r--r--sql/lock.cc4
-rw-r--r--sql/log.cc4
-rw-r--r--sql/log_event.cc85
-rw-r--r--sql/log_event.h22
-rw-r--r--sql/mysqld.cc54
-rw-r--r--sql/net_serv.cc4
-rw-r--r--sql/opt_range.cc101
-rw-r--r--sql/opt_sum.cc6
-rw-r--r--sql/parse_file.cc10
-rw-r--r--sql/protocol.cc29
-rw-r--r--sql/set_var.cc16
-rw-r--r--sql/slave.cc14
-rw-r--r--sql/sp.cc10
-rw-r--r--sql/sp_head.cc16
-rw-r--r--sql/spatial.cc2
-rw-r--r--sql/sql_acl.cc90
-rw-r--r--sql/sql_base.cc12
-rw-r--r--sql/sql_cache.cc57
-rw-r--r--sql/sql_class.cc19
-rw-r--r--sql/sql_class.h7
-rw-r--r--sql/sql_crypt.cc2
-rw-r--r--sql/sql_db.cc18
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_error.cc2
-rw-r--r--sql/sql_handler.cc31
-rw-r--r--sql/sql_help.cc10
-rw-r--r--sql/sql_insert.cc2
-rw-r--r--sql/sql_lex.cc4
-rw-r--r--sql/sql_load.cc4
-rw-r--r--sql/sql_parse.cc86
-rw-r--r--sql/sql_prepare.cc8
-rw-r--r--sql/sql_repl.cc8
-rw-r--r--sql/sql_select.cc76
-rw-r--r--sql/sql_show.cc205
-rw-r--r--sql/sql_string.cc23
-rw-r--r--sql/sql_table.cc15
-rw-r--r--sql/sql_trigger.cc36
-rw-r--r--sql/sql_udf.cc2
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sql_view.cc16
-rw-r--r--sql/sql_yacc.yy5
-rw-r--r--sql/table.cc13
-rw-r--r--sql/tztime.cc77
-rw-r--r--sql/udf_example.c4
-rw-r--r--sql/uniques.cc2
-rw-r--r--sql/unireg.cc2
-rw-r--r--strings/Makefile.am2
-rw-r--r--strings/ctype-mb.c4
-rw-r--r--strings/ctype-simple.c10
-rw-r--r--strings/ctype-ucs2.c2
-rw-r--r--strings/my_vsnprintf.c2
-rw-r--r--strings/xml.c4
-rw-r--r--tests/bug25714.c4
-rw-r--r--tests/mysql_client_test.c600
-rw-r--r--tools/mysqlmanager.c5
-rw-r--r--vio/viosocket.c2
283 files changed, 6383 insertions, 3518 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae069498da1..f66453ef492 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,7 +114,13 @@ IF(MSVC)
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
-
+
+ # Mark 32 bit executables large address aware so they can
+ # use > 2GB address space
+ IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
+ ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)
+
# Disable automatic manifest generation.
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
${CMAKE_EXE_LINKER_FLAGS})
diff --git a/client/my_readline.h b/client/my_readline.h
index 47be7fa9294..32d6da4c626 100644
--- a/client/my_readline.h
+++ b/client/my_readline.h
@@ -29,5 +29,5 @@ typedef struct st_line_buffer
extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file);
extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, my_string str);
-extern char *batch_readline(LINE_BUFFER *buffer);
+extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated);
extern void batch_readline_end(LINE_BUFFER *buffer);
diff --git a/client/mysql.cc b/client/mysql.cc
index e035cee16f9..983d7719c3c 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -112,6 +112,8 @@ extern "C" {
#define PROMPT_CHAR '\\'
#define DEFAULT_DELIMITER ";"
+#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L)
+
typedef struct st_status
{
int exit_status;
@@ -243,7 +245,7 @@ static COMMANDS commands[] = {
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." },
{ "delimiter", 'd', com_delimiter, 1,
- "Set statement delimiter. NOTE: Takes the rest of the line as new delimiter." },
+ "Set statement delimiter." },
#ifdef USE_POPEN
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
#endif
@@ -1035,7 +1037,7 @@ static void fix_history(String *final_command);
static COMMANDS *find_command(char *name,char cmd_name);
static bool add_line(String &buffer,char *line,char *in_string,
- bool *ml_comment);
+ bool *ml_comment, bool truncated);
static void remove_cntrl(String &buffer);
static void print_table_data(MYSQL_RES *result);
static void print_table_data_html(MYSQL_RES *result);
@@ -1117,7 +1119,7 @@ int main(int argc,char *argv[])
exit(1);
}
if (status.batch && !status.line_buff &&
- !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin)))
+ !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
{
free_defaults(defaults_argv);
my_end(0);
@@ -1197,7 +1199,7 @@ int main(int argc,char *argv[])
#endif
sprintf(buff, "%s",
#ifndef NOT_YET
- "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n");
+ "Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
#else
"Type 'help [[%]function name[%]]' to get help on usage of function.\n");
#endif
@@ -1226,7 +1228,7 @@ sig_handler mysql_sigint(int sig)
goto err;
/* kill_buffer is always big enough because max length of %lu is 15 */
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
- mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
+ mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql);
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
@@ -1766,13 +1768,14 @@ static int read_and_execute(bool interactive)
ulong line_number=0;
bool ml_comment= 0;
COMMANDS *com;
+ bool truncated= 0;
status.exit_status=1;
for (;;)
{
if (!interactive)
{
- line=batch_readline(status.line_buff);
+ line=batch_readline(status.line_buff, &truncated);
/*
Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF.
Editors like "notepad" put this marker in
@@ -1891,7 +1894,7 @@ static int read_and_execute(bool interactive)
#endif
continue;
}
- if (add_line(glob_buffer,line,&in_string,&ml_comment))
+ if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated))
break;
}
/* if in batch mode, send last query even if it doesn't end with \g or go */
@@ -1977,7 +1980,7 @@ static COMMANDS *find_command(char *name,char cmd_char)
static bool add_line(String &buffer,char *line,char *in_string,
- bool *ml_comment)
+ bool *ml_comment, bool truncated)
{
uchar inchar;
char buff[80], *pos, *out;
@@ -2222,8 +2225,23 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
if (out != line || !buffer.is_empty())
{
- *out++='\n';
uint length=(uint) (out-line);
+
+ if (!truncated &&
+ (length < 9 ||
+ my_strnncoll (charset_info,
+ (uchar *)line, 9, (const uchar *) "delimiter", 9)))
+ {
+ /*
+ Don't add a new line in case there's a DELIMITER command to be
+ added to the glob buffer (e.g. on processing a line like
+ "<command>;DELIMITER <non-eof>") : similar to how a new line is
+ not added in the case when the DELIMITER is the first command
+ entered with an empty glob buffer.
+ */
+ *out++='\n';
+ length++;
+ }
if (buffer.length() + length >= buffer.alloced_length())
buffer.realloc(buffer.length()+length+IO_SIZE);
if ((!*ml_comment || preserve_comments) && buffer.append(line, length))
@@ -2832,7 +2850,7 @@ com_charset(String *buffer __attribute__((unused)), char *line)
param= get_arg(buff, 0);
if (!param || !*param)
{
- return put_info("Usage: \\C char_setname | charset charset_name",
+ return put_info("Usage: \\C charset_name | charset charset_name",
INFO_ERROR, 0);
}
new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));
@@ -3449,7 +3467,7 @@ static void print_warnings()
/* Get the warnings */
query= "show warnings";
- mysql_real_query_for_lazy(query, strlen(query));
+ mysql_real_query_for_lazy(query, (uint) strlen(query));
mysql_store_result_for_lazy(&result);
/* Bail out when no warnings */
@@ -3872,7 +3890,7 @@ static int com_source(String *buffer, char *line)
return put_info(buff, INFO_ERROR, 0);
}
- if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file)))
+ if (!(line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, sql_file)))
{
my_fclose(sql_file,MYF(0));
return put_info("Can't initialize batch_readline", INFO_ERROR, 0);
@@ -4329,7 +4347,8 @@ server_version_string(MYSQL *con)
MYSQL_ROW cur = mysql_fetch_row(result);
if (cur && cur[0])
{
- bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS);
+ bufp = strxnmov(bufp, (uint) (sizeof buf - (bufp - buf)), " ", cur[0],
+ NullS);
}
mysql_free_result(result);
}
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 74e8c9dd577..e3500c81fb9 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -429,7 +429,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
MYF(MY_WME))) < 0)
die("Failed to create temporary file for defaults");
- if (my_write(fd, query, strlen(query),
+ if (my_write(fd, query, (uint) strlen(query),
MYF(MY_FNABP | MY_WME)))
{
my_close(fd, MYF(0));
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 54f67c5df2d..24b95be8626 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -844,7 +844,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
bool old= (find_type(argv[0], &command_typelib, 2) ==
ADMIN_OLD_PASSWORD);
#ifdef __WIN__
- uint pw_len= strlen(pw);
+ uint pw_len= (uint) strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
printf("Warning: single quotes were not trimmed from the password by"
" your command\nline client, as you might have expected.\n");
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index f0a4c8d2abf..ed072902730 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -105,7 +105,7 @@ static MYSQL* safe_connect();
class Load_log_processor
{
char target_dir_name[FN_REFLEN];
- int target_dir_name_len;
+ size_t target_dir_name_len;
/*
When we see first event corresponding to some LOAD DATA statement in
@@ -275,7 +275,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
File file;
fn_format(filename, le->fname, target_dir_name, "", 1);
- len= strlen(filename);
+ len= (uint) strlen(filename);
tail= filename + len;
if ((file= create_unique_file(filename,tail)) < 0)
@@ -284,7 +284,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
return -1;
}
- le->set_fname_outside_temp_buf(filename,len+strlen(tail));
+ le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail));
return file;
}
@@ -369,7 +369,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
uint file_id,
Create_file_log_event *ce)
{
- uint full_len= target_dir_name_len + blen + 9 + 9 + 1;
+ size_t full_len= target_dir_name_len + blen + 9 + 9 + 1;
int error= 0;
char *fname, *ptr;
File file;
@@ -403,7 +403,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
}
if (ce)
- ce->set_fname_outside_temp_buf(fname, strlen(fname));
+ ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname));
if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP)))
error= -1;
@@ -416,7 +416,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
int Load_log_processor::process(Create_file_log_event *ce)
{
const char *bname= ce->fname + dirname_length(ce->fname);
- uint blen= ce->fname_len - (bname-ce->fname);
+ uint blen= (uint) (ce->fname_len - (bname-ce->fname));
return process_first_event(bname, blen, ce->block, ce->block_len,
ce->file_id, ce);
@@ -864,7 +864,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
long dummy_my_timezone;
my_bool dummy_in_dst_time_gap;
/* We require a total specification (date AND time) */
- if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) !=
+ if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
MYSQL_TIMESTAMP_DATETIME || was_cut)
{
fprintf(stderr, "Incorrect date and time argument: %s\n", str);
@@ -1109,7 +1109,7 @@ could be out of memory");
int4store(buf, (uint32)start_position);
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
- size_s tlen = strlen(logname);
+ size_t tlen= strlen(logname);
if (tlen > UINT_MAX)
{
fprintf(stderr,"Log name too long\n");
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 513d1974ed0..15922e672a6 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -328,7 +328,7 @@ static int get_options(int *argc, char ***argv)
if (!what_to_do)
{
- int pnlen = strlen(my_progname);
+ size_t pnlen= strlen(my_progname);
if (pnlen < 6) /* name too short */
what_to_do = DO_CHECK;
@@ -414,7 +414,8 @@ static int process_selected_tables(char *db, char **table_names, int tables)
space is for more readable output in logs and in case of error
*/
char *table_names_comma_sep, *end;
- int i, tot_length = 0;
+ size_t tot_length= 0;
+ int i= 0;
for (i = 0; i < tables; i++)
tot_length+= fixed_name_length(*(table_names + i)) + 2;
@@ -430,7 +431,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
*end++= ',';
}
*--end = 0;
- handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1);
+ handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
my_free(table_names_comma_sep, MYF(0));
}
else
@@ -452,7 +453,7 @@ static uint fixed_name_length(const char *name)
else if (*p == '.')
extra_length+= 2;
}
- return (p - name) + extra_length;
+ return (uint) ((p - name) + extra_length);
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index ced34f16212..a9d2788de05 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc.
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
@@ -662,7 +662,7 @@ static void free_table_ent(char *key)
byte* get_table_key(const char *entry, uint *length,
my_bool not_used __attribute__((unused)))
{
- *length= strlen(entry);
+ *length= (uint) strlen(entry);
return (byte*) entry;
}
@@ -778,7 +778,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_set_charset= 0;
opt_compatible_mode_str= argument;
opt_compatible_mode= find_set(&compatible_mode_typelib,
- argument, strlen(argument),
+ argument, (uint) strlen(argument),
&err_ptr, &err_len);
if (err_len)
{
@@ -791,7 +791,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
uint size_for_sql_mode= 0;
const char **ptr;
for (ptr= compatible_mode_names; *ptr; ptr++)
- size_for_sql_mode+= strlen(*ptr);
+ size_for_sql_mode+= (uint) strlen(*ptr);
size_for_sql_mode+= sizeof(compatible_mode_names)-1;
DBUG_ASSERT(sizeof(compatible_mode_normal_str)>=size_for_sql_mode);
}
@@ -1039,7 +1039,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
"SET SESSION character_set_results = '%s'",
(const char *) cs_name);
- return mysql_real_query(mysql, query_buffer, query_length);
+ return mysql_real_query(mysql, query_buffer, (uint) query_length);
}
@@ -1129,7 +1129,8 @@ static int connect_to_db(char *host, char *user,char *passwd)
DB_error(&mysql_connection, "when trying to connect");
DBUG_RETURN(1);
}
- if (mysql_get_server_version(&mysql_connection) < 40100)
+ if ((mysql_get_server_version(&mysql_connection) < 40100) ||
+ (opt_compatible_mode & 3))
{
/* Don't dump SET NAMES with a pre-4.1 server (bug#7997). */
opt_set_charset= 0;
@@ -1371,7 +1372,8 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
fputs(attribute_name, xml_file);
fputc('\"', xml_file);
- print_quoted_xml(xml_file, attribute_value, strlen(attribute_value));
+ print_quoted_xml(xml_file, attribute_value,
+ (uint) strlen(attribute_value));
fputc('\"', xml_file);
attribute_name= va_arg(arg_list, char *);
@@ -1411,7 +1413,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
fputs("<", xml_file);
fputs(stag_atr, xml_file);
fputs("\"", xml_file);
- print_quoted_xml(xml_file, sval, strlen(sval));
+ print_quoted_xml(xml_file, sval, (uint) strlen(sval));
fputs("\" xsi:nil=\"true\" />", xml_file);
fputs(line_end, xml_file);
check_io(xml_file);
@@ -1509,7 +1511,7 @@ static uint dump_routines_for_db(char *db)
DBUG_ENTER("dump_routines_for_db");
DBUG_PRINT("enter", ("db: '%s'", db));
- mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
+ mysql_real_escape_string(mysql, db_name_buff, db, (uint) strlen(db));
/* nice comments */
if (opt_comments)
@@ -1601,13 +1603,13 @@ static uint dump_routines_for_db(char *db)
Allocate memory for new query string: original string
from SHOW statement and version-specific comments.
*/
- query_str= alloc_query_str(strlen(row[2]) + 23);
+ query_str= alloc_query_str((uint) strlen(row[2]) + 23);
query_str_tail= strnmov(query_str, row[2],
- definer_begin - row[2]);
+ (uint) (definer_begin - row[2]));
query_str_tail= strmov(query_str_tail, "*/ /*!50020");
query_str_tail= strnmov(query_str_tail, definer_begin,
- definer_end - definer_begin);
+ (uint) (definer_end - definer_begin));
query_str_tail= strxmov(query_str_tail, "*/ /*!50003",
definer_end, NullS);
}
@@ -1857,11 +1859,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
row= mysql_fetch_row(result);
- fprintf(sql_file,
- "SET @saved_cs_client = @@character_set_client;\n"
- "SET character_set_client = utf8;\n"
+ fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
+ "/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
+ "/*!40101 SET character_set_client = utf8 */;\n"
"%s;\n"
- "SET character_set_client = @saved_cs_client;\n",
+ "/*!40101 SET character_set_client = @saved_cs_client */;\n",
row[1]);
check_io(sql_file);
@@ -2216,7 +2218,7 @@ static void dump_triggers_for_table(char *table,
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
- parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len,
+ parse_user(row[7], (uint) strlen(row[7]), user_name_str, &user_name_len,
host_name_str, &host_name_len);
fprintf(sql_file,
@@ -3054,7 +3056,7 @@ static int dump_all_tables_in_db(char *database)
while ((table= getTableName(0)))
{
char *end= strmov(afterdot, table);
- if (include_table(hash_key, end - hash_key))
+ if (include_table(hash_key, (uint) (end - hash_key)))
{
dump_table(table,database);
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
@@ -3103,6 +3105,11 @@ static my_bool dump_all_views_in_db(char *database)
char *table;
uint numrows;
char table_buff[NAME_LEN*2+3];
+ char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
+ char *afterdot;
+
+ afterdot= strmov(hash_key, database);
+ *afterdot++= '.';
if (init_dumping(database, init_dumping_views))
return 1;
@@ -3112,10 +3119,15 @@ static my_bool dump_all_views_in_db(char *database)
{
DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
- for (numrows= 0 ; (table= getTableName(1)); numrows++)
+ for (numrows= 0 ; (table= getTableName(1)); )
{
- dynstr_append_checked(&query, quote_name(table, table_buff, 1));
- dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
+ char *end= strmov(afterdot, table);
+ if (include_table((uchar*) hash_key,end - hash_key))
+ {
+ numrows++;
+ dynstr_append_checked(&query, quote_name(table, table_buff, 1));
+ dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
+ }
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES");
@@ -3129,7 +3141,11 @@ static my_bool dump_all_views_in_db(char *database)
/* We shall continue here, if --force was given */
}
while ((table= getTableName(0)))
- get_view_structure(table, database);
+ {
+ char *end= strmov(afterdot, table);
+ if (include_table((uchar*) hash_key, end - hash_key))
+ get_view_structure(table, database);
+ }
if (opt_xml)
{
fputs("</database>\n", md_result_file);
@@ -3199,7 +3215,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
DBUG_ENTER("dump_selected_tables");
if (init_dumping(db, init_dumping_tables))
- return 1;
+ DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
@@ -3561,7 +3577,8 @@ char check_if_ignore_table(const char *table_name, char *table_type)
If these two types, we do want to skip dumping the table
*/
if (!opt_no_data &&
- (!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM")))
+ (!strcmp(table_type,"MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM") ||
+ !strcmp(table_type,"FEDERATED")))
result= IGNORE_DATA;
}
mysql_free_result(res);
@@ -3622,7 +3639,7 @@ static char *primary_key_fields(const char *table_name)
do
{
quoted_field= quote_name(row[4], buff, 0);
- result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
+ result_length+= (uint) strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
} while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
}
@@ -3682,7 +3699,8 @@ static int replace(DYNAMIC_STRING *ds_str,
return 1;
init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256);
- dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
+ dynstr_append_mem_checked(&ds_tmp, ds_str->str,
+ (uint) (start - ds_str->str));
dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
dynstr_append_checked(&ds_tmp, start + search_len);
dynstr_set_checked(ds_str, ds_tmp.str);
diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c
index 7a857c59743..568358b1cda 100644
--- a/client/mysqlmanager-pwgen.c
+++ b/client/mysqlmanager-pwgen.c
@@ -134,7 +134,6 @@ void get_pass(char* pw, int len)
int main(int argc, char** argv)
{
FILE* fp;
- my_MD5_CTX context;
uchar digest[16];
char pw[17];
uint i;
@@ -147,9 +146,7 @@ int main(int argc, char** argv)
if (!(fp=fopen(outfile,"w")))
die("Could not open '%s'(errno=%d)",outfile,errno);
get_pass(pw,sizeof(pw)-1);
- my_MD5Init(&context);
- my_MD5Update(&context,(uchar*) pw,sizeof(pw)-1);
- my_MD5Final(digest,&context);
+ MY_MD5_HASH(digest,(uchar*) pw,sizeof(pw)-1);
fprintf(fp,"%s:",user);
for (i=0;i<sizeof(digest);i++)
fprintf(fp,"%02x",digest[i]);
diff --git a/client/mysqltest.c b/client/mysqltest.c
index d7fbb6f1f18..64b9f4a5a16 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -801,7 +801,7 @@ void check_command_args(struct st_command *command,
ptr++;
if (ptr > start)
{
- init_dynamic_string(arg->ds, 0, ptr-start, 32);
+ init_dynamic_string(arg->ds, 0, (uint) (ptr - start), 32);
do_eval(arg->ds, start, ptr, FALSE);
}
else
@@ -1156,16 +1156,16 @@ void warning_msg(const char *fmt, ...)
len= my_snprintf(buff, sizeof(buff), "in included file %s ",
cur_file->file_name);
dynstr_append_mem(&ds_warning_messages,
- buff, len);
+ buff, (uint) len);
}
len= my_snprintf(buff, sizeof(buff), "at line %d: ",
start_lineno);
dynstr_append_mem(&ds_warning_messages,
- buff, len);
+ buff, (uint) len);
}
len= my_vsnprintf(buff, sizeof(buff), fmt, args);
- dynstr_append_mem(&ds_warning_messages, buff, len);
+ dynstr_append_mem(&ds_warning_messages, buff, (uint) len);
dynstr_append(&ds_warning_messages, "\n");
va_end(args);
@@ -1185,7 +1185,7 @@ void log_msg(const char *fmt, ...)
len= my_vsnprintf(buff, sizeof(buff)-1, fmt, args);
va_end(args);
- dynstr_append_mem(&ds_res, buff, len);
+ dynstr_append_mem(&ds_res, buff, (uint) len);
dynstr_append(&ds_res, "\n");
DBUG_VOID_RETURN;
@@ -1222,7 +1222,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
/* Add fake newline instead of cr and output the line */
*p= '\n';
p++; /* Step past the "fake" newline */
- dynstr_append_mem(ds, start, p-start);
+ dynstr_append_mem(ds, start, (uint) (p - start));
p++; /* Step past the "fake" newline */
start= p;
}
@@ -1230,7 +1230,7 @@ void cat_file(DYNAMIC_STRING* ds, const char* filename)
p++;
}
/* Output any chars that migh be left */
- dynstr_append_mem(ds, start, p-start);
+ dynstr_append_mem(ds, start, (uint) (p - start));
}
my_close(fd, MYF(0));
}
@@ -1770,9 +1770,9 @@ VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
int val_alloc_len;
VAR *tmp_var;
if (!name_len && name)
- name_len = strlen(name);
+ name_len = (uint) strlen(name);
if (!val_len && val)
- val_len = strlen(val) ;
+ val_len = (uint) strlen(val) ;
val_alloc_len = val_len + 16; /* room to grow */
if (!(tmp_var=v) && !(tmp_var = (VAR*)my_malloc(sizeof(*tmp_var)
+ name_len+1, MYF(MY_WME))))
@@ -1815,7 +1815,7 @@ VAR* var_from_env(const char *name, const char *def_val)
if (!(tmp = getenv(name)))
tmp = def_val;
- v = var_init(0, name, strlen(name), tmp, strlen(tmp));
+ v = var_init(0, name, (uint) strlen(name), tmp, (uint) strlen(tmp));
my_hash_insert(&var_hash, (byte*)v);
return v;
}
@@ -1864,7 +1864,7 @@ VAR* var_get(const char *var_name, const char **var_name_end, my_bool raw,
{
sprintf(v->str_val, "%d", v->int_val);
v->int_dirty = 0;
- v->str_val_len = strlen(v->str_val);
+ v->str_val_len = (uint) strlen(v->str_val);
}
if (var_name_end)
*var_name_end = var_name ;
@@ -1927,7 +1927,7 @@ void var_set(const char *var_name, const char *var_name_end,
{
sprintf(v->str_val, "%d", v->int_val);
v->int_dirty= 0;
- v->str_val_len= strlen(v->str_val);
+ v->str_val_len= (uint) strlen(v->str_val);
}
my_snprintf(buf, sizeof(buf), "%.*s=%.*s",
v->name_len, v->name,
@@ -2006,7 +2006,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
++query;
/* Eval the query, thus replacing all environment variables */
- init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
+ init_dynamic_string(&ds_query, 0, (uint) ((end - query) + 32), 256);
do_eval(&ds_query, query, end, FALSE);
if (mysql_real_query(mysql, ds_query.str, ds_query.length))
@@ -2223,7 +2223,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
struct st_command command;
memset(&command, 0, sizeof(command));
command.query= (char*)p;
- command.first_word_len= len;
+ command.first_word_len= (uint) len;
command.first_argument= command.query + len;
command.end= (char*)*p_end;
var_set_query_get_value(&command, v);
@@ -2413,7 +2413,7 @@ static int replace(DYNAMIC_STRING *ds_str,
return 1;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
- dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
+ dynstr_append_mem(&ds_tmp, ds_str->str, (uint) (start - ds_str->str));
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str);
@@ -2468,7 +2468,7 @@ void do_exec(struct st_command *command)
if (builtin_echo[0] && strncmp(cmd, "echo", 4) == 0)
{
/* Replace echo with our "builtin" echo */
- replace(&ds_cmd, "echo", 4, builtin_echo, strlen(builtin_echo));
+ replace(&ds_cmd, "echo", 4, builtin_echo, (uint) strlen(builtin_echo));
}
#ifdef __WIN__
@@ -4627,7 +4627,7 @@ void do_delimiter(struct st_command* command)
die("Can't set empty delimiter");
strmake(delimiter, p, sizeof(delimiter) - 1);
- delimiter_length= strlen(delimiter);
+ delimiter_length= (uint) strlen(delimiter);
DBUG_PRINT("exit", ("delimiter: %s", delimiter));
command->last_argument= p + delimiter_length;
@@ -4753,9 +4753,11 @@ int read_line(char *buf, int size)
}
else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
- (uchar*) buf, min(5, p - buf), 0) ||
+ (uchar*) buf, min(5, (uint) (p - buf)),
+ 0) ||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
- (uchar*) buf, min(2, p - buf), 0))))
+ (uchar*) buf, min(2, (uint) (p - buf)),
+ 0))))
{
/* Only if and while commands can be terminated by { */
*p++= c;
@@ -5117,7 +5119,7 @@ int read_command(struct st_command** command_ptr)
command->first_argument= p;
command->end= strend(command->query);
- command->query_len= (command->end - command->query);
+ command->query_len= (uint) (command->end - command->query);
parser.read_lines++;
DBUG_RETURN(0);
}
@@ -6459,7 +6461,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
else
{
query = command->query;
- query_len = strlen(query);
+ query_len = (uint) strlen(query);
}
/*
@@ -6520,7 +6522,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/
view_created= 1;
query= (char*)"SELECT * FROM mysqltest_tmp_v";
- query_len = strlen(query);
+ query_len = (uint) strlen(query);
/*
Collect warnings from create of the view that should otherwise
@@ -6568,7 +6570,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
sp_created= 1;
query= (char*)"CALL mysqltest_tmp_sp()";
- query_len = strlen(query);
+ query_len = (uint) strlen(query);
}
dynstr_free(&query_str);
}
@@ -6661,7 +6663,7 @@ void init_re_comp(my_regex_t *re, const char* str)
if (err)
{
char erbuf[100];
- int len= my_regerror(err, re, erbuf, sizeof(erbuf));
+ size_t len= my_regerror(err, re, erbuf, sizeof(erbuf));
die("error %s, %d/%d `%s'\n",
re_eprint(err), len, (int)sizeof(erbuf), erbuf);
}
@@ -6717,7 +6719,7 @@ int match_re(my_regex_t *re, char *str)
{
char erbuf[100];
- int len= my_regerror(err, re, erbuf, sizeof(erbuf));
+ size_t len= my_regerror(err, re, erbuf, sizeof(erbuf));
die("error %s, %d/%d `%s'\n",
re_eprint(err), len, (int)sizeof(erbuf), erbuf);
}
@@ -7579,7 +7581,7 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
if (!(rep_str = ((REPLACE_STRING*) rep_pos))->replace_string)
{
/* No match found */
- dynstr_append_mem(ds, start, from - start - 1);
+ dynstr_append_mem(ds, start, (uint) (from - start - 1));
DBUG_PRINT("exit", ("Found no more string to replace, appended: %s", start));
DBUG_VOID_RETURN;
}
@@ -7590,11 +7592,11 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
rep_str->from_offset, rep_str->replace_string));
/* Append part of original string before replace string */
- dynstr_append_mem(ds, start, (from - rep_str->to_offset) - start);
+ dynstr_append_mem(ds, start, (uint) ((from - rep_str->to_offset) - start));
/* Append replace string */
dynstr_append_mem(ds, rep_str->replace_string,
- strlen(rep_str->replace_string));
+ (uint) strlen(rep_str->replace_string));
if (!*(from-=rep_str->from_offset) && rep_pos->found != 2)
{
@@ -7689,7 +7691,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
char* buf,*expr_end;
char* p;
char* buf_p;
- uint expr_len= strlen(expr);
+ size_t expr_len= strlen(expr);
char last_c = 0;
struct st_regex reg;
@@ -7866,7 +7868,7 @@ void free_replace_regex()
*/
#define SECURE_REG_BUF if (buf_len < need_buf_len) \
{ \
- int off= res_p - buf; \
+ size_t off= res_p - buf; \
buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE)); \
res_p= buf + off; \
buf_len= need_buf_len; \
@@ -7898,7 +7900,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
char *res_p,*str_p,*str_end;
buf_len= *buf_len_p;
- len= strlen(string);
+ len= (uint) strlen(string);
str_end= string + len;
/* start with a buffer of a reasonable size that hopefully will not
@@ -7950,7 +7952,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
we need at least what we have so far in the buffer + the part
before this match
*/
- need_buf_len= (res_p - buf) + (int) subs[0].rm_so;
+ need_buf_len= (uint) (res_p - buf) + (int) subs[0].rm_so;
/* on this pass, calculate the memory for the result buffer */
while (expr_p < replace_end)
@@ -8040,8 +8042,8 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
}
else /* no match this time, just copy the string as is */
{
- int left_in_str= str_end-str_p;
- need_buf_len= (res_p-buf) + left_in_str;
+ size_t left_in_str= str_end-str_p;
+ need_buf_len= (uint) ((res_p-buf) + left_in_str);
SECURE_REG_BUF
memcpy(res_p,str_p,left_in_str);
res_p += left_in_str;
@@ -8708,7 +8710,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
if (!multi_reg_replace(glob_replace_regex, (char*)val))
{
val= glob_replace_regex->buf;
- len= strlen(val);
+ len= (uint) strlen(val);
}
}
@@ -8725,7 +8727,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds,
/* Append zero-terminated string to ds, with optional replace */
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
{
- replace_dynstr_append_mem(ds, val, strlen(val));
+ replace_dynstr_append_mem(ds, val, (uint) strlen(val));
}
/* Append uint to ds, with optional replace */
@@ -8733,7 +8735,7 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
{
char buff[22]; /* This should be enough for any int */
char *end= longlong10_to_str(val, buff, 10);
- replace_dynstr_append_mem(ds, buff, end - buff);
+ replace_dynstr_append_mem(ds, buff, (uint) (end - buff));
}
@@ -8771,7 +8773,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
while (*start && *start != '\n')
start++;
start++; /* Skip past \n */
- dynstr_append_mem(ds, ds_input->str, start - ds_input->str);
+ dynstr_append_mem(ds, ds_input->str, (uint) (start - ds_input->str));
/* Insert line(s) in array */
while (*start)
diff --git a/client/readline.cc b/client/readline.cc
index ad42ed2ee10..726d9cd9415 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -24,7 +24,7 @@ static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size,
ulong max_size);
static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str);
static uint fill_buffer(LINE_BUFFER *buffer);
-static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length);
+static char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated);
LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
@@ -42,12 +42,13 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
}
-char *batch_readline(LINE_BUFFER *line_buff)
+char *batch_readline(LINE_BUFFER *line_buff, bool *truncated)
{
char *pos;
ulong out_length;
+ DBUG_ASSERT(truncated != NULL);
- if (!(pos=intern_read_line(line_buff,&out_length)))
+ if (!(pos=intern_read_line(line_buff,&out_length, truncated)))
return 0;
if (out_length && pos[out_length-1] == '\n')
if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */
@@ -149,6 +150,14 @@ static uint fill_buffer(LINE_BUFFER *buffer)
read_count=(buffer->bufread - bufbytes)/IO_SIZE;
if ((read_count*=IO_SIZE))
break;
+ if (buffer->bufread * 2 > buffer->max_size)
+ {
+ /*
+ So we must grow the buffer but we cannot due to the max_size limit.
+ Return 0 w/o setting buffer->eof to signal this condition.
+ */
+ return 0;
+ }
buffer->bufread *= 2;
if (!(buffer->buffer = (char*) my_realloc(buffer->buffer,
buffer->bufread+1,
@@ -172,11 +181,15 @@ static uint fill_buffer(LINE_BUFFER *buffer)
DBUG_PRINT("fill_buff", ("Got %d bytes", read_count));
- /* Kludge to pretend every nonempty file ends with a newline. */
- if (!read_count && bufbytes && buffer->end[-1] != '\n')
+ if (!read_count)
{
- buffer->eof = read_count = 1;
- *buffer->end = '\n';
+ buffer->eof = 1;
+ /* Kludge to pretend every nonempty file ends with a newline. */
+ if (bufbytes && buffer->end[-1] != '\n')
+ {
+ read_count = 1;
+ *buffer->end = '\n';
+ }
}
buffer->end_of_line=(buffer->start_of_line=buffer->buffer)+bufbytes;
buffer->end+=read_count;
@@ -186,7 +199,7 @@ static uint fill_buffer(LINE_BUFFER *buffer)
-char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
+char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated)
{
char *pos;
uint length;
@@ -200,14 +213,23 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length)
pos++;
if (pos == buffer->end)
{
- if ((uint) (pos - buffer->start_of_line) < buffer->max_size)
+ /*
+ fill_buffer() can return 0 either on EOF in which case we abort
+ or when the internal buffer has hit the size limit. In the latter case
+ return what we have read so far and signal string truncation.
+ */
+ if (!(length=fill_buffer(buffer)) || length == (uint) -1)
{
- if (!(length=fill_buffer(buffer)) || length == (uint) -1)
- DBUG_RETURN(0);
- continue;
+ if (buffer->eof)
+ DBUG_RETURN(0);
}
+ else
+ continue;
pos--; /* break line here */
+ *truncated= 1;
}
+ else
+ *truncated= 0;
buffer->end_of_line=pos+1;
*out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line);
DBUG_RETURN(buffer->start_of_line);
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 9d887ff031c..4967538ad3b 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -71,25 +71,22 @@ bool String::realloc(uint32 alloc_length)
char *new_ptr;
if (alloced)
{
- if ((new_ptr= (char*) my_realloc(Ptr,len,MYF(MY_WME))))
- {
- Ptr=new_ptr;
- Alloced_length=len;
- }
- else
- return TRUE; // Signal error
+ if (!(new_ptr= (char*) my_realloc(Ptr,len,MYF(MY_WME))))
+ return TRUE; // Signal error
}
else if ((new_ptr= (char*) my_malloc(len,MYF(MY_WME))))
{
+ if (str_length > len - 1)
+ str_length= 0;
if (str_length) // Avoid bugs in memcpy on AIX
memcpy(new_ptr,Ptr,str_length);
new_ptr[str_length]=0;
- Ptr=new_ptr;
- Alloced_length=len;
alloced=1;
}
else
return TRUE; // Signal error
+ Ptr= new_ptr;
+ Alloced_length= len;
}
Ptr[alloc_length]=0; // This make other funcs shorter
return FALSE;
@@ -125,7 +122,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
str_charset=cs;
if (decimals >= NOT_FIXED_DEC)
{
- uint32 len= my_sprintf(buff,(buff, "%.14g",num));// Enough for a DATETIME
+ uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
}
#ifdef HAVE_FCONVERT
@@ -468,7 +465,7 @@ bool String::append(const char *s,uint32 arg_length)
bool String::append(const char *s)
{
- return append(s, strlen(s));
+ return append(s, (uint) strlen(s));
}
@@ -677,7 +674,7 @@ void String::qs_append(const char *str, uint32 len)
void String::qs_append(double d)
{
char *buff = Ptr + str_length;
- str_length+= my_sprintf(buff, (buff, "%.14g", d));
+ str_length+= my_sprintf(buff, (buff, "%.15g", d));
}
void String::qs_append(double *d)
diff --git a/configure.in b/configure.in
index 9591b5bbc5a..ed252d4fc46 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
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.79)
+AM_INIT_AUTOMAKE(mysql, 5.0.80)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
@@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
-NDB_VERSION_BUILD=79
+NDB_VERSION_BUILD=80
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
@@ -825,7 +825,7 @@ AC_TYPE_SIZE_T
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
+AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
memory.h pwd.h select.h \
stdlib.h stddef.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
@@ -2060,7 +2060,7 @@ AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
- fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
+ fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
diff --git a/extra/comp_err.c b/extra/comp_err.c
index 79f591e45fb..8814a045f36 100644
--- a/extra/comp_err.c
+++ b/extra/comp_err.c
@@ -660,7 +660,7 @@ static ha_checksum checksum_format_specifier(const char* msg)
case 'u':
case 'x':
case 's':
- chksum= my_checksum(chksum, start, p-start);
+ chksum= my_checksum(chksum, start, (uint) (p - start));
start= 0; /* Not in format specifier anymore */
break;
diff --git a/extra/perror.c b/extra/perror.c
index 37d6b45c8dd..ba638aca819 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -97,6 +97,17 @@ static HA_ERRORS ha_errlist[]=
{ 150,"Foreign key constraint is incorrectly formed"},
{ 151,"Cannot add a child row"},
{ 152,"Cannot delete a parent row"},
+ { 153,"No savepoint with that name"},
+ { 154,"Non unique key block size"},
+ { 155,"The table does not exist in engine"},
+ { 156,"The table existed in storage engine"},
+ { 157,"Could not connect to storage engine"},
+ { 158,"NULLs are not supported in spatial index"},
+ { 159,"The table changed in storage engine"},
+ { 160,"The table changed in storage engine"},
+ { 161,"The table is not writable"},
+ { 162,"Failed to get the next autoinc value"},
+ { 163,"Failed to set the row autoinc value"},
{ -30999, "DB_INCOMPLETE: Sync didn't finish"},
{ -30998, "DB_KEYEMPTY: Key/data deleted or never created"},
{ -30997, "DB_KEYEXIST: The key/data pair already exists"},
diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp
index 0c3f23b0cb8..66107dbe0a9 100644
--- a/extra/yassl/src/buffer.cpp
+++ b/extra/yassl/src/buffer.cpp
@@ -106,7 +106,7 @@ void input_buffer::add_size(uint i)
uint input_buffer::get_capacity() const
{
- return end_ - buffer_;
+ return (uint) (end_ - buffer_);
}
@@ -223,7 +223,7 @@ uint output_buffer::get_size() const
uint output_buffer::get_capacity() const
{
- return end_ - buffer_;
+ return (uint) (end_ - buffer_);
}
diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp
index 5eacf9083f9..8caca8f9649 100644
--- a/extra/yassl/src/cert_wrapper.cpp
+++ b/extra/yassl/src/cert_wrapper.cpp
@@ -236,7 +236,7 @@ uint CertManager::get_privateKeyLength() const
int CertManager::Validate()
{
CertList::reverse_iterator last = peerList_.rbegin();
- int count = peerList_.size();
+ size_t count= peerList_.size();
while ( count > 1 ) {
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
@@ -269,13 +269,13 @@ int CertManager::Validate()
else
peerKeyType_ = dsa_sa_algo;
- int iSz = strlen(cert.GetIssuer()) + 1;
- int sSz = strlen(cert.GetCommonName()) + 1;
- int bSz = strlen(cert.GetBeforeDate()) + 1;
- int aSz = strlen(cert.GetAfterDate()) + 1;
+ size_t iSz= strlen(cert.GetIssuer()) + 1;
+ size_t sSz= strlen(cert.GetCommonName()) + 1;
+ size_t bSz= strlen(cert.GetBeforeDate()) + 1;
+ size_t aSz= strlen(cert.GetAfterDate()) + 1;
peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(),
- sSz, cert.GetBeforeDate(), bSz,
- cert.GetAfterDate(), aSz);
+ sSz, cert.GetBeforeDate(), (int) bSz,
+ cert.GetAfterDate(), (int) aSz);
}
return 0;
}
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index f09a43be56e..781cfa36a70 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -604,13 +604,13 @@ char* X509_NAME_oneline(X509_NAME* name, char* buffer, int sz)
{
if (!name->GetName()) return buffer;
- int len = strlen(name->GetName()) + 1;
- int copySz = min(len, sz);
+ size_t len= strlen(name->GetName()) + 1;
+ int copySz = min((int) len, sz);
if (!buffer) {
buffer = (char*)malloc(len);
if (!buffer) return buffer;
- copySz = len;
+ copySz = (int) len;
}
if (copySz == 0)
diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp
index b43d9c27355..4ee0fb99d3a 100644
--- a/extra/yassl/src/yassl_imp.cpp
+++ b/extra/yassl/src/yassl_imp.cpp
@@ -532,7 +532,7 @@ void Parameters::SetCipherNames()
for (int j = 0; j < suites; j++) {
int index = suites_[j*2 + 1]; // every other suite is suite id
- int len = strlen(cipher_names[index]) + 1;
+ size_t len = strlen(cipher_names[index]) + 1;
strncpy(cipher_list_[pos++], cipher_names[index], len);
}
cipher_list_[pos][0] = 0;
diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp
index 0b6cb89e77e..ba8ee8f66ab 100644
--- a/extra/yassl/src/yassl_int.cpp
+++ b/extra/yassl/src/yassl_int.cpp
@@ -1034,7 +1034,7 @@ void SSL::fillData(Data& data)
{
if (GetError()) return;
uint dataSz = data.get_length(); // input, data size to fill
- uint elements = buffers_.getData().size();
+ size_t elements = buffers_.getData().size();
data.set_length(0); // output, actual data filled
dataSz = min(dataSz, bufferedData());
@@ -1064,7 +1064,7 @@ void SSL::PeekData(Data& data)
{
if (GetError()) return;
uint dataSz = data.get_length(); // input, data size to fill
- uint elements = buffers_.getData().size();
+ size_t elements = buffers_.getData().size();
data.set_length(0); // output, actual data filled
dataSz = min(dataSz, bufferedData());
@@ -1098,7 +1098,7 @@ void SSL::flushBuffer()
buffers_.getHandShake().end(),
SumBuffer()).total_;
output_buffer out(sz);
- uint elements = buffers_.getHandShake().size();
+ size_t elements = buffers_.getHandShake().size();
for (uint i = 0; i < elements; i++) {
output_buffer* front = buffers_.getHandShake().front();
@@ -1906,7 +1906,7 @@ bool SSL_CTX::SetCipherList(const char* list)
int idx = 0;
for(;;) {
- int len;
+ size_t len;
prev = haystack;
haystack = strstr(haystack, needle);
@@ -2354,10 +2354,10 @@ ASN1_STRING* X509_NAME::GetEntry(int i)
memcpy(entry_.data, &name_[i], sz_ - i);
if (entry_.data[sz_ -i - 1]) {
entry_.data[sz_ - i] = 0;
- entry_.length = sz_ - i;
+ entry_.length = (int) (sz_ - i);
}
else
- entry_.length = sz_ - i - 1;
+ entry_.length = (int) (sz_ - i - 1);
entry_.type = 0;
return &entry_;
diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp
index 529a91eee08..bb34db5e07f 100644
--- a/extra/yassl/taocrypt/include/block.hpp
+++ b/extra/yassl/taocrypt/include/block.hpp
@@ -78,7 +78,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize,
if (preserve) {
A b = A();
typename A::pointer newPointer = b.allocate(newSize, 0);
- memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize));
+ memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize));
a.deallocate(p, oldSize);
STL::swap(a, b);
return newPointer;
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index cb597c41552..c221ce3d6cb 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -288,7 +288,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
r = buckets[i][buckets[i].size()-1];
if (buckets[i].size() > 1)
{
- for (int j = buckets[i].size()-2; j >= 1; j--)
+ for (int j= (unsigned int) (buckets[i].size()) - 2; j >= 1; j--)
{
Accumulate(buckets[i][j], buckets[i][j+1]);
Accumulate(r, buckets[i][j]);
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp
index a06ab658c7b..3b1c1c2136a 100644
--- a/extra/yassl/taocrypt/src/asn.cpp
+++ b/extra/yassl/taocrypt/src/asn.cpp
@@ -213,7 +213,7 @@ void PublicKey::AddToEnd(const byte* data, word32 len)
Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h)
: key_(k, kSz)
{
- int sz = strlen(n);
+ size_t sz = strlen(n);
memcpy(name_, n, sz);
name_[sz] = 0;
diff --git a/heap/hp_write.c b/heap/hp_write.c
index 19215fcf017..6aa34acf2c3 100644
--- a/heap/hp_write.c
+++ b/heap/hp_write.c
@@ -69,7 +69,7 @@ int heap_write(HP_INFO *info, const byte *record)
err:
if (my_errno == HA_ERR_FOUND_DUPP_KEY)
DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef)));
- info->errkey= keydef - share->keydef;
+ info->errkey= (int) (keydef - share->keydef);
/*
We don't need to delete non-inserted key from rb-tree. Also, if
we got ENOMEM, the key wasn't inserted, so don't try to delete it
diff --git a/include/config-win.h b/include/config-win.h
index eba699159c7..ab463a7c142 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -31,7 +31,6 @@ functions */
#include <sys/locking.h>
#include <windows.h>
-#include <math.h> /* Because of rint() */
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
@@ -223,13 +222,6 @@ typedef uint rf_SetTimer;
#define inline __inline
#endif /* __cplusplus */
-inline double rint(double nr)
-{
- double f = floor(nr);
- double c = ceil(nr);
- return (((c-nr) >= (nr-f)) ? f :c);
-}
-
#ifdef _WIN64
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
@@ -281,7 +273,6 @@ inline ulonglong double2ulonglong(double d)
#define HAVE_FLOAT_H
#define HAVE_LIMITS_H
#define HAVE_STDDEF_H
-#define HAVE_RINT /* defined in this file */
#define NO_FCNTL_NONBLOCK /* No FCNTL */
#define HAVE_ALLOCA
#define HAVE_STRPBRK
diff --git a/include/my_base.h b/include/my_base.h
index 9240b01a9f1..e45a73d68ed 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -377,6 +377,7 @@ enum ha_base_keytype {
#define HA_ERR_TABLE_READONLY 161 /* The table is not writable */
#define HA_ERR_AUTOINC_READ_FAILED 162/* Failed to get the next autoinc value */
#define HA_ERR_AUTOINC_ERANGE 163 /* Failed to set the row autoinc value */
+/* You must also add numbers and description to extra/perror.c ! */
#define HA_ERR_LAST 163 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
diff --git a/include/my_global.h b/include/my_global.h
index 845ae042a42..f5a3016bb1e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -324,6 +324,9 @@ C_MODE_END
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
+#ifdef HAVE_FENV_H
+#include <fenv.h> /* For fesetround() */
+#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -484,8 +487,39 @@ typedef unsigned short ushort;
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#ifndef HAVE_RINT
-#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))
-#endif
+/**
+ All integers up to this number can be represented exactly as double precision
+ values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
+*/
+#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
+
+/**
+ rint(3) implementation for platforms that do not have it.
+ Always rounds to the nearest integer with ties being rounded to the nearest
+ even integer to mimic glibc's rint() behavior in the "round-to-nearest"
+ FPU mode. Hardware-specific optimizations are possible (frndint on x86).
+ Unlike this implementation, hardware will also honor the FPU rounding mode.
+*/
+
+static inline double rint(double x)
+{
+ double f, i;
+ f = modf(x, &i);
+ /*
+ All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
+ no need to check it.
+ */
+ if (x > 0.0)
+ i += (double) ((f > 0.5) || (f == 0.5 &&
+ i <= (double) MAX_EXACT_INTEGER &&
+ (longlong) i % 2));
+ else
+ i -= (double) ((f < -0.5) || (f == -0.5 &&
+ i >= (double) -MAX_EXACT_INTEGER &&
+ (longlong) i % 2));
+ return i;
+}
+#endif /* HAVE_RINT */
/* Define some general constants */
#ifndef TRUE
diff --git a/include/my_md5.h b/include/my_md5.h
index f92976b3beb..6458f27c5cc 100644
--- a/include/my_md5.h
+++ b/include/my_md5.h
@@ -13,80 +13,42 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/* See md5.c for explanation and copyright information. */
-/* MD5.H - header file for MD5C.C
+/*
+ * $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
*/
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
+/* Unlike previous versions of this code, uint32 need not be exactly
+ 32 bits, merely 32 bits or more. Choosing a data type which is 32
+ bits instead of 64 is not important; speed is considerably more
+ important. ANSI guarantees that "unsigned long" will be big enough,
+ and always using it seems to have few disadvantages. */
+typedef uint32 cvs_uint32;
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* GLOBAL.H - RSAREF types and constants
- */
-
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
-The following makes PROTOTYPES default to 0 if it has not already
- been defined with C compiler flags.
- */
-
-/* egcs 1.1.2 under linux didn't defined it.... :( */
-
-#ifndef PROTOTYPES
-#define PROTOTYPES 1 /* Assume prototypes */
-#endif
-
-/* POINTER defines a generic pointer type */
-typedef unsigned char *POINTER;
-
-/* UINT2 defines a two byte word */
-typedef uint16 UINT2; /* Fix for MySQL / Alpha */
-
-/* UINT4 defines a four byte word */
-typedef uint32 UINT4; /* Fix for MySQL / Alpha */
-
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
-If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
-/* MD5 context. */
typedef struct {
- UINT4 state[4]; /* state (ABCD) */
- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} my_MD5_CTX;
+ cvs_uint32 buf[4];
+ cvs_uint32 bits[2];
+ unsigned char in[64];
+} my_MD5Context;
#ifdef __cplusplus
extern "C" {
#endif
- void my_MD5Init PROTO_LIST ((my_MD5_CTX *));
- void my_MD5Update PROTO_LIST
- ((my_MD5_CTX *, unsigned char *, unsigned int));
- void my_MD5Final PROTO_LIST ((unsigned char [16], my_MD5_CTX *));
+void my_MD5Init (my_MD5Context *context);
+void my_MD5Update (my_MD5Context *context,
+ unsigned char const *buf, unsigned len);
+void my_MD5Final (unsigned char digest[16],
+ my_MD5Context *context);
#ifdef __cplusplus
}
#endif
+
+#define MY_MD5_HASH(digest,buf,len) \
+do { \
+ my_MD5Context ctx; \
+ my_MD5Init (&ctx); \
+ my_MD5Update (&ctx, buf, len); \
+ my_MD5Final (digest, &ctx); \
+} while (0)
diff --git a/include/my_sys.h b/include/my_sys.h
index 5dc73bf84d9..35c4eb5f2b1 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -250,7 +250,7 @@ extern int NEAR my_umask, /* Default creation mask */
NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
NEAR my_dont_interrupt; /* call remember_intr when set */
extern my_bool NEAR mysys_uses_curses, my_use_symdir;
-extern ulong sf_malloc_cur_memory, sf_malloc_max_memory;
+extern size_t sf_malloc_cur_memory, sf_malloc_max_memory;
extern ulong my_default_record_cache_size;
extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
@@ -636,6 +636,7 @@ extern int nt_share_delete(const char *name,myf MyFlags);
extern void TERMINATE(FILE *file);
#endif
extern void init_glob_errs(void);
+extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,myf MyFlags);
diff --git a/innobase/buf/buf0lru.c b/innobase/buf/buf0lru.c
index 0f632f0752a..6984c196701 100644
--- a/innobase/buf/buf0lru.c
+++ b/innobase/buf/buf0lru.c
@@ -42,6 +42,11 @@ initial segment in buf_LRU_get_recent_limit */
#define BUF_LRU_INITIAL_RATIO 8
+/* When dropping the search hash index entries before deleting an ibd
+file, we build a local array of pages belonging to that tablespace
+in the buffer pool. Following is the size of that array. */
+#define BUF_LRU_DROP_SEARCH_HASH_SIZE 1024
+
/* If we switch on the InnoDB monitor because there are too few available
frames in the buffer pool, we set this to TRUE */
ibool buf_lru_switched_on_innodb_mon = FALSE;
@@ -66,6 +71,120 @@ buf_LRU_block_free_hashed_page(
be in a state where it can be freed */
/**********************************************************************
+Attempts to drop page hash index on a batch of pages belonging to a
+particular space id. */
+static
+void
+buf_LRU_drop_page_hash_batch(
+/*=========================*/
+ ulint id, /* in: space id */
+ const ulint* arr, /* in: array of page_no */
+ ulint count) /* in: number of entries in array */
+{
+ ulint i;
+
+ ut_ad(arr != NULL);
+ ut_ad(count <= BUF_LRU_DROP_SEARCH_HASH_SIZE);
+
+ for (i = 0; i < count; ++i) {
+ btr_search_drop_page_hash_when_freed(id, arr[i]);
+ }
+}
+
+/**********************************************************************
+When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page
+hash index entries belonging to that table. This function tries to
+do that in batch. Note that this is a 'best effort' attempt and does
+not guarantee that ALL hash entries will be removed. */
+static
+void
+buf_LRU_drop_page_hash_for_tablespace(
+/*==================================*/
+ ulint id) /* in: space id */
+{
+ buf_block_t* block;
+ ulint* page_arr;
+ ulint num_entries;
+
+ page_arr = ut_malloc(sizeof(ulint)
+ * BUF_LRU_DROP_SEARCH_HASH_SIZE);
+ mutex_enter(&buf_pool->mutex);
+
+scan_again:
+ num_entries = 0;
+ block = UT_LIST_GET_LAST(buf_pool->LRU);
+
+ while (block != NULL) {
+ buf_block_t* prev_block;
+
+ mutex_enter(&block->mutex);
+ prev_block = UT_LIST_GET_PREV(LRU, block);
+
+ ut_a(block->state == BUF_BLOCK_FILE_PAGE);
+
+ if (block->space != id
+ || block->buf_fix_count > 0
+ || block->io_fix != 0) {
+ /* We leave the fixed pages as is in this scan.
+ To be dealt with later in the final scan. */
+ mutex_exit(&block->mutex);
+ goto next_page;
+ }
+
+ ut_ad(block->space == id);
+ if (block->is_hashed) {
+
+ /* Store the offset(i.e.: page_no) in the array
+ so that we can drop hash index in a batch
+ later. */
+ page_arr[num_entries] = block->offset;
+ mutex_exit(&block->mutex);
+ ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
+ ++num_entries;
+
+ if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
+ goto next_page;
+ }
+ /* Array full. We release the buf_pool->mutex to
+ obey the latching order. */
+ mutex_exit(&buf_pool->mutex);
+
+ buf_LRU_drop_page_hash_batch(id, page_arr,
+ num_entries);
+ num_entries = 0;
+ mutex_enter(&buf_pool->mutex);
+ } else {
+ mutex_exit(&block->mutex);
+ }
+
+next_page:
+ /* Note that we may have released the buf_pool->mutex
+ above after reading the prev_block during processing
+ of a page_hash_batch (i.e.: when the array was full).
+ This means that prev_block can change in LRU list.
+ This is OK because this function is a 'best effort'
+ to drop as many search hash entries as possible and
+ it does not guarantee that ALL such entries will be
+ dropped. */
+ block = prev_block;
+
+ /* If, however, block has been removed from LRU list
+ to the free list then we should restart the scan.
+ block->state is protected by buf_pool->mutex. */
+ if (block && block->state != BUF_BLOCK_FILE_PAGE) {
+ ut_a(num_entries == 0);
+ goto scan_again;
+ }
+ }
+
+ mutex_exit(&buf_pool->mutex);
+
+ /* Drop any remaining batch of search hashed pages. */
+ buf_LRU_drop_page_hash_batch(id, page_arr, num_entries);
+ ut_free(page_arr);
+}
+
+/**********************************************************************
Invalidates all pages belonging to a given tablespace when we are deleting
the data file(s) of that tablespace. */
@@ -78,6 +197,14 @@ buf_LRU_invalidate_tablespace(
ulint page_no;
ibool all_freed;
+ /* Before we attempt to drop pages one by one we first
+ attempt to drop page hash index entries in batches to make
+ it more efficient. The batching attempt is a best effort
+ attempt and does not guarantee that all pages hash entries
+ will be dropped. We get rid of remaining page hash entries
+ one by one below. */
+ buf_LRU_drop_page_hash_for_tablespace(id);
+
scan_again:
mutex_enter(&(buf_pool->mutex));
diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
index e20d8b6e83a..12d99734796 100644
--- a/innobase/dict/dict0crea.c
+++ b/innobase/dict/dict0crea.c
@@ -1249,7 +1249,8 @@ dict_create_or_check_foreign_constraint_tables(void)
fprintf(stderr, "InnoDB: error %lu in creation\n",
(ulong) error);
- ut_a(error == DB_OUT_OF_FILE_SPACE);
+ ut_a(error == DB_OUT_OF_FILE_SPACE
+ || error == DB_TOO_MANY_CONCURRENT_TRXS);
fprintf(stderr, "InnoDB: creation failed\n");
fprintf(stderr, "InnoDB: tablespace is full\n");
diff --git a/innobase/include/db0err.h b/innobase/include/db0err.h
index 247c5de67db..68bdcdc8b7f 100644
--- a/innobase/include/db0err.h
+++ b/innobase/include/db0err.h
@@ -70,6 +70,11 @@ Created 5/24/1996 Heikki Tuuri
work with e.g., FT indexes created by
a later version of the engine. */
+#define DB_TOO_MANY_CONCURRENT_TRXS 47 /* when InnoDB runs out of the
+ preconfigured undo slots, this can
+ only happen when there are too many
+ concurrent transactions */
+
/* The following are partial failure codes */
#define DB_FAIL 1000
#define DB_OVERFLOW 1001
diff --git a/innobase/include/pars0pars.h b/innobase/include/pars0pars.h
index 62a41a881e8..5c81e331487 100644
--- a/innobase/include/pars0pars.h
+++ b/innobase/include/pars0pars.h
@@ -484,7 +484,7 @@ struct for_node_struct{
definition */
que_node_t* loop_start_limit;/* initial value of loop variable */
que_node_t* loop_end_limit; /* end value of loop variable */
- int loop_end_value; /* evaluated value for the end value:
+ lint loop_end_value; /* evaluated value for the end value:
it is calculated only when the loop
is entered, and will not change within
the loop */
diff --git a/innobase/include/rem0rec.h b/innobase/include/rem0rec.h
index 69b397c9682..b573c5d4c3b 100644
--- a/innobase/include/rem0rec.h
+++ b/innobase/include/rem0rec.h
@@ -368,8 +368,9 @@ rec_set_field_extern_bits(
/***************************************************************
This is used to modify the value of an already existing field in a record.
The previous value must have exactly the same size as the new value. If len
-is UNIV_SQL_NULL then the field is treated as an SQL null for old-style
-records. For new-style records, len must not be UNIV_SQL_NULL. */
+is UNIV_SQL_NULL then the field is treated as an SQL null.
+For records in ROW_FORMAT=COMPACT (new-style records), len must not be
+UNIV_SQL_NULL unless the field already is SQL null. */
UNIV_INLINE
void
rec_set_nth_field(
@@ -378,11 +379,7 @@ rec_set_nth_field(
const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint n, /* in: index number of the field */
const void* data, /* in: pointer to the data if not SQL null */
- ulint len); /* in: length of the data or UNIV_SQL_NULL.
- If not SQL null, must have the same
- length as the previous value.
- If SQL null, previous value must be
- SQL null. */
+ ulint len); /* in: length of the data or UNIV_SQL_NULL */
/**************************************************************
The following function returns the data size of an old-style physical
record, that is the sum of field lengths. SQL null fields
diff --git a/innobase/include/rem0rec.ic b/innobase/include/rem0rec.ic
index 1abbb503bab..64c91724386 100644
--- a/innobase/include/rem0rec.ic
+++ b/innobase/include/rem0rec.ic
@@ -1204,8 +1204,9 @@ rec_get_nth_field_size(
/***************************************************************
This is used to modify the value of an already existing field in a record.
The previous value must have exactly the same size as the new value. If len
-is UNIV_SQL_NULL then the field is treated as an SQL null for old-style
-records. For new-style records, len must not be UNIV_SQL_NULL. */
+is UNIV_SQL_NULL then the field is treated as an SQL null.
+For records in ROW_FORMAT=COMPACT (new-style records), len must not be
+UNIV_SQL_NULL unless the field already is SQL null. */
UNIV_INLINE
void
rec_set_nth_field(
@@ -1215,11 +1216,7 @@ rec_set_nth_field(
ulint n, /* in: index number of the field */
const void* data, /* in: pointer to the data
if not SQL null */
- ulint len) /* in: length of the data or UNIV_SQL_NULL.
- If not SQL null, must have the same
- length as the previous value.
- If SQL null, previous value must be
- SQL null. */
+ ulint len) /* in: length of the data or UNIV_SQL_NULL */
{
byte* data2;
ulint len2;
@@ -1227,9 +1224,11 @@ rec_set_nth_field(
ut_ad(rec);
ut_ad(rec_offs_validate(rec, NULL, offsets));
- if (len == UNIV_SQL_NULL) {
- ut_ad(!rec_offs_comp(offsets));
- rec_set_nth_field_sql_null(rec, n);
+ if (UNIV_UNLIKELY(len == UNIV_SQL_NULL)) {
+ if (!rec_offs_nth_sql_null(offsets, n)) {
+ ut_a(!rec_offs_comp(offsets));
+ rec_set_nth_field_sql_null(rec, n);
+ }
return;
}
diff --git a/innobase/include/trx0undo.h b/innobase/include/trx0undo.h
index 4f1847aa88c..152a09c0f76 100644
--- a/innobase/include/trx0undo.h
+++ b/innobase/include/trx0undo.h
@@ -222,13 +222,16 @@ trx_undo_lists_init(
Assigns an undo log for a transaction. A new undo log is created or a cached
undo log reused. */
-trx_undo_t*
+ulint
trx_undo_assign_undo(
/*=================*/
- /* out: the undo log, NULL if did not succeed: out of
- space */
- trx_t* trx, /* in: transaction */
- ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
+ /* out: DB_SUCCESS if undo log assign
+ * successful, possible error codes are:
+ * ER_TOO_MANY_CONCURRENT_TRXS
+ * DB_OUT_OF_FILE_SPAC
+ * DB_OUT_OF_MEMORY */
+ trx_t* trx, /* in: transaction */
+ ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
/**********************************************************************
Sets the state of the undo log segment at a transaction finish. */
diff --git a/innobase/pars/pars0pars.c b/innobase/pars/pars0pars.c
index c62184abd85..562870b6bed 100644
--- a/innobase/pars/pars0pars.c
+++ b/innobase/pars/pars0pars.c
@@ -1679,8 +1679,8 @@ pars_get_lex_chars(
{
int len;
- len = pars_sym_tab_global->string_len
- - pars_sym_tab_global->next_char_pos;
+ len= (uint) (pars_sym_tab_global->string_len
+ - pars_sym_tab_global->next_char_pos);
if (len == 0) {
#ifdef YYDEBUG
/* fputs("SQL string ends\n", stderr); */
diff --git a/innobase/rem/rem0cmp.c b/innobase/rem/rem0cmp.c
index 6a463b7d4cf..a0c28e117ac 100644
--- a/innobase/rem/rem0cmp.c
+++ b/innobase/rem/rem0cmp.c
@@ -587,7 +587,7 @@ cmp_dtuple_rec_with_match(
dtuple_byte = cmp_collate(dtuple_byte);
}
- ret = dtuple_byte - rec_byte;
+ ret = (uint) (dtuple_byte - rec_byte);
if (UNIV_UNLIKELY(ret)) {
if (ret < 0) {
ret = -1;
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 4bc5f39359c..d7213b25145 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -494,7 +494,8 @@ handle_new_error:
/* MySQL will roll back the latest SQL statement */
} else if (err == DB_ROW_IS_REFERENCED
|| err == DB_NO_REFERENCED_ROW
- || err == DB_CANNOT_ADD_CONSTRAINT) {
+ || err == DB_CANNOT_ADD_CONSTRAINT
+ || err == DB_TOO_MANY_CONCURRENT_TRXS) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c
index 3b7171e6038..44b734625dd 100644
--- a/innobase/trx/trx0rec.c
+++ b/innobase/trx/trx0rec.c
@@ -1013,6 +1013,7 @@ trx_undo_report_row_operation(
ibool is_insert;
trx_rseg_t* rseg;
mtr_t mtr;
+ ulint err = DB_SUCCESS;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
@@ -1024,7 +1025,7 @@ trx_undo_report_row_operation(
*roll_ptr = ut_dulint_zero;
- return(DB_SUCCESS);
+ return(err);
}
ut_ad(thr);
@@ -1042,7 +1043,7 @@ trx_undo_report_row_operation(
if (trx->insert_undo == NULL) {
- trx_undo_assign_undo(trx, TRX_UNDO_INSERT);
+ err = trx_undo_assign_undo(trx, TRX_UNDO_INSERT);
}
undo = trx->insert_undo;
@@ -1052,7 +1053,7 @@ trx_undo_report_row_operation(
if (trx->update_undo == NULL) {
- trx_undo_assign_undo(trx, TRX_UNDO_UPDATE);
+ err = trx_undo_assign_undo(trx, TRX_UNDO_UPDATE);
}
@@ -1060,11 +1061,11 @@ trx_undo_report_row_operation(
is_insert = FALSE;
}
- if (undo == NULL) {
- /* Did not succeed: out of space */
+ if (err != DB_SUCCESS) {
+ /* Did not succeed: return the error encountered */
mutex_exit(&(trx->undo_mutex));
- return(DB_OUT_OF_FILE_SPACE);
+ return(err);
}
page_no = undo->last_page_no;
@@ -1154,7 +1155,7 @@ trx_undo_report_row_operation(
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
- return(DB_SUCCESS);
+ return(err);
}
/*============== BUILDING PREVIOUS VERSION OF A RECORD ===============*/
diff --git a/innobase/trx/trx0undo.c b/innobase/trx/trx0undo.c
index 251cd355897..997f25a66d8 100644
--- a/innobase/trx/trx0undo.c
+++ b/innobase/trx/trx0undo.c
@@ -374,27 +374,32 @@ trx_undo_page_init(
/*******************************************************************
Creates a new undo log segment in file. */
static
-page_t*
+ulint
trx_undo_seg_create(
/*================*/
- /* out: segment header page x-latched, NULL
- if no space left */
+ /* out: DB_SUCCESS if page creation OK
+ possible error codes are:
+ DB_TOO_MANY_CONCURRENT_TRXS
+ DB_OUT_OF_FILE_SPACE */
trx_rseg_t* rseg __attribute__((unused)),/* in: rollback segment */
trx_rsegf_t* rseg_hdr,/* in: rollback segment header, page
x-latched */
ulint type, /* in: type of the segment: TRX_UNDO_INSERT or
TRX_UNDO_UPDATE */
ulint* id, /* out: slot index within rseg header */
+ page_t** undo_page,
+ /* out: segment header page x-latched, NULL
+ if there was an error */
mtr_t* mtr) /* in: mtr */
{
ulint slot_no;
ulint space;
- page_t* undo_page;
trx_upagef_t* page_hdr;
trx_usegf_t* seg_hdr;
ulint n_reserved;
ibool success;
-
+ ulint err = DB_SUCCESS;
+
ut_ad(mtr && id && rseg_hdr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
@@ -411,7 +416,7 @@ trx_undo_seg_create(
"InnoDB: Warning: cannot find a free slot for an undo log. Do you have too\n"
"InnoDB: many active transactions running concurrently?\n");
- return(NULL);
+ return(DB_TOO_MANY_CONCURRENT_TRXS);
}
space = buf_frame_get_space_id(rseg_hdr);
@@ -420,29 +425,29 @@ trx_undo_seg_create(
mtr);
if (!success) {
- return(NULL);
+ return(DB_OUT_OF_FILE_SPACE);
}
/* Allocate a new file segment for the undo log */
- undo_page = fseg_create_general(space, 0,
+ *undo_page = fseg_create_general(space, 0,
TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER, TRUE, mtr);
fil_space_release_free_extents(space, n_reserved);
- if (undo_page == NULL) {
+ if (*undo_page == NULL) {
/* No space left */
- return(NULL);
+ return(DB_OUT_OF_FILE_SPACE);
}
#ifdef UNIV_SYNC_DEBUG
- buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE);
+ buf_page_dbg_add_level(*undo_page, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
- page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
- seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
+ page_hdr = *undo_page + TRX_UNDO_PAGE_HDR;
+ seg_hdr = *undo_page + TRX_UNDO_SEG_HDR;
- trx_undo_page_init(undo_page, type, mtr);
+ trx_undo_page_init(*undo_page, type, mtr);
mlog_write_ulint(page_hdr + TRX_UNDO_PAGE_FREE,
TRX_UNDO_SEG_HDR + TRX_UNDO_SEG_HDR_SIZE,
@@ -456,10 +461,11 @@ trx_undo_seg_create(
page_hdr + TRX_UNDO_PAGE_NODE, mtr);
trx_rsegf_set_nth_undo(rseg_hdr, slot_no,
- buf_frame_get_page_no(undo_page), mtr);
+ buf_frame_get_page_no(*undo_page), mtr);
+
*id = slot_no;
- return(undo_page);
+ return(err);
}
/**************************************************************************
@@ -1400,6 +1406,11 @@ trx_undo_mem_create(
undo = mem_alloc(sizeof(trx_undo_t));
+ if (undo == NULL) {
+
+ return NULL;
+ }
+
undo->id = id;
undo->type = type;
undo->state = TRX_UNDO_ACTIVE;
@@ -1479,11 +1490,15 @@ trx_undo_mem_free(
/**************************************************************************
Creates a new undo log. */
static
-trx_undo_t*
+ulint
trx_undo_create(
/*============*/
- /* out: undo log object, NULL if did not
- succeed: out of space */
+ /* out: DB_SUCCESS if successful in creating
+ the new undo lob object, possible error
+ codes are:
+ DB_TOO_MANY_CONCURRENT_TRXS
+ DB_OUT_OF_FILE_SPACE
+ DB_OUT_OF_MEMORY*/
trx_t* trx, /* in: transaction */
trx_rseg_t* rseg, /* in: rollback segment memory copy */
ulint type, /* in: type of the log: TRX_UNDO_INSERT or
@@ -1491,36 +1506,39 @@ trx_undo_create(
dulint trx_id, /* in: id of the trx for which the undo log
is created */
XID* xid, /* in: X/Open transaction identification*/
+ trx_undo_t** undo, /* out: the new undo log object, undefined
+ * if did not succeed */
mtr_t* mtr) /* in: mtr */
{
trx_rsegf_t* rseg_header;
ulint page_no;
ulint offset;
ulint id;
- trx_undo_t* undo;
page_t* undo_page;
-
+ ulint err;
+
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (rseg->curr_size == rseg->max_size) {
- return(NULL);
+ return(DB_OUT_OF_FILE_SPACE);
}
rseg->curr_size++;
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
- undo_page = trx_undo_seg_create(rseg, rseg_header, type, &id, mtr);
+ err = trx_undo_seg_create(rseg, rseg_header, type, &id,
+ &undo_page, mtr);
- if (undo_page == NULL) {
+ if (err != DB_SUCCESS) {
/* Did not succeed */
rseg->curr_size--;
- return(NULL);
+ return(err);
}
page_no = buf_frame_get_page_no(undo_page);
@@ -1532,9 +1550,14 @@ trx_undo_create(
undo_page + offset, mtr);
}
- undo = trx_undo_mem_create(rseg, id, type, trx_id, xid,
+ *undo = trx_undo_mem_create(rseg, id, type, trx_id, xid,
page_no, offset);
- return(undo);
+ if (*undo == NULL) {
+
+ err = DB_OUT_OF_MEMORY;
+ }
+
+ return(err);
}
/*================ UNDO LOG ASSIGNMENT AND CLEANUP =====================*/
@@ -1653,17 +1676,20 @@ trx_undo_mark_as_dict_operation(
Assigns an undo log for a transaction. A new undo log is created or a cached
undo log reused. */
-trx_undo_t*
+ulint
trx_undo_assign_undo(
/*=================*/
- /* out: the undo log, NULL if did not succeed: out of
- space */
- trx_t* trx, /* in: transaction */
- ulint type) /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
+ /* out: DB_SUCCESS if undo log assign
+ successful, possible error codes are:
+ DD_TOO_MANY_CONCURRENT_TRXS
+ DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY*/
+ trx_t* trx, /* in: transaction */
+ ulint type) /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
{
trx_rseg_t* rseg;
trx_undo_t* undo;
mtr_t mtr;
+ ulint err = DB_SUCCESS;
ut_ad(trx);
ut_ad(trx->rseg);
@@ -1684,15 +1710,11 @@ trx_undo_assign_undo(
undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
&mtr);
if (undo == NULL) {
- undo = trx_undo_create(trx, rseg, type, trx->id, &trx->xid,
- &mtr);
- if (undo == NULL) {
- /* Did not succeed */
+ err = trx_undo_create(trx, rseg, type, trx->id, &trx->xid,
+ &undo, &mtr);
+ if (err != DB_SUCCESS) {
- mutex_exit(&(rseg->mutex));
- mtr_commit(&mtr);
-
- return(NULL);
+ goto func_exit;
}
}
@@ -1710,10 +1732,11 @@ trx_undo_assign_undo(
trx_undo_mark_as_dict_operation(trx, undo, &mtr);
}
+func_exit:
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
- return(undo);
+ return err;
}
/**********************************************************************
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index dd66a325169..d18ed04e273 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -3552,7 +3552,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
*/
char *start= value + param->offset;
char *end= value + length;
- ulong copy_length;
+ size_t copy_length;
if (start < end)
{
copy_length= end - start;
@@ -3786,13 +3786,13 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
#undef NOT_FIXED_DEC
{
/*
- The 14 below is to ensure that the server and client has the same
+ DBL_DIG below is to ensure that the server and client has the same
precisions. This will ensure that on the same machine you get the
same value as a string independent of the protocol you use.
*/
sprintf(buff, "%-*.*g", (int) min(sizeof(buff)-1,
param->buffer_length),
- min(14,width), value);
+ min(DBL_DIG, width), value);
end= strcend(buff, ' ');
*end= 0;
}
@@ -3807,11 +3807,11 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
if (field->flags & ZEROFILL_FLAG && length < field->length &&
field->length < MAX_DOUBLE_STRING_REP_LENGTH - 1)
{
- bmove_upp((char*) buff + field->length, buff + length, length);
+ bmove_upp((char*) buff + field->length, buff + length, (uint) length);
bfill((char*) buff, field->length - length, '0');
length= field->length;
}
- fetch_string_with_conversion(param, buff, length);
+ fetch_string_with_conversion(param, buff, (uint) length);
}
break;
diff --git a/libmysql/manager.c b/libmysql/manager.c
index 631bfa26cb2..3260ddcd685 100644
--- a/libmysql/manager.c
+++ b/libmysql/manager.c
@@ -159,7 +159,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
goto err;
}
sprintf(msg_buf,"%-.16s %-.16s\n",user,passwd);
- msg_len=strlen(msg_buf);
+ msg_len= (uint) strlen(msg_buf);
if (my_net_write(&con->net,msg_buf,msg_len) || net_flush(&con->net))
{
con->last_errno=con->net.last_errno;
@@ -219,7 +219,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con,const char* cmd,
int cmd_len)
{
if (!cmd_len)
- cmd_len=strlen(cmd);
+ cmd_len= (uint) strlen(cmd);
if (my_net_write(&con->net,(char*)cmd,cmd_len) || net_flush(&con->net))
{
con->last_errno=errno;
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 4f8883f377e..285a31d34c6 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -659,7 +659,7 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
uchar *key)
{
uint first_null, kp;
- first_null= ha_find_null(keyseg, key) - keyseg;
+ first_null= (uint) (ha_find_null(keyseg, key) - keyseg);
/*
All prefix tuples that don't include keypart_{first_null} are not-null
tuples (and all others aren't), increment counters for them.
@@ -715,7 +715,7 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
seg= keyseg + diffs[0] - 1;
/* Find first NULL in last_key */
- first_null_seg= ha_find_null(seg, last_key + diffs[1]) - keyseg;
+ first_null_seg= (uint) (ha_find_null(seg, last_key + diffs[1]) - keyseg);
for (kp= 0; kp < first_null_seg; kp++)
notnull[kp]++;
@@ -3913,7 +3913,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
key_block++;
sort_info->key_block=key_block;
sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo;
- ft_buf->count=(ft_buf->buf - p)/val_len;
+ ft_buf->count=(uint) (ft_buf->buf - p)/val_len;
/* flushing buffer to second-level tree */
for (error=0; !error && p < ft_buf->buf; p+= val_len)
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 8e2f61a3b4b..d9b7f6453db 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -112,7 +112,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share_buff.state.rec_per_key_part=rec_per_key_part;
share_buff.state.key_root=key_root;
share_buff.state.key_del=key_del;
- share_buff.key_cache= multi_key_cache_search(name_buff, strlen(name_buff));
+ share_buff.key_cache= multi_key_cache_search(name_buff,
+ (uint) strlen(name_buff));
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_open",
if (strstr(name, "/t1"))
@@ -314,7 +315,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
(char*) key_del, (sizeof(my_off_t) *
share->state.header.max_block_size));
strmov(share->unique_file_name, name_buff);
- share->unique_name_length= strlen(name_buff);
+ share->unique_name_length= (uint) strlen(name_buff);
strmov(share->index_file_name, index_name);
strmov(share->data_file_name, data_name);
diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c
index 63d624a1445..ddcf0f33e61 100644
--- a/myisam/mi_packrec.c
+++ b/myisam/mi_packrec.c
@@ -254,7 +254,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys)
MYF(MY_HOLD_ON_ERROR));
/* Fix the table addresses in the tree heads. */
{
- long diff=PTR_BYTE_DIFF(decode_table,share->decode_tables);
+ my_ptrdiff_t diff=PTR_BYTE_DIFF(decode_table,share->decode_tables);
share->decode_tables=decode_table;
for (i=0 ; i < trees ; i++)
share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table,
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 530be5e042f..795c7ee55c3 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -408,7 +408,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
}
from+=keyseg->length;
page=from+nod_flag;
- length=from-vseg;
+ length= (uint) (from - vseg);
}
if (page > end)
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index df8964edc20..494eccd38e4 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -95,7 +95,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
_mi_kpos(nod_flag, k), level + 1)))
{
case 0: /* found - exit from recursion */
- *saved_key = k - page_buf;
+ *saved_key = (uint) (k - page_buf);
goto ok;
case 1: /* not found - continue searching */
info->rtree_recursion_depth = level;
@@ -117,7 +117,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag,
info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, k, info->lastkey_length);
info->rtree_recursion_depth = level;
- *saved_key = last - page_buf;
+ *saved_key = (uint) (last - page_buf);
if (after_key < last)
{
@@ -314,7 +314,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
_mi_kpos(nod_flag, k), level + 1)))
{
case 0: /* found - exit from recursion */
- *saved_key = k - page_buf;
+ *saved_key = (uint) (k - page_buf);
goto ok;
case 1: /* not found - continue searching */
info->rtree_recursion_depth = level;
@@ -333,7 +333,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length,
memcpy(info->lastkey, k, info->lastkey_length);
info->rtree_recursion_depth = level;
- *saved_key = k - page_buf;
+ *saved_key = (uint) (k - page_buf);
if (after_key < last)
{
@@ -420,7 +420,7 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length)
info->lastkey_length = k_len + info->s->base.rec_reflength;
memcpy(info->lastkey, key, k_len + info->s->base.rec_reflength);
- *(int*)info->int_keypos = key - info->buff;
+ *(uint*)info->int_keypos = (uint) (key - info->buff);
if (after_key >= info->int_maxpos)
{
info->buff_used = 1;
diff --git a/mysql-test/include/master-slave-end.inc b/mysql-test/include/master-slave-end.inc
new file mode 100644
index 00000000000..74e4c7b608a
--- /dev/null
+++ b/mysql-test/include/master-slave-end.inc
@@ -0,0 +1,6 @@
+--connection master
+--sync_slave_with_master
+--connection slave
+--disable_query_log
+STOP SLAVE;
+--enable_query_log
diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
index f0a883d4e11..752155a8dbd 100644
--- a/mysql-test/include/ndb_backup.inc
+++ b/mysql-test/include/ndb_backup.inc
@@ -2,23 +2,50 @@
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
-
-# there is no neat way to find the backupid, this is a hack to find it...
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+# To find the backupid, we must dump this data to a table, and SELECT
+# what we want into an outfile. This could be accomplished with grep, but
+# grep isn't Windows-portable
+
+--disable_query_log
+# create a table to help us out
+--disable_warnings # leave this on until done with the entire process
+# cleanup
+DROP TABLE IF EXISTS helper1;
+CREATE TABLE helper1(c1 VARCHAR(20));
+# dump raw data to file
+let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat;
+let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat;
+--error 0,1
+--remove_file $ndb_backup_file1
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1
+# load the table from the raw data file
+eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1;
+--remove_file $ndb_backup_file1
+# output what we need
+eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%'
+INTO OUTFILE '$ndb_backup_file2';
+# cleanup
+DROP TABLE helper1;
+--enable_warnings
+--enable_query_log
+
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval LOAD DATA INFILE '$ndb_backup_file2'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+--remove_file $ndb_backup_file2
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
-
-let the_backup_id=`select @the_backup_id`;
+let $the_backup_id=`SELECT @the_backup_id`;
DROP TABLE test.backup_info;
diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc
new file mode 100644
index 00000000000..78a02736de8
--- /dev/null
+++ b/mysql-test/include/start_slave.inc
@@ -0,0 +1,21 @@
+# ==== Purpose ====
+#
+# Issues START SLAVE on the current connection. Then waits until both
+# the IO and SQL threads have started, or until a timeout is reached.
+#
+# Please use this instead of 'START SLAVE', to reduce the risk of test
+# case bugs.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+
+--disable_query_log
+START SLAVE;
+--enable_query_log
+--echo include/start_slave.inc
+source include/wait_for_slave_to_start.inc;
diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc
new file mode 100644
index 00000000000..7161e6fe739
--- /dev/null
+++ b/mysql-test/include/stop_slave.inc
@@ -0,0 +1,21 @@
+# ==== Purpose ====
+#
+# Issues STOP SLAVE on the current connection. Then waits until both
+# the IO and SQL threads have stopped, or until a timeout is reached.
+#
+# Please use this instead of 'STOP SLAVE', to reduce the risk of test
+# case bugs.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+
+--disable_query_log
+STOP SLAVE;
+--enable_query_log
+--echo include/stop_slave.inc
+source include/wait_for_slave_to_stop.inc;
diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc
new file mode 100644
index 00000000000..1a708cee780
--- /dev/null
+++ b/mysql-test/include/wait_for_slave_sql_error.inc
@@ -0,0 +1,40 @@
+# ==== Purpose ====
+#
+# Waits until the SQL thread of the current connection has got an
+# error, or until a timeout is reached. Also waits until the SQL
+# thread has completely stopped.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_sql_error.inc;
+#
+# Parameters:
+#
+# $slave_sql_errno
+# The expected SQL error number. This is required.
+# (After BUG#41956 has been fixed, this will be required to be a
+# symbolic name instead of a number.)
+#
+# $slave_timeout
+# See wait_for_slave_param.inc for description.
+#
+# $master_connection
+# See wait_for_slave_param.inc for description.
+
+if (`SELECT '$slave_sql_errno' = ''`) {
+ --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc
+ exit;
+}
+
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= No;
+let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread);
+source include/wait_for_slave_param.inc;
+
+# NOTE: on mysql-5.0, there is no way to distinguish slave SQL error from IO error
+let $_error= query_get_value(SHOW SLAVE STATUS, Last_Errno, 1);
+if (`SELECT '$_error' != '$slave_sql_errno'`) {
+ --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno)
+ source include/show_rpl_debug_info.inc;
+ exit;
+}
diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
new file mode 100644
index 00000000000..5723720f4b7
--- /dev/null
+++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
@@ -0,0 +1,39 @@
+# ==== Purpose ====
+#
+# Wait for slave SQL error, skip the erroneous statement and restart
+# slave
+#
+# ==== Usage ====
+#
+# let $slave_sql_error= <ERRNO>;
+# source include/wait_for_slave_sql_error_and_skip.inc;
+#
+# Parameters:
+#
+# $slave_sql_errno
+# The error number to wait for. This is required. (See
+# wait_for_slave_sql_error.inc)
+#
+# $show_sql_error
+# If set, will print the error to the query log.
+#
+# $slave_timeout
+# See wait_for_slave_param.inc for description.
+#
+# $master_connection
+# See wait_for_slave_param.inc for description.
+
+echo --source include/wait_for_slave_sql_error_and_skip.inc;
+connection slave;
+source include/wait_for_slave_sql_error.inc;
+if ($show_sql_error)
+{
+ # NOTE: on mysql-5.0, there is no way to distinguish slave SQL error from IO error
+ let $error= query_get_value("SHOW SLAVE STATUS", Last_Error, 1);
+ echo Last_SQL_Error = $error;
+}
+
+# skip the erroneous statement
+set global sql_slave_skip_counter=1;
+source include/start_slave.inc;
+connection master;
diff --git a/mysql-test/include/wait_show_condition.inc b/mysql-test/include/wait_show_condition.inc
new file mode 100644
index 00000000000..253101d1e07
--- /dev/null
+++ b/mysql-test/include/wait_show_condition.inc
@@ -0,0 +1,78 @@
+# include/wait_show_condition.inc
+#
+# SUMMARY
+#
+# Waits until the show statement ($show_statement) has at least within one of
+# the rows of the result set for the field ($field) a value which fulfils
+# a condition ($condition), or the operation times out.
+#
+#
+# USAGE
+#
+# let $show_statement= SHOW PROCESSLIST;
+# let $field= State;
+# let $condition= = 'Updating';
+# --source include/wait_show_condition.inc
+#
+# OR
+#
+# let $wait_timeout= 60; # Override default of 30 seconds with 60.
+# let $show_statement= SHOW PROCESSLIST;
+# let $field= State;
+# let $condition= = 'Updating';
+# --source include/wait_show_condition.inc
+#
+# Please do not use this use routine if you can replace the SHOW statement
+# with a select. In such a case include/wait_condition.inc is recommended.
+#
+# Created: 2009-02-18 mleich
+#
+
+let $max_run_time= 30;
+if ($wait_timeout)
+{
+ let $max_run_time= $wait_timeout;
+}
+# Reset $wait_timeout so that its value won't be used on subsequent
+# calls, and default will be used instead.
+let $wait_timeout= 0;
+
+# The smallest timespan till UNIX_TIMESTAMP() gets incremented is ~0 seconds.
+# We add one second to avoid the case that somebody measures timespans on a
+# real clock with fractions of seconds, detects that n seconds are sufficient,
+# assigns n to this routine and suffers because he sometimes gets n - 1
+# seconds in reality.
+inc $max_run_time;
+
+let $found= 0;
+let $max_end_time= `SELECT UNIX_TIMESTAMP() + $max_run_time`;
+while (`SELECT UNIX_TIMESTAMP() <= $max_end_time AND $found = 0`)
+{
+ # Sleep a bit to avoid too heavy load.
+ real_sleep 0.2;
+ let $rowno= 1;
+ let $process_result= 1;
+ while (`SELECT $process_result = 1 AND $found = 0`)
+ {
+ let $field_value= query_get_value($show_statement, $field, $rowno);
+ if (`SELECT '$field_value' $condition`)
+ {
+ let $found= 1;
+ }
+ if (`SELECT '$field_value' = 'No such row'`)
+ {
+ # We are behind the last row of the result set.
+ let $process_result= 0;
+ }
+ inc $rowno;
+ }
+}
+if (!$found)
+{
+ echo # Timeout in include/wait_show_condition.inc for $wait_condition;
+ echo # show_statement : $show_statement;
+ echo # field : $field;
+ echo # condition : $condition;
+ echo # max_run_time : $max_run_time;
+}
+
diff --git a/mysql-test/include/wait_until_count_sessions.inc b/mysql-test/include/wait_until_count_sessions.inc
index 36fa9accafe..56d2b0b1dcd 100644
--- a/mysql-test/include/wait_until_count_sessions.inc
+++ b/mysql-test/include/wait_until_count_sessions.inc
@@ -2,14 +2,23 @@
#
# SUMMARY
#
-# Waits until the passed number ($count_sessions) of concurrent sessions was
-# observed via
+# Waits until the passed number ($count_sessions) of concurrent sessions or
+# a smaller number was observed via
# SHOW STATUS LIKE 'Threads_connected'
# or the operation times out.
-# Note: Starting with 5.1 we could also use
-# SELECT COUNT(*) FROM information_schema.processlist
-# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
-# runs in all versions 5.0+
+# Note:
+# 1. We wait for $current_sessions <= $count_sessions because in the use case
+# with count_sessions.inc before and wait_until_count_sessions.inc after
+# the core of the test it could happen that the disconnects of sessions
+# belonging to the preceeding test are not finished.
+# sessions at test begin($count_sessions) = m + n
+# sessions of the previous test which will be soon disconnected = n (n >= 0)
+# sessions at test end ($current sessions, assuming the test disconnects
+# all additional sessions) = m
+# 2. Starting with 5.1 we could also use
+# SELECT COUNT(*) FROM information_schema.processlist
+# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
+# runs in all versions 5.0+
#
#
# USAGE
@@ -19,7 +28,7 @@
#
# OR typical example of a test which uses more than one session
# Such a test could harm successing tests if there is no server shutdown
-# and start between.cw
+# and start between.
#
# If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed.
@@ -79,10 +88,14 @@
# backup.test, grant3.test
#
#
-# Created: 2009-01-14 mleich
+# Created:
+# 2009-01-14 mleich
+# Modified:
+# 2009-02-24 mleich Fix Bug#43114 wait_until_count_sessions too restrictive,
+# random PB failures
#
-let $wait_counter= 50;
+let $wait_counter= 100;
if ($wait_timeout)
{
let $wait_counter= `SELECT $wait_timeout * 10`;
@@ -93,7 +106,7 @@ let $wait_timeout= 0;
while ($wait_counter)
{
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
- let $success= `SELECT $current_sessions = $count_sessions`;
+ let $success= `SELECT $current_sessions <= $count_sessions`;
if ($success)
{
let $wait_counter= 0;
@@ -107,6 +120,7 @@ while ($wait_counter)
if (!$success)
{
--echo # Timeout in wait_until_count_sessions.inc
- --echo # Number of sessions expected: $count_sessions found: $current_sessions
+ --echo # Number of sessions expected: <= $count_sessions found: $current_sessions
+ SHOW PROCESSLIST;
}
diff --git a/mysql-test/r/archive_gis.result b/mysql-test/r/archive_gis.result
index 3137d43ec3a..5a8ccea7cc5 100644
--- a/mysql-test/r/archive_gis.result
+++ b/mysql-test/r/archive_gis.result
@@ -291,7 +291,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
fid AsText(Centroid(g))
108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
+109 POINT(25.4166666666667 25.4166666666667)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
fid Area(g)
@@ -325,8 +325,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index 14313ba490f..f5a649d27a5 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -1,5 +1,5 @@
set SQL_LOG_BIN=0;
-drop table if exists t1, t2, t3;
+drop table if exists t1, t2, t3, t4;
create table t4(n int);
backup table t4 to '../bogus';
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/bdb_gis.result b/mysql-test/r/bdb_gis.result
index 6651421b51c..3187d7bef99 100644
--- a/mysql-test/r/bdb_gis.result
+++ b/mysql-test/r/bdb_gis.result
@@ -291,7 +291,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
fid AsText(Centroid(g))
108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
+109 POINT(25.4166666666667 25.4166666666667)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
fid Area(g)
@@ -325,8 +325,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result
index 03219d0977e..0bff34dba20 100644
--- a/mysql-test/r/check.result
+++ b/mysql-test/r/check.result
@@ -1,4 +1,5 @@
-drop table if exists t1;
+drop table if exists t1,t2;
+drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
check table t1 extended;
insert into t1 values (200000);
diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result
index 90606abbe4e..694c996a58e 100644
--- a/mysql-test/r/consistent_snapshot.result
+++ b/mysql-test/r/consistent_snapshot.result
@@ -1,15 +1,23 @@
-drop table if exists t1;
-create table t1 (a int) engine=innodb;
-start transaction with consistent snapshot;
-insert into t1 values(1);
-select * from t1;
+DROP TABLE IF EXISTS t1;
+# Establish connection con1 (user=root)
+# Establish connection con2 (user=root)
+# Switch to connection con1
+CREATE TABLE t1 (a INT) ENGINE=innodb;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+# Switch to connection con2
+INSERT INTO t1 VALUES(1);
+# Switch to connection con1
+SELECT * FROM t1;
a
-commit;
-delete from t1;
-start transaction;
-insert into t1 values(1);
-select * from t1;
+COMMIT;
+DELETE FROM t1;
+START TRANSACTION;
+# Switch to connection con2
+INSERT INTO t1 VALUES(1);
+# Switch to connection con1
+SELECT * FROM t1;
a
1
-commit;
-drop table t1;
+COMMIT;
+# Switch to connection default + close connections con1 and con2
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result
index 7e9513f06e9..8bcd488cb69 100644
--- a/mysql-test/r/ctype_collate.result
+++ b/mysql-test/r/ctype_collate.result
@@ -611,3 +611,22 @@ check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
+least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
+a
+create table t1
+select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` varchar(1) character set latin5 NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
+latin5_turkish_ci then 2 else 3 end;
+case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
+latin5_turkish_ci then 2 else 3 end
+3
+select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
+concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
+abc
diff --git a/mysql-test/r/dirty_close.result b/mysql-test/r/dirty_close.result
index c4fc19a35f8..b49b72f1b95 100644
--- a/mysql-test/r/dirty_close.result
+++ b/mysql-test/r/dirty_close.result
@@ -1,9 +1,9 @@
-drop table if exists t1;
-create table t1 (n int);
-insert into t1 values (1),(2),(3);
-select * from t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
n
1
2
3
-drop table t1;
+DROP TABLE t1;
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 3aa189f4a9d..b0adc428e4c 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -155,3 +155,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select 1 AS `1` from (select count(distinct `test`.`t1`.`a`) AS `COUNT(DISTINCT t1.a)` from `test`.`t1` join `test`.`t2` group by `test`.`t1`.`a`) `s1`
DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
+ERROR HY000: Key 'a' doesn't exist in table 't1'
+DROP TABLE t1;
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index f0de3e9b04a..026886cb07d 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -2094,6 +2094,26 @@ SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
a
DROP TABLE t1;
DROP TABLE t1;
+#
+# BUG#21360 - mysqldump error on federated tables
+#
+#Switch to Connection Slave
+CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
+INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
+#Switch to Connection Master
+CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
+# Dump table t1 using mysqldump tool
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `id` varchar(20) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
+/*!40101 SET character_set_client = @saved_cs_client */;
+DROP TABLE t1;
+#Switch to Connection Slave
+DROP TABLE t1;
End of 5.0 tests
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result
index d5b10868358..d2197beaaab 100644
--- a/mysql-test/r/flush_block_commit.result
+++ b/mysql-test/r/flush_block_commit.result
@@ -1,39 +1,57 @@
-drop table if exists t1;
-create table t1 (a int) engine=innodb;
-begin;
-insert into t1 values(1);
-flush tables with read lock;
-select * from t1;
+# Establish connection con1 (user=root)
+# Establish connection con2 (user=root)
+# Establish connection con3 (user=root)
+# Switch to connection con1
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) ENGINE=innodb;
+BEGIN;
+INSERT INTO t1 VALUES(1);
+# Switch to connection con2
+FLUSH TABLES WITH READ LOCK;
+SELECT * FROM t1;
a
-commit;
-select * from t1;
+# Switch to connection con1
+COMMIT;
+# Switch to connection con2
+SELECT * FROM t1;
a
-unlock tables;
-begin;
-select * from t1 for update;
+UNLOCK TABLES;
+# Switch to connection con1
+# Switch to connection con1
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
a
1
-begin;
-select * from t1 for update;
-flush tables with read lock;
-commit;
+# Switch to connection con2
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+# Switch to connection con3
+FLUSH TABLES WITH READ LOCK;
+# Switch to connection con1
+COMMIT;
+# Switch to connection con2
a
1
-unlock tables;
-commit;
-begin;
-insert into t1 values(10);
-flush tables with read lock;
-commit;
-unlock tables;
-flush tables with read lock;
-unlock tables;
-begin;
-select * from t1;
+# Switch to connection con3
+UNLOCK TABLES;
+# Switch to connection con2
+COMMIT;
+# Switch to connection con1
+BEGIN;
+INSERT INTO t1 VALUES(10);
+FLUSH TABLES WITH READ LOCK;
+COMMIT;
+UNLOCK TABLES;
+# Switch to connection con2
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+BEGIN;
+SELECT * FROM t1;
a
1
10
-show create database test;
+SHOW CREATE DATABASE test;
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
-drop table t1;
+DROP TABLE t1;
+# Switch to connection default and close connections con1, con2, con3
diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result
index 599efeb3e2d..76c55e948dd 100644
--- a/mysql-test/r/flush_block_commit_notembedded.result
+++ b/mysql-test/r/flush_block_commit_notembedded.result
@@ -1,15 +1,23 @@
-create table t1 (a int) engine=innodb;
-reset master;
-set autocommit=0;
-insert t1 values (1);
-flush tables with read lock;
-show master status;
+# Establish connection con1 (user=root)
+# Establish connection con2 (user=root)
+# Switch to connection con1
+CREATE TABLE t1 (a INT) ENGINE=innodb;
+RESET MASTER;
+SET AUTOCOMMIT=0;
+INSERT t1 VALUES (1);
+# Switch to connection con2
+FLUSH TABLES WITH READ LOCK;
+SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
-commit;
-show master status;
+# Switch to connection con1
+COMMIT;
+# Switch to connection con2
+SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
-unlock tables;
-drop table t1;
-set autocommit=1;
+UNLOCK TABLES;
+# Switch to connection con1
+DROP TABLE t1;
+SET AUTOCOMMIT=1;
+# Switch to connection default and close connections con1 and con2
diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result
index 6703b6bd533..b16a8b114b3 100644
--- a/mysql-test/r/flush_read_lock_kill.result
+++ b/mysql-test/r/flush_read_lock_kill.result
@@ -1,9 +1,12 @@
-drop table if exists t1;
-create table t1 (kill_id int);
-insert into t1 values(connection_id());
-flush tables with read lock;
-select ((@id := kill_id) - kill_id) from t1;
+SET @old_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (kill_id INT);
+INSERT INTO t1 VALUES(connection_id());
+FLUSH TABLES WITH READ LOCK;
+SELECT ((@id := kill_id) - kill_id) FROM t1;
((@id := kill_id) - kill_id)
0
-kill connection @id;
-drop table t1;
+KILL CONNECTION @id;
+DROP TABLE t1;
+SET @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 6821691c9d0..6ea17644f9d 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -506,3 +506,7 @@ SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
2
DROP TABLE t1;
+CREATE TABLE t1(a TEXT);
+SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
+ERROR HY000: Incorrect arguments to AGAINST
+DROP TABLE t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index a7f4c58f4af..85ddfaac4e0 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -61,7 +61,7 @@ grp sum
NULL NULL
1 7
2 20.25
-3 45.483163247594
+3 45.4831632475944
create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
replace into t2 select grp, a, c from t1 limit 2,1;
@@ -1195,7 +1195,7 @@ std(s1/s2)
0.21325764
select std(o1/o2) from bug22555;
std(o1/o2)
-0.21325763586649
+0.213257635866493
select std(e1/e2) from bug22555;
std(e1/e2)
0.21325764
@@ -1221,7 +1221,7 @@ round(std(s1/s2), 17)
0.21325763586649341
select std(o1/o2) from bug22555;
std(o1/o2)
-0.21325763586649
+0.213257635866493
select round(std(e1/e2), 17) from bug22555;
round(std(e1/e2), 17)
0.21325763586649341
@@ -1246,7 +1246,7 @@ round(std(s1/s2), 17)
0.21325763586649341
select std(o1/o2) from bug22555;
std(o1/o2)
-0.21325763586649
+0.213257635866493
select round(std(e1/e2), 17) from bug22555;
round(std(e1/e2), 17)
0.21325763586649341
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 150b6003dbe..87cfb5b86a5 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -60,7 +60,7 @@ Warnings:
Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
-3 3.9068905956085 NULL NULL NULL
+3 3.90689059560852 NULL NULL NULL
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
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
@@ -68,7 +68,7 @@ Warnings:
Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
-2 1.2552725051033 NULL NULL NULL
+2 1.25527250510331 NULL NULL NULL
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
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
@@ -85,7 +85,7 @@ Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
rand(999999) rand()
-0.014231365187309 0.028870999839968
+0.0142313651873091 0.028870999839968
explain extended select rand(999999),rand();
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
@@ -101,7 +101,7 @@ Warnings:
Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
-180 6.2831853071796
+180 6.28318530717959
SELECT ACOS(1.0);
ACOS(1.0)
0
@@ -321,7 +321,7 @@ mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)
5 5 1
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
-2.1359870359209e+96 2.1359870359209e+96 -32
+2.13598703592091e+96 2.13598703592091e+96 -32
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
SELECT a DIV 900 y FROM t1 GROUP BY y;
@@ -360,4 +360,34 @@ SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
a DIV 2
0
DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (-1.1), (1.1),
+(-1.5), (1.5),
+(-1.9), (1.9),
+(-2.1), (2.1),
+(-2.5), (2.5),
+(-2.9), (2.9),
+# Check numbers with absolute values > 2^53 - 1
+# (see comments for MAX_EXACT_INTEGER)
+(-1e16 - 0.5), (1e16 + 0.5),
+(-1e16 - 1.5), (1e16 + 1.5);
+SELECT a, ROUND(a) FROM t1;
+a ROUND(a)
+-1.1 -1
+1.1 1
+-1.5 -2
+1.5 2
+-1.9 -2
+1.9 2
+-2.1 -2
+2.1 2
+-2.5 -2
+2.5 2
+-2.9 -3
+2.9 3
+-1e+16 -10000000000000000
+1e+16 10000000000000000
+-1e+16 -10000000000000002
+1e+16 10000000000000002
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index c121c8937d7..1d7395ae14d 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1131,10 +1131,10 @@ cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
20.06
select conv("18383815659218730760",10,10) + 0;
conv("18383815659218730760",10,10) + 0
-1.8383815659219e+19
+1.83838156592187e+19
select "18383815659218730760" + 0;
"18383815659218730760" + 0
-1.8383815659219e+19
+1.83838156592187e+19
CREATE TABLE t1 (code varchar(10));
INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
SELECT ASCII(code), code FROM t1 WHERE code='A12';
@@ -2181,4 +2181,10 @@ def format(a, 2) 253 20 4 Y 0 2 8
format(a, 2)
1.33
drop table t1;
+CREATE TABLE t1 (c DATE, aa VARCHAR(30));
+INSERT INTO t1 VALUES ('2008-12-31','aaaaaa');
+SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1;
+h i
+31.12.2008 AAAAAA, aaaaaa
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index ac6356f8203..e3b2ea751d9 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -284,7 +284,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
fid AsText(Centroid(g))
108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
+109 POINT(25.4166666666667 25.4166666666667)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon;
fid Area(g)
@@ -318,8 +318,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon;
fid Area(g)
@@ -651,11 +651,11 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
-85998 MULTIPOLYGON 0 POINT(115.31877315203 -36.237472821022)
+85998 MULTIPOLYGON 0 POINT(115.318773152032 -36.2374728210215)
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
-85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469)
+85984 MULTIPOLYGON 0 POINT(-114.877871869233 36.3310176346905)
drop table t1;
create table t1 (fl geometry not null);
insert into t1 values (1);
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index ee328d461ac..7a5b0520f7c 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -162,7 +162,7 @@ Warnings:
Warning 1364 Field 'ssl_cipher' doesn't have a default value
Warning 1364 Field 'x509_issuer' doesn't have a default value
Warning 1364 Field 'x509_subject' doesn't have a default value
-insert into mysql.db (host, db, user, select_priv) values
+insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
flush privileges;
@@ -262,7 +262,7 @@ drop user mysqltest_1@localhost;
SET NAMES koi8r;
CREATE DATABASE ÂÄ;
USE ÂÄ;
-CREATE TABLE ÔÁÂ (ËÏÌ int);
+CREATE TABLE ÔÁÂ (ËÏÌ INT);
GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
SHOW GRANTS FOR ÀÚÅÒ@localhost;
Grants for ÀÚÅÒ@localhost
@@ -381,21 +381,21 @@ grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
-SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
-WHERE GRANTEE = '''mysqltest_3''@''localhost'''
-ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
+SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_3'@'localhost' NULL mysqltest_1 t1 a UPDATE NO
'mysqltest_3'@'localhost' NULL mysqltest_2 t1 c SELECT NO
'mysqltest_3'@'localhost' NULL mysqltest_1 t2 b SELECT NO
'mysqltest_3'@'localhost' NULL mysqltest_2 t2 d UPDATE NO
SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
-WHERE GRANTEE = '''mysqltest_3''@''localhost'''
-ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
-WHERE GRANTEE = '''mysqltest_3''@''localhost'''
-ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
+WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
@@ -457,7 +457,7 @@ Privilege Context Comment
Alter Tables To alter the table
Alter routine Functions,Procedures To alter or drop stored functions/procedures
Create Databases,Tables,Indexes To create new databases and tables
-Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE
+Create routine Databases To use CREATE FUNCTION/PROCEDURE
Create temporary tables Databases To use CREATE TEMPORARY TABLE
Create view Tables To create new views
Create user Server Admin To create new users
@@ -880,11 +880,11 @@ flush privileges;
drop table t2;
drop table t1;
CREATE DATABASE mysqltest3;
-use mysqltest3;
+USE mysqltest3;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2;
-use mysqltest2;
+USE mysqltest2;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE VIEW v_yn AS SELECT * FROM t_nn;
@@ -954,7 +954,7 @@ DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
-use test;
+USE test;
create user mysqltest1_thisisreallytoolong;
ERROR HY000: String 'mysqltest1_thisisreallytoolong' is too long for user name (should be no longer than 16)
GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost;
@@ -1106,16 +1106,16 @@ DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
-use test;
+USE test;
CREATE TABLE t1 (f1 int, f2 int);
INSERT INTO t1 VALUES(1,1), (2,2);
CREATE DATABASE db27878;
GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
-use db27878;
+USE db27878;
CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
-use db27878;
+USE db27878;
UPDATE v1 SET f2 = 4;
ERROR HY000: View 'db27878.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT * FROM test.t1;
@@ -1127,7 +1127,7 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
DROP USER mysqltest_1@localhost;
DROP DATABASE db27878;
-use test;
+USE test;
DROP TABLE t1;
drop table if exists test;
Warnings:
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 95748c89103..698e602e2e6 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -433,7 +433,7 @@ USE db1;
SELECT c FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
SELECT * FROM t2;
-ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
+ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2'
SELECT * FROM t1 JOIN t2 USING (b);
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
USE test;
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index f2f488650d5..58be2af1bb8 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2429,3 +2429,18 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a`
drop table t1;
+CREATE TABLE t1 (a int, b int, c int, d int,
+KEY foo (c,d,a,b), KEY bar (c,a,b,d));
+INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
+EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL foo 10 NULL 9 Using where; Using index for group-by
+SELECT DISTINCT c FROM t1 WHERE d=4;
+c
+1
+2
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index d7ff87bd1eb..6ced6bb373a 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -75,7 +75,7 @@ t2
t3
t5
v1
-select c,table_name from v1
+select c,table_name from v1
inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
c table_name
@@ -94,7 +94,7 @@ t4 t4
t2 t2
t3 t3
t5 t5
-select c,table_name from v1
+select c,table_name from v1
left join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
c table_name
@@ -173,7 +173,7 @@ a int(11) YES NULL
create view mysqltest.v1 (c) as select a from mysqltest.t1;
grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
grant select on mysqltest.v1 to mysqltest_3;
-select table_name, column_name, privileges from information_schema.columns
+select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
table_name column_name privileges
t1 a select
@@ -249,7 +249,7 @@ begin
select * from t1;
select * from t2;
end|
-select parameter_style, sql_data_access, dtd_identifier
+select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
parameter_style sql_data_access dtd_identifier
SQL CONTAINS SQL NULL
@@ -280,7 +280,7 @@ sub1 sub1
select count(*) from information_schema.ROUTINES;
count(*)
2
-create view v1 as select routine_schema, routine_name from information_schema.routines
+create view v1 as select routine_schema, routine_name from information_schema.routines
order by routine_schema, routine_name;
select * from v1;
routine_schema routine_name
@@ -532,7 +532,7 @@ drop view v1;
create table t1(a NUMERIC(5,3), b NUMERIC(5,1), c float(5,2),
d NUMERIC(6,4), e float, f DECIMAL(6,3), g int(11), h DOUBLE(10,3),
i DOUBLE);
-select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
+select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
from information_schema.columns where table_name= 't1';
COLUMN_NAME COLUMN_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE
@@ -589,7 +589,7 @@ TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
-from information_schema.tables
+from information_schema.tables
where table_schema='information_schema' limit 2;
TABLE_NAME TABLE_TYPE ENGINE
CHARACTER_SETS SYSTEM VIEW MEMORY
@@ -700,7 +700,7 @@ where table_schema="information_schema" and table_name="COLUMNS" and
column_type
varchar(64)
varchar(64)
-select TABLE_ROWS from information_schema.tables where
+select TABLE_ROWS from information_schema.tables where
table_schema="information_schema" and table_name="COLUMNS";
TABLE_ROWS
NULL
@@ -733,7 +733,7 @@ count(*)
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
-information_schema.columns
+information_schema.columns
where data_type = 'longtext';
table_schema table_name column_name
information_schema COLUMNS COLUMN_DEFAULT
@@ -755,7 +755,7 @@ TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
-WHERE NOT EXISTS
+WHERE NOT EXISTS
(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
AND A.TABLE_NAME = B.TABLE_NAME);
@@ -784,7 +784,7 @@ x_float NULL NULL
x_double_precision NULL NULL
drop table t1;
grant select on test.* to mysqltest_4@localhost;
-SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
+SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME';
TABLE_NAME COLUMN_NAME PRIVILEGES
COLUMNS TABLE_NAME select
@@ -1027,7 +1027,7 @@ BEGIN
SELECT 'foo' FROM DUAL;
END |
ERROR 42000: Unknown database 'information_schema'
-select ROUTINE_NAME from routines;
+select ROUTINE_NAME from routines;
ROUTINE_NAME
grant all on information_schema.* to 'user1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index b9c3358f47e..67c9921e1ca 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -188,7 +188,7 @@ Field Type Null Key Default Extra
f1 char(4) YES NULL
show create view v2;
View Create View
-v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
show create view testdb_1.v1;
ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1'
select table_name from information_schema.columns a
diff --git a/mysql-test/r/innodb_bug42419.result b/mysql-test/r/innodb_bug42419.result
new file mode 100644
index 00000000000..f304bb634cb
--- /dev/null
+++ b/mysql-test/r/innodb_bug42419.result
@@ -0,0 +1,17 @@
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+SET AUTOCOMMIT = 0;
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+Reap the server message for connection user2 UPDATE t1 ...
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/r/innodb_gis.result
index bfe8c984b7b..0f2607e9787 100644
--- a/mysql-test/r/innodb_gis.result
+++ b/mysql-test/r/innodb_gis.result
@@ -291,7 +291,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
fid AsText(Centroid(g))
108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
+109 POINT(25.4166666666667 25.4166666666667)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
fid Area(g)
@@ -325,8 +325,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index 0430d560a7a..d1b50a0080c 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
-use mysql;
+USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
-use mysql;
+USE mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text
@@ -65,7 +65,7 @@ mysql.user optimize status OK
UNLOCK TABLES;
Select_priv
N
-use test;
+USE test;
use test;
CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE;
@@ -93,7 +93,7 @@ create table t1 (a int);
connection: locker
lock tables t1 read;
connection: writer
-create table t2 like t1;;
+create table t2 like t1;
connection: default
kill query
ERROR 70100: Query execution was interrupted
diff --git a/mysql-test/r/lowercase_utf8.result b/mysql-test/r/lowercase_utf8.result
new file mode 100644
index 00000000000..945e0912e80
--- /dev/null
+++ b/mysql-test/r/lowercase_utf8.result
@@ -0,0 +1,9 @@
+set names utf8;
+create table `Ð` (id int);
+show tables from test like 'Ð';
+Tables_in_test (Ð)
+а
+show tables from test like 'а';
+Tables_in_test (а)
+а
+drop table `Ð`;
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index b85fb559e8c..c04948c6fa7 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -375,7 +375,7 @@ update t2, t1 set t2.field=t1.field
where t1.id1=t2.id2 and 0=1;
delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2
where 0=1;
-delete t1, t2 from t2,t1
+delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
CREATE TABLE t1 ( a int );
@@ -443,12 +443,12 @@ delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2
ERROR HY000: You can't specify target table 't1' for update in FROM clause
drop table t1,t2;
create table t1 (
-aclid bigint not null primary key,
-status tinyint(1) not null
+aclid bigint not null primary key,
+status tinyint(1) not null
) engine = innodb;
create table t2 (
-refid bigint not null primary key,
-aclid bigint, index idx_acl(aclid)
+refid bigint not null primary key,
+aclid bigint, index idx_acl(aclid)
) engine = innodb;
insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
@@ -522,7 +522,7 @@ a b
4 4
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 189
+master-bin.000001 198
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@@ -532,7 +532,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 1
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 204
+master-bin.000001 213
drop table t1, t2;
drop table if exists t1, t2, t3;
CREATE TABLE t1 (a int, PRIMARY KEY (a));
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 9bad3b9f791..cef5e08ec6b 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -188,4 +188,17 @@ delimiter
2
@z:='1' @z=database()
1 NULL
+1
+1
+1
+1
+set @old_max_allowed_packet = @@global.max_allowed_packet;
+set @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
+CREATE TABLE t1(data LONGBLOB);
+INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
+SELECT LENGTH(data) FROM t1;
+LENGTH(data)
+2097152
+DROP TABLE t1;
+set @@global.max_allowed_packet = @old_max_allowed_packet;
End of 5.0 tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 4fd87861ded..23244d2b3c4 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -349,17 +349,35 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
CREATE TABLE t1 (c1 CHAR(10));
-flush logs;
+FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
-flush logs;
+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;
+We expect this value to be 1
+The bug being tested was that 'Query' lines were not preceded by '#'
+If the line is in the table, it had to have been preceded by a '#'
+
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+BUG#28293_expect_1
1
-drop table t1;
+DROP TABLE patch;
+FLUSH LOGS;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES(connection_id());
+FLUSH LOGS;
+DROP TABLE t1;
+1
+DROP TABLE t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
+SET @@global.server_id= 4294967295;
+RESET MASTER;
+FLUSH LOGS;
+SELECT
+(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+IS NOT NULL;
+(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+IS NOT NULL
+1
+*** Unsigned server_id 4294967295 is found: 1 ***
+SET @@global.server_id= 1;
End of 5.0 tests
diff --git a/mysql-test/r/mysqldump-max.result b/mysql-test/r/mysqldump-max.result
index 261c7a7f197..b3a966b9b39 100644
--- a/mysql-test/r/mysqldump-max.result
+++ b/mysql-test/r/mysqldump-max.result
@@ -93,73 +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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
@@ -190,73 +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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 76e553dea42..1897a7df799 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -33,12 +33,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
#
@@ -48,12 +48,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (RES);
DROP TABLE t1;
#
@@ -69,21 +69,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -97,13 +97,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -126,13 +126,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -208,12 +208,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -244,12 +244,9 @@ 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 */;
@@ -270,12 +267,9 @@ 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 */;
@@ -294,12 +288,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
drop table ```a`;
#
# Bug#2591 mysqldump quotes names inconsistently
@@ -317,12 +311,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -345,12 +339,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE "t1" (
"a" int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -376,12 +370,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -404,12 +398,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE "t1" (
"a" int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -439,12 +433,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -533,12 +527,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -569,12 +563,9 @@ 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 */;
@@ -595,12 +586,9 @@ 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 */;
@@ -621,12 +609,9 @@ 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 */;
@@ -660,12 +645,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -701,12 +686,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`b` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -742,12 +727,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -776,12 +761,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
@@ -1145,8 +1130,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`F_c4ca4238a0b923820dcc509a6f75849b` int(11) default NULL,
`F_c81e728d9d4c2f636f067f89cc14862c` int(11) default NULL,
@@ -1479,7 +1464,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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1520,12 +1505,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1564,19 +1549,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1599,19 +1584,19 @@ SET character_set_client = @saved_cs_client;
/*!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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1811,26 +1796,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `t1`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
@@ -1860,12 +1845,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -1896,15 +1881,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
@@ -1930,15 +1915,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -1984,13 +1969,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2068,12 +2053,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2128,13 +2113,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2183,12 +2168,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2229,14 +2214,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2352,13 +2337,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2392,12 +2377,12 @@ end */;;
DELIMITER ;
/*!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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2442,13 +2427,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2456,12 +2441,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t2` WRITE;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
@@ -2587,12 +2572,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2680,13 +2665,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2717,13 +2702,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2770,12 +2755,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE "t1 test" (
"a1" int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES "t1 test" WRITE;
/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
@@ -2793,12 +2778,12 @@ INSERT INTO `t2 test` SET a2 = NEW.a1; END */;;
DELIMITER ;
/*!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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE "t2 test" (
"a2" int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES "t2 test" WRITE;
/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
@@ -2847,14 +2832,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2942,12 +2927,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -2993,13 +2978,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3028,13 +3013,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3189,12 +3174,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -3239,14 +3224,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
@@ -3261,7 +3246,7 @@ USE `mysqldump_views`;
/*!50001 DROP TABLE `nasishnasifu`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
+/*!50001 VIEW `nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
drop view nasishnasifu;
drop database mysqldump_views;
drop table mysqldump_tables.basetable;
@@ -3314,13 +3299,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=#;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
drop table t1;
drop user mysqltest_1@localhost;
#
@@ -3409,31 +3394,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `t2`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 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;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t3` WRITE;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
@@ -3509,13 +3494,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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`c1` int(11) default NULL,
`c2` longblob
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
DROP TABLE t1;
#
@@ -3574,5 +3559,140 @@ DROP TABLE t1,t2;
-- Dump completed on DATE
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
#
+# Bug #42635: mysqldump includes views that were excluded using
+# the --ignore-table option
+#
+create database db42635;
+use db42635;
+create table t1 (id int);
+create view db42635.v1 (c) as select * from db42635.t1;
+create view db42635.v2 (c) as select * from db42635.t1;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!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 */;
+DROP TABLE IF EXISTS `t1`;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `id` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 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;
+DROP TABLE IF EXISTS `v2`;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 CREATE TABLE `v2` (
+ `c` int(11)
+) ENGINE=MyISAM */;
+/*!50001 DROP TABLE `v2`*/;
+/*!50001 DROP VIEW IF EXISTS `v2`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v2` AS select `t1`.`id` AS `c` from `t1` */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+use test;
+drop database db42635;
+#
+# Bug#33550 mysqldump 4.0 compatibility broken
+#
+SET NAMES utf8;
+CREATE TABLE `straße` ( f1 INT );
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!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,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `straße`;
+CREATE TABLE `straße` (
+ `f1` int(11) default NULL
+) TYPE=MyISAM;
+
+LOCK TABLES `straße` WRITE;
+/*!40000 ALTER TABLE `straße` DISABLE KEYS */;
+/*!40000 ALTER TABLE `straße` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!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,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `straße`;
+CREATE TABLE `straße` (
+ `f1` int(11) default NULL
+) TYPE=MyISAM;
+
+LOCK TABLES `straße` WRITE;
+/*!40000 ALTER TABLE `straße` DISABLE KEYS */;
+/*!40000 ALTER TABLE `straße` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE `straße`;
+CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!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,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `כדשגכחךלדגכחשךדגחכךלדגכ`;
+CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` (
+ `f1` int(11) default NULL
+) TYPE=MyISAM;
+
+LOCK TABLES `כדשגכחךלדגכחשךדגחכךלדגכ` WRITE;
+/*!40000 ALTER TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` DISABLE KEYS */;
+/*!40000 ALTER TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!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,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`;
+SET NAMES latin1;
+#
# End of 5.0 tests
#
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index a7df1a523cf..e445bf3cc9b 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -210,7 +210,6 @@ source database
"MySQL: The world's most popular ;open source database"
echo message echo message
-mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
@@ -378,7 +377,6 @@ mysqltest: At line 1: The argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
-mysqltest: At line 1: system command 'false' failed
system command 'NonExistsinfComamdn 2> /dev/null' failed
test
test2
diff --git a/mysql-test/r/ndb_gis.result b/mysql-test/r/ndb_gis.result
index ec064ace651..0625128195b 100644
--- a/mysql-test/r/ndb_gis.result
+++ b/mysql-test/r/ndb_gis.result
@@ -291,7 +291,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
fid AsText(Centroid(g))
108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
+109 POINT(25.4166666666667 25.4166666666667)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
fid Area(g)
@@ -325,8 +325,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
@@ -835,7 +835,7 @@ Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
fid AsText(Centroid(g))
108 POINT(15 15)
-109 POINT(25.416666666667 25.416666666667)
+109 POINT(25.4166666666667 25.4166666666667)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
fid Area(g)
@@ -869,8 +869,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.588527753042 17.426536064114)
-118 POINT(55.588527753042 17.426536064114)
+117 POINT(55.5885277530424 17.426536064114)
+118 POINT(55.5885277530424 17.426536064114)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index c48333f6ea8..05a94b143f3 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -129,9 +129,11 @@ create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
diff --git a/mysql-test/r/ndb_restore_print.result b/mysql-test/r/ndb_restore_print.result
index e05f8e43d1a..8b50303c2dc 100644
--- a/mysql-test/r/ndb_restore_print.result
+++ b/mysql-test/r/ndb_restore_print.result
@@ -227,9 +227,11 @@ hex(h3) NULL
hex(i1) NULL
hex(i2) NULL
hex(i3) NULL
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
@@ -261,9 +263,11 @@ create table t4 (pk int key, a int) engine ndb;
insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
@@ -305,9 +309,11 @@ create table t1
insert into t1 values(1, 8388607, 16777215);
insert into t1 values(2, -8388608, 0);
insert into t1 values(3, -1, 1);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
+(id INT, backup_id INT) ENGINE = MEMORY;
DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat'
+INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 3e87b5b76b3..697fa33e7c7 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -77,12 +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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -111,12 +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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
@@ -145,12 +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;
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
-SET character_set_client = @saved_cs_client;
+/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result
index df0d9ff9adc..5cc63c4690d 100644
--- a/mysql-test/r/packet.result
+++ b/mysql-test/r/packet.result
@@ -1,3 +1,5 @@
+set @max_allowed_packet=@@global.max_allowed_packet;
+set @net_buffer_length=@@global.net_buffer_length;
set global max_allowed_packet=100;
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100'
@@ -33,3 +35,5 @@ len
select length(repeat('a',2000));
length(repeat('a',2000))
2000
+set global max_allowed_packet=@max_allowed_packet;
+set global net_buffer_length=@net_buffer_length;
diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result
index 24a6e594a14..7ed0c62f33a 100644
--- a/mysql-test/r/preload.result
+++ b/mysql-test/r/preload.result
@@ -144,7 +144,7 @@ Key_reads 0
load index into cache t3, t2 key (primary,b) ;
Table Op Msg_type Msg_text
test.t3 preload_keys Error Table 'test.t3' doesn't exist
-test.t3 preload_keys error Corrupt
+test.t3 preload_keys status Operation failed
test.t2 preload_keys status OK
show status like "key_read%";
Variable_name Value
@@ -159,7 +159,7 @@ Key_reads 0
load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text
test.t3 preload_keys Error Table 'test.t3' doesn't exist
-test.t3 preload_keys error Corrupt
+test.t3 preload_keys status Operation failed
test.t2 preload_keys Error Key 'c' doesn't exist in table 't2'
test.t2 preload_keys status Operation failed
show status like "key_read%";
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 09deaf2f322..43c50998e20 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -235,7 +235,7 @@ execute stmt1;
prepare stmt1 from "insert into t1 select i from t1";
execute stmt1;
execute stmt1;
-prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
+prepare stmt1 from "select * from t1 into outfile '<MYSQLTEST_VARDIR>/tmp/f1.txt'";
execute stmt1;
deallocate prepare stmt1;
drop table t1;
@@ -1386,13 +1386,13 @@ execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t4 repair Error Table 'test.t4' doesn't exist
-test.t4 repair error Corrupt
+test.t4 repair status Operation failed
test.t3 repair status OK
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t4 repair Error Table 'test.t4' doesn't exist
-test.t4 repair error Corrupt
+test.t4 repair status Operation failed
test.t3 repair status OK
prepare stmt from "optimize table t1, t3, t4";
execute stmt;
@@ -1400,23 +1400,23 @@ Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t3 optimize status OK
test.t4 optimize Error Table 'test.t4' doesn't exist
-test.t4 optimize error Corrupt
+test.t4 optimize status Operation failed
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t3 optimize status Table is already up to date
test.t4 optimize Error Table 'test.t4' doesn't exist
-test.t4 optimize error Corrupt
+test.t4 optimize status Operation failed
prepare stmt from "analyze table t4, t1";
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze Error Table 'test.t4' doesn't exist
-test.t4 analyze error Corrupt
+test.t4 analyze status Operation failed
test.t1 analyze status Table is already up to date
execute stmt;
Table Op Msg_type Msg_text
test.t4 analyze Error Table 'test.t4' doesn't exist
-test.t4 analyze error Corrupt
+test.t4 analyze status Operation failed
test.t1 analyze status Table is already up to date
deallocate prepare stmt;
drop table t1, t2, t3;
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result
index 1bf99a8ea07..4b405ddd71a 100644
--- a/mysql-test/r/read_only.result
+++ b/mysql-test/r/read_only.result
@@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt'
drop table t1,t2;
drop user test@localhost;
#
-# Bug #27440 read_only allows create and drop database
+# Bug#27440 read_only allows create and drop database
#
drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index c59a5300e64..e7866ae7656 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -27,7 +27,7 @@ drop table t1;
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair Error Table 'test.t1' doesn't exist
-test.t1 repair error Corrupt
+test.t1 repair status Operation failed
create table t1 engine=myisam SELECT 1,"table 1";
flush tables;
repair table t1;
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 98c79d4bc00..9afb528b6dd 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -443,3 +443,17 @@ SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
ROW(a, 1) IN (SELECT SUM(b), 3)
0
DROP TABLE t1;
+create table t1 (a varchar(200),
+b int unsigned not null primary key auto_increment)
+default character set 'utf8';
+create table t2 (c varchar(200),
+d int unsigned not null primary key auto_increment)
+default character set 'latin1';
+insert into t1 (a) values('abc');
+insert into t2 (c) values('abc');
+select * from t1,t2 where (a,b) = (c,d);
+a b c d
+abc 1 abc 1
+select host,user from mysql.user where (host,user) = ('localhost','test');
+host user
+drop table t1,t2;
diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result
index 33a8cdc4a2f..ff7f6ad6177 100644
--- a/mysql-test/r/rpl_failed_optimize.result
+++ b/mysql-test/r/rpl_failed_optimize.result
@@ -16,5 +16,5 @@ Error 1205 Lock wait timeout exceeded; try restarting transaction
OPTIMIZE TABLE non_existing;
Table Op Msg_type Msg_text
test.non_existing optimize Error Table 'test.non_existing' doesn't exist
-test.non_existing optimize error Corrupt
+test.non_existing optimize status Operation failed
drop table t1;
diff --git a/mysql-test/r/rpl_filter_tables_not_exist.result b/mysql-test/r/rpl_filter_tables_not_exist.result
new file mode 100644
index 00000000000..7eddaabc636
--- /dev/null
+++ b/mysql-test/r/rpl_filter_tables_not_exist.result
@@ -0,0 +1,151 @@
+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;
+CREATE TABLE t1 (id int, a int);
+CREATE TABLE t2 (id int, b int);
+CREATE TABLE t3 (id int, c int);
+CREATE TABLE t4 (id int, d int);
+CREATE TABLE t5 (id int, e int);
+CREATE TABLE t6 (id int, f int);
+CREATE TABLE t7 (id int, g int);
+CREATE TABLE t8 (id int, h int);
+CREATE TABLE t9 (id int, i int);
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t3 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t5 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t6 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t7 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t8 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t9 VALUES (1, 1), (2, 2), (3, 3);
+[on slave]
+SHOW TABLES LIKE 't%';
+Tables_in_test (t%)
+t1
+t2
+t3
+[on master]
+UPDATE t7 LEFT JOIN t4 ON (t4.id=t7.id) SET d=0, g=0 where t7.id=1;
+UPDATE t7 LEFT JOIN (t4, t5, t6) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t6.id) SET d=0, e=0, f=0, g=0 where t7.id=1;
+UPDATE t4 LEFT JOIN (t7, t8, t9) ON (t4.id=t7.id and t4.id=t8.id and t4.id=t9.id) SET d=0, g=0, h=0, i=0 where t4.id=1;
+UPDATE t7 LEFT JOIN (t8, t9) ON (t7.id=t8.id and t7.id=t9.id) SET g=0, h=0, i=0 where t7.id=1;
+UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET d=0 where t1.id=1;
+UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET g=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET d=0, e=0, f=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t4, t5, t8) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t8.id) SET d=0, e=0, h=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t7, t8, t5) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t5.id) SET g=0, h=0, e=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t2, t3, t5) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t5.id) SET e=0 where t1.id=1;
+UPDATE t4 LEFT JOIN t1 ON (t1.id=t4.id) SET a=0, d=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t7) ON (t4.id=t1.id and t7.id=t4.id) SET a = 0, d=0, g=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t2, t3) ON (t1.id=t4.id and t2.id=t4.id and t3.id=t4.id) SET a=0, b=0, c=0, d=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t2, t5) ON (t1.id=t4.id and t2.id=t4.id and t5.id=t4.id) SET a=0, b=0, e=0, d=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id) SET a=0, d=0, f=0, g=0 where t4.id=1;
+UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
+UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1;
+UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
+--source include/wait_for_slave_sql_error_and_skip.inc
+Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'
+set global sql_slave_skip_counter=1;
+include/start_slave.inc
+[on slave]
+show tables like 't%';
+Tables_in_test (t%)
+t1
+t2
+t3
+SELECT * FROM t1;
+id a
+1 1
+2 2
+3 3
+SELECT * FROM t2;
+id b
+1 1
+2 2
+3 3
+SELECT * FROM t3;
+id c
+1 1
+2 2
+3 3
+[on master]
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 67ce231a157..9558b0533ad 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2790,26 +2790,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(key1) from t1 where key1 <= 0.6158;
max(key1)
-0.61580002307892
+0.615800023078918
select max(key2) from t2 where key2 <= 1.6158;
max(key2)
-1.6158000230789
+1.61580002307892
select min(key1) from t1 where key1 >= 0.3762;
min(key1)
-0.37619999051094
+0.376199990510941
select min(key2) from t2 where key2 >= 1.3762;
min(key2)
-1.3761999607086
+1.37619996070862
select max(key1), min(key2) from t1, t2
where key1 <= 0.6158 and key2 >= 1.3762;
max(key1) min(key2)
-0.61580002307892 1.3761999607086
+0.615800023078918 1.37619996070862
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
max(key1)
-0.61580002307892
+0.615800023078918
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
min(key1)
-0.37619999051094
+0.376199990510941
DROP TABLE t1,t2;
create table t1(a bigint unsigned, b bigint);
insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index ad3138e80ea..ad73fc650a5 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -507,9 +507,9 @@ ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql
drop table mysqltest.t1;
drop database mysqltest;
set names binary;
-delete from mysql.user
+delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
-delete from mysql.db
+delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
@@ -916,7 +916,7 @@ def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33
Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost
----------------------------------------------------------------
-SELECT
+SELECT
TRIGGER_CATALOG,
TRIGGER_SCHEMA,
TRIGGER_NAME,
@@ -1094,7 +1094,7 @@ CREATE DATABASE mysqltest1;
use mysqltest1;
CREATE TABLE t1(ËÏÌÏÎËÁ1 INT);
----> Dumping mysqltest1 to show_check.mysqltest1.sql
+---> Dumping mysqltest1 to outfile1
DROP DATABASE mysqltest1;
diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result
index 8ef52e75238..47741fed250 100644
--- a/mysql-test/r/skip_name_resolve.result
+++ b/mysql-test/r/skip_name_resolve.result
@@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
-select user();
-user()
+SELECT USER();
+USER()
#
-show processlist;
+SHOW PROCESSLIST;
Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index 8462bafe0e3..106d08c8c12 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table
drop user user_bug14533@localhost;
drop database db_bug14533;
CREATE DATABASE db_bug7787;
-use db_bug7787;
+USE db_bug7787;
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
Warnings:
@@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_2_con
-use mysqltest;
+USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con
-use mysqltest;
+USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need the SUPER privilege for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
@@ -373,7 +373,7 @@ Warnings:
Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root
-use mysqltest;
+USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
@@ -403,7 +403,7 @@ CREATE USER mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_1_con
-use mysqltest;
+USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
CREATE FUNCTION bug13198_f1() RETURNS INT
@@ -416,7 +416,7 @@ bug13198_f1()
1
---> connection: mysqltest_2_con
-use mysqltest;
+USE mysqltest;
CALL bug13198_p1();
1
1
@@ -428,7 +428,7 @@ bug13198_f1()
DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con
-use mysqltest;
+USE mysqltest;
CALL bug13198_p1();
ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
SELECT bug13198_f1();
@@ -445,7 +445,7 @@ Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con
-use test;
+USE test;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index ec00435548c..84a4166a45d 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -581,7 +581,7 @@ return 2.7182818284590452354|
set @e = e()|
select e(), @e|
e() @e
-2.718281828459 2.718281828459
+2.71828182845905 2.71828182845905
drop function if exists inc|
create function inc(i int) returns int
return i+1|
@@ -618,7 +618,7 @@ create function fun(d double, i int, u int unsigned) returns double
return mul(inc(i), fac(u)) / e()|
select fun(2.3, 3, 5)|
fun(2.3, 3, 5)
-176.58213176229
+176.582131762292
insert into t2 values (append("xxx", "yyy"), mul(4,3), e())|
insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
select * from t2 where s = append("a", "b")|
@@ -2475,7 +2475,7 @@ Privilege Context Comment
Alter Tables To alter the table
Alter routine Functions,Procedures To alter or drop stored functions/procedures
Create Databases,Tables,Indexes To create new databases and tables
-Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE
+Create routine Databases To use CREATE FUNCTION/PROCEDURE
Create temporary tables Databases To use CREATE TEMPORARY TABLE
Create view Tables To create new views
Create user Server Admin To create new users
@@ -2527,7 +2527,7 @@ Privilege Context Comment
Alter Tables To alter the table
Alter routine Functions,Procedures To alter or drop stored functions/procedures
Create Databases,Tables,Indexes To create new databases and tables
-Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE
+Create routine Databases To use CREATE FUNCTION/PROCEDURE
Create temporary tables Databases To use CREATE TEMPORARY TABLE
Create view Tables To create new views
Create user Server Admin To create new users
@@ -5972,9 +5972,9 @@ CREATE TABLE t3 (f1 INT, f2 FLOAT)|
INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
SUM(f2) bug25373(f1)
-6.3000000715256 1
+6.30000007152557 1
15 2
-21.300000071526 NULL
+21.3000000715256 NULL
DROP FUNCTION bug25373|
DROP TABLE t3|
DROP DATABASE IF EXISTS mysqltest1|
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 8830ea11f97..0c7f9ae959c 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -192,11 +192,11 @@ select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
3 1
7 2
-select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt;
(select t3.a from t3 where a<8 order by 1 desc limit 1) a
7 2
-explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived3> system NULL NULL NULL NULL 1
@@ -2303,20 +2303,20 @@ drop table t1,t2;
CREATE TABLE t1 ( a int, b int );
CREATE TABLE t2 ( c int, d int );
INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
-SELECT a AS abc, b FROM t1 outr WHERE b =
+SELECT a AS abc, b FROM t1 outr WHERE b =
(SELECT MIN(b) FROM t1 WHERE a=outr.a);
abc b
1 2
2 3
3 4
-INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
+INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
(SELECT MIN(b) FROM t1 WHERE a=outr.a);
select * from t2;
c d
1 2
2 3
3 4
-CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
+CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
(SELECT MIN(b) FROM t1 WHERE a=outr.a);
select * from t3;
abc b
@@ -2517,8 +2517,8 @@ INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,680
INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
-SELECT DISTINCT Continent AS c FROM t1 outr WHERE
-Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
+SELECT DISTINCT Continent AS c FROM t1 outr WHERE
+Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
Population < 200);
c
Oceania
@@ -2628,32 +2628,32 @@ select
count(distinct t2.userid) pass,
groupstuff.*,
count(t2.courseid) crse,
-t1.categoryid,
+t1.categoryid,
t2.courseid,
date_format(date, '%b%y') as colhead
-from t2
-join t1 on t2.courseid=t1.courseid
+from t2
+join t1 on t2.courseid=t1.courseid
join
(
-select
-t5.userid,
-parentid,
-parentgroup,
-childid,
-groupname,
-grouptypeid
-from t5
-join
+select
+t5.userid,
+parentid,
+parentgroup,
+childid,
+groupname,
+grouptypeid
+from t5
+join
(
-select t4.id as parentid,
-t4.name as parentgroup,
-t4.id as childid,
-t4.name as groupname,
-t4.grouptypeid
-from t4
-) as gin on t5.groupid=gin.childid
-) as groupstuff on t2.userid = groupstuff.userid
-group by
+select t4.id as parentid,
+t4.name as parentgroup,
+t4.id as childid,
+t4.name as groupname,
+t4.grouptypeid
+from t4
+) as gin on t5.groupid=gin.childid
+) as groupstuff on t2.userid = groupstuff.userid
+group by
groupstuff.groupname, colhead , t2.courseid;
pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead
1 5141 12 group2 12 group2 5 1 5 12 Aug04
@@ -2929,9 +2929,9 @@ INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
-select * from t1 r1
-where (r1.retailerID,(r1.changed)) in
-(SELECT r2.retailerId,(max(changed)) from t1 r2
+select * from t1 r1
+where (r1.retailerID,(r1.changed)) in
+(SELECT r2.retailerId,(max(changed)) from t1 r2
group by r2.retailerId);
retailerID statusID changed
0026 2 2006-01-06 12:25:53
@@ -2943,41 +2943,41 @@ create table t1(a int, primary key (a));
insert into t1 values (10);
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
-explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
-ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
-ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
+explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
-SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
-ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
-ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
+SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
a a b
10 3 35989
-explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
-ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
-ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
+explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
-SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
-ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
-ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
+SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
a a b
10 1 359
drop table t1,t2;
-CREATE TABLE t1 (
-field1 int NOT NULL,
-field2 int NOT NULL,
-field3 int NOT NULL,
-PRIMARY KEY (field1,field2,field3)
+CREATE TABLE t1 (
+field1 int NOT NULL,
+field2 int NOT NULL,
+field3 int NOT NULL,
+PRIMARY KEY (field1,field2,field3)
);
-CREATE TABLE t2 (
-fieldA int NOT NULL,
-fieldB int NOT NULL,
-PRIMARY KEY (fieldA,fieldB)
+CREATE TABLE t2 (
+fieldA int NOT NULL,
+fieldB int NOT NULL,
+PRIMARY KEY (fieldA,fieldB)
);
INSERT INTO t1 VALUES
(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
@@ -2991,14 +2991,14 @@ field1 field2 COUNT(*)
SELECT field1, field2
FROM t1
GROUP BY field1, field2
-HAVING COUNT(*) >= ALL (SELECT fieldB
+HAVING COUNT(*) >= ALL (SELECT fieldB
FROM t2 WHERE fieldA = field1);
field1 field2
1 2
SELECT field1, field2
FROM t1
GROUP BY field1, field2
-HAVING COUNT(*) < ANY (SELECT fieldB
+HAVING COUNT(*) < ANY (SELECT fieldB
FROM t2 WHERE fieldA = field1);
field1 field2
1 1
@@ -3021,8 +3021,8 @@ a a IN (SELECT a FROM t1)
DROP TABLE t1,t2;
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
-CREATE TABLE t2 AS SELECT
-(SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
+CREATE TABLE t2 AS SELECT
+(SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
FROM t1 WHERE a > '2000-01-01';
SHOW CREATE TABLE t2;
Table Create Table
@@ -3188,7 +3188,7 @@ INSERT INTO t2 VALUES ( 6 );
CREATE TABLE t3 ( c3 integer );
INSERT INTO t3 VALUES ( 7 );
INSERT INTO t3 VALUES ( 8 );
-SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
+SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
c1 c2
2 NULL
@@ -3231,20 +3231,20 @@ E1
DROP TABLE t1,t2;
CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
INSERT INTO t1 VALUES (1, 1);
-CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
+CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
PRIMARY KEY(select_id,values_id));
INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5);
-SELECT values_id FROM t1
+SELECT values_id FROM t1
WHERE values_id IN (SELECT values_id FROM t2
WHERE select_id IN (1, 0));
values_id
1
-SELECT values_id FROM t1
+SELECT values_id FROM t1
WHERE values_id IN (SELECT values_id FROM t2
WHERE select_id BETWEEN 0 AND 1);
values_id
1
-SELECT values_id FROM t1
+SELECT values_id FROM t1
WHERE values_id IN (SELECT values_id FROM t2
WHERE select_id = 0 OR select_id = 1);
values_id
@@ -3259,7 +3259,7 @@ drop table t1;
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (c int, d int);
CREATE TABLE t3 (e int);
-INSERT INTO t1 VALUES
+INSERT INTO t1 VALUES
(1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40);
INSERT INTO t2 VALUES
(2,10), (2,20), (4,10), (5,10), (3,20), (2,40);
@@ -3322,7 +3322,7 @@ a
2
SELECT a FROM t1 GROUP BY a
HAVING a IN (SELECT c FROM t2
-WHERE MIN(b) < d AND
+WHERE MIN(b) < d AND
EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e <= d));
a
2
@@ -3373,7 +3373,7 @@ a
4
SELECT t1.a FROM t1 GROUP BY t1.a
HAVING t1.a > ALL(SELECT t2.c FROM t2
-WHERE EXISTS(SELECT t3.e FROM t3
+WHERE EXISTS(SELECT t3.e FROM t3
WHERE SUM(t1.a+t2.c) < t3.e/4));
ERROR HY000: Invalid use of group function
SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20;
@@ -3486,7 +3486,7 @@ mid bigint(20) unsigned NOT NULL,
date date NOT NULL,
PRIMARY KEY (id)
);
-INSERT INTO t2 VALUES
+INSERT INTO t2 VALUES
(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
SELECT *,
@@ -3524,7 +3524,7 @@ i2 int(11) NOT NULL default '0',
t datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (i1,i2,t)
);
-INSERT INTO t1 VALUES
+INSERT INTO t1 VALUES
(24,1,'2005-03-03 16:31:31'),(24,1,'2005-05-27 12:40:07'),
(24,1,'2005-05-27 12:40:08'),(24,1,'2005-05-27 12:40:10'),
(24,1,'2005-05-27 12:40:25'),(24,1,'2005-05-27 12:40:30'),
@@ -3540,7 +3540,7 @@ PRIMARY KEY (i1)
INSERT INTO t2 VALUES (24,1,'2006-06-20 12:29:40');
EXPLAIN
SELECT * FROM t1,t2
-WHERE t1.t = (SELECT t1.t FROM t1
+WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -3548,7 +3548,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 DEPENDENT SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
SELECT * FROM t1,t2
-WHERE t1.t = (SELECT t1.t FROM t1
+WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
i1 i2 t i1 i2 t
@@ -3557,22 +3557,22 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (i INT);
(SELECT i FROM t1) UNION (SELECT i FROM t1);
i
-SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
(
-(SELECT i FROM t1) UNION
+(SELECT i FROM t1) UNION
(SELECT i FROM t1)
);
-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 'UNION
+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 'UNION
(SELECT i FROM t1)
)' at line 3
-SELECT * FROM t1
+SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
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 'UNION (SELECT i FROM t1)))' at line 2
explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
from t1;
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 'union (select t12.i from t1 t12))
from t1' at line 1
-explain select * from t1 where not exists
+explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
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 'union (select t12.i from t1 t12))' at line 2
DROP TABLE t1;
@@ -3591,9 +3591,9 @@ insert into t1 (a) select FLOOR(rand() * 100) from t1;
insert into t1 (a) select FLOOR(rand() * 100) from t1;
insert into t1 (a) select FLOOR(rand() * 100) from t1;
insert into t1 (a) select FLOOR(rand() * 100) from t1;
-SELECT a,
-(SELECT REPEAT(' ',250) FROM t1 i1
-WHERE i1.b=t1.a ORDER BY RAND() LIMIT 1) AS a
+SELECT a,
+(SELECT REPEAT(' ',250) FROM t1 i1
+WHERE i1.b=t1.a ORDER BY RAND() LIMIT 1) AS a
FROM t1 ORDER BY a LIMIT 5;
a a
0 NULL
@@ -3622,7 +3622,7 @@ COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
2 2
1 1
1 1
-SELECT COUNT(DISTINCT t1.b),
+SELECT COUNT(DISTINCT t1.b),
(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
FROM t1 GROUP BY t1.a;
COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
@@ -3633,7 +3633,7 @@ SELECT (
SELECT (
SELECT COUNT(DISTINCT t1.b)
)
-)
+)
FROM t1 GROUP BY t1.a;
(
SELECT (
@@ -3648,8 +3648,8 @@ SELECT (
SELECT (
SELECT COUNT(DISTINCT t1.b)
)
-)
-FROM t1 GROUP BY t1.a LIMIT 1)
+)
+FROM t1 GROUP BY t1.a LIMIT 1)
FROM t1 t2
GROUP BY t2.a;
(
@@ -3657,7 +3657,7 @@ SELECT (
SELECT (
SELECT COUNT(DISTINCT t1.b)
)
-)
+)
FROM t1 GROUP BY t1.a LIMIT 1)
2
2
@@ -3669,13 +3669,13 @@ PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
SET SESSION sort_buffer_size = 32 * 1024;
Warnings:
Warning 1292 Truncated incorrect sort_buffer_size value: '32768'
-SELECT SQL_NO_CACHE COUNT(*)
+SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
COUNT(*)
3000
SET SESSION sort_buffer_size = 8 * 1024 * 1024;
-SELECT SQL_NO_CACHE COUNT(*)
+SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
COUNT(*)
@@ -3736,7 +3736,7 @@ sq
2
4
DEALLOCATE PREPARE stmt1;
-SELECT f2, AVG(f21),
+SELECT f2, AVG(f21),
(SELECT t.f3 FROM t2 AS t WHERE t2.f2=t.f2 AND t.f3=MAX(t2.f3)) AS test
FROM t2 GROUP BY f2;
f2 AVG(f21) test
@@ -3744,12 +3744,12 @@ f2 AVG(f21) test
2 2.0000 2004-02-29 11:11:11
DROP TABLE t1,t2;
CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL);
-INSERT INTO t1 VALUES
-(1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
-(2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'), (3,3,'j'),
+INSERT INTO t1 VALUES
+(1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
+(2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'), (3,3,'j'),
(3,2,'k'), (3,1,'l'), (1,9,'m');
-SELECT a, MAX(b),
-(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
+SELECT a, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
FROM t1 GROUP BY a;
a MAX(b) test
1 9 m
@@ -3900,7 +3900,7 @@ COUNT(*) a (SELECT MIN(m) FROM t2 WHERE m = count(*))
2 2 2
3 3 3
1 4 1
-SELECT COUNT(*), a
+SELECT COUNT(*), a
FROM t1 GROUP BY a
HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
COUNT(*) a
@@ -3931,7 +3931,7 @@ INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
SELECT a, MAX(b),
-(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
FROM t1 GROUP BY a;
a MAX(b) test
1 9 m
@@ -3953,7 +3953,7 @@ a AVG(b) test
3 2.5000 NULL
SELECT tt.a,
(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
-LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
FROM t1 as tt;
a test
1 n
@@ -3975,7 +3975,7 @@ a test
SELECT tt.a,
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
LIMIT 1)
-FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
FROM t1 as tt GROUP BY tt.a;
a test
1 n
@@ -3984,7 +3984,7 @@ a test
SELECT tt.a, MAX(
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
LIMIT 1)
-FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
FROM t1 as tt GROUP BY tt.a;
a test
1 n
@@ -4027,11 +4027,11 @@ COUNT(1)
1
SELECT SUM( (SELECT AVG( (SELECT t1.a FROM t2) ) FROM DUAL) ) FROM t1;
ERROR HY000: Invalid use of group function
-SELECT
+SELECT
SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING t1.a < 12) ) FROM t2) )
FROM t1;
ERROR HY000: Invalid use of group function
-SELECT t1.a as XXA,
+SELECT t1.a as XXA,
SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING XXA < 12) ) FROM t2) )
FROM t1;
ERROR HY000: Invalid use of group function
@@ -4048,25 +4048,25 @@ INSERT INTO t1 VALUES
(3,'FL'), (2,'GA'), (4,'FL'), (1,'GA'), (5,'NY'), (7,'FL'), (6,'NY');
CREATE TABLE t2 (id int NOT NULL, INDEX idx(id));
INSERT INTO t2 VALUES (7), (5), (1), (3);
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
id st
3 FL
1 GA
7 FL
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
GROUP BY id;
id st
1 GA
3 FL
7 FL
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
id st
2 GA
4 FL
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
GROUP BY id;
id st
@@ -4272,7 +4272,7 @@ a b
DROP TABLE t1,t2;
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1,1), (1,2), (2,3), (2,4);
-EXPLAIN
+EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a;
@@ -4281,7 +4281,7 @@ SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a;
ERROR 42S22: Unknown column 'out_a' in 'where clause'
-EXPLAIN
+EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
GROUP BY a;
@@ -4312,16 +4312,16 @@ Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 AS `1` from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
EXPLAIN EXTENDED
-SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
-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 'UNION
+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 'UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a))' at line 2
DROP TABLE t1,t2;
create table t1(f11 int, f12 int);
create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
insert into t1 values(1,1),(2,2), (3, 3);
set session sort_buffer_size= 33*1024;
-select count(*) from t1 where f12 =
+select count(*) from t1 where f12 =
(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
count(*)
3
@@ -4362,12 +4362,12 @@ IF(
FROM t2 VPC, t4 a2, t2 a3
WHERE
VPC.f4 = a2.f10 AND a3.f2 = a4
-LIMIT 1) IS NULL,
-0,
+LIMIT 1) IS NULL,
+0,
t3.f5
)
) AS a6
-FROM
+FROM
t2, t3, t1 JOIN t2 a1 ON t1.f9 = a1.f4
GROUP BY a4;
a4 f3 a6
@@ -4376,7 +4376,7 @@ a4 f3 a6
DROP TABLE t1, t2, t3, t4;
create table t1 (a float(5,4) zerofill);
create table t2 (a float(5,4),b float(2,0));
-select t1.a from t1 where
+select t1.a from t1 where
t1.a= (select b from t2 limit 1) and not
t1.a= (select a from t2 limit 1) ;
a
@@ -4407,7 +4407,7 @@ pk a
3 30
2 20
DROP TABLE t1,t2;
-CREATE TABLE t1 (s1 char(1));
+CREATE TABLE t1 (s1 CHAR(1));
INSERT INTO t1 VALUES ('a');
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
s1
diff --git a/mysql-test/r/synchronization.result b/mysql-test/r/synchronization.result
index 29557b6cfd4..44edfb1e535 100644
--- a/mysql-test/r/synchronization.result
+++ b/mysql-test/r/synchronization.result
@@ -1,6 +1,6 @@
-drop table if exists t1;
-CREATE TABLE t1 (x1 int);
-ALTER TABLE t1 CHANGE x1 x2 int;
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 (x1 INT);
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -8,7 +8,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -32,7 +32,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -56,7 +56,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -72,7 +72,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -80,7 +80,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -88,7 +88,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -104,7 +104,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -112,7 +112,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -128,7 +128,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -136,7 +136,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -144,7 +144,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x1 x2 int;
+ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
@@ -152,7 +152,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
-ALTER TABLE t1 CHANGE x2 x1 int;
+ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
index 6839cacab43..81c7a14c173 100644
--- a/mysql-test/r/trigger-compat.result
+++ b/mysql-test/r/trigger-compat.result
@@ -13,9 +13,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
-FOR EACH ROW
-INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
---> patching t1.TRG...
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 8caabbff047..d3a136d53d2 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -385,12 +385,12 @@ Warning 1264 Out of range value adjusted for column 'f1' at row 1
Warning 1264 Out of range value adjusted for column 'f1' at row 2
select f1 + 0e0 from t1;
f1 + 0e0
-1.0000000150475e+29
--1.0000000150475e+29
-1.0000000150475e+30
--1.0000000150475e+30
-1.0000000150475e+30
--1.0000000150475e+30
+1.00000001504747e+29
+-1.00000001504747e+29
+1.00000001504747e+30
+-1.00000001504747e+30
+1.00000001504747e+30
+-1.00000001504747e+30
drop table t1;
create table t1(d double, u bigint unsigned);
insert into t1(d) values (9.22337203685479e18),
@@ -401,4 +401,10 @@ u
9223372036854790144
18400000000000000000
drop table t1;
+CREATE TABLE t1 (f1 DOUBLE);
+INSERT INTO t1 VALUES(-1.79769313486231e+308);
+SELECT f1 FROM t1;
+f1
+-1.79769313486231e+308
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 6007fdd403a..04bd818df89 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1447,12 +1447,12 @@ SELECT a FROM t1
UNION
SELECT a FROM t1
) alias;
-SELECT a INTO OUTFILE 'union.out.file' FROM (
+SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
-SELECT a INTO DUMPFILE 'union.out.file2' FROM (
+SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
@@ -1465,21 +1465,21 @@ SELECT a INTO @v FROM t1
SELECT a FROM (
SELECT a FROM t1
UNION
-SELECT a INTO OUTFILE 'union.out.file3' FROM t1
+SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1
) alias;
SELECT a FROM (
SELECT a FROM t1
UNION
-SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
+SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1
) alias;
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
-SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
-SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1;
+SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1;
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
ERROR HY000: Incorrect usage of UNION and INTO
-SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
+SELECT a INTO OUTFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1 UNION SELECT a FROM t1;
ERROR HY000: Incorrect usage of UNION and INTO
-SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
+SELECT a INTO DUMPFILE '<MYSQLTEST_VARDIR>/tmp/union.out.file' FROM t1 UNION SELECT a FROM t1;
ERROR HY000: Incorrect usage of UNION and INTO
DROP TABLE t1;
CREATE TABLE t1 (a INT);
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 376a8ffa38e..fbec38c9a9f 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -236,32 +236,66 @@ set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5);
ROUND(RAND(),5)
0.02887
-show variables like '%alloc%';
+
+==+ Testing %alloc% system variables +==
+==+ NOTE: These values *must* be a multiple of 1024 +==
+==+ Other values will be rounded down to nearest multiple +==
+
+==+ Show initial values +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
range_alloc_block_size 4096
transaction_alloc_block_size 8192
transaction_prealloc_size 4096
-set @@range_alloc_block_size=1024*16;
+==+ Manipulate variable values +=
+Testing values that are multiples of 1024
+set @@range_alloc_block_size=1024*15+1024;
+set @@query_alloc_block_size=1024*15+1024*2;
+set @@query_prealloc_size=1024*18-1024;
+set @@transaction_alloc_block_size=1024*21-1024*1;
+set @@transaction_prealloc_size=1024*21-2048;
+==+ Check manipulated values ==+
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+Variable_name Value
+query_alloc_block_size 17408
+query_prealloc_size 17408
+range_alloc_block_size 16384
+transaction_alloc_block_size 20480
+transaction_prealloc_size 19456
+==+ Manipulate variable values +==
+Testing values that are not 1024 multiples
+set @@range_alloc_block_size=1024*16+1023;
set @@query_alloc_block_size=1024*17+2;
-set @@query_prealloc_size=1024*18;
+set @@query_prealloc_size=1024*18-1023;
set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
@@query_alloc_block_size
17408
-show variables like '%alloc%';
+==+ Check manipulated values ==+
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
Variable_name Value
query_alloc_block_size 17408
-query_prealloc_size 18432
+query_prealloc_size 17408
range_alloc_block_size 16384
transaction_alloc_block_size 19456
transaction_prealloc_size 20480
+==+ Set values back to the default values +==
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
-show variables like '%alloc%';
+==+ Check the values now that they are reset +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
Variable_name Value
query_alloc_block_size 8192
query_prealloc_size 8192
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 311b77e7a99..58aa614c508 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1667,9 +1667,9 @@ INSERT INTO t2 VALUES (4,3,'n');
INSERT INTO t2 VALUES (6,1,'n');
INSERT INTO t2 VALUES (8,1,'y');
CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT a.col1,a.col2,b.col2,b.col3
+SELECT a.col1,a.col2,b.col2,b.col3
FROM t1 a LEFT JOIN t2 b ON a.col1=b.col1
-WHERE b.col2 IS NULL OR
+WHERE b.col2 IS NULL OR
b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
col1 col2 col2 col3
1 trudy 2 y
@@ -1681,9 +1681,9 @@ col1 col2 col2 col3
7 carsten NULL NULL
8 ranger 1 y
10 matt NULL NULL
-SELECT a.col1,a.col2,b.col2,b.col3
+SELECT a.col1,a.col2,b.col2,b.col3
FROM v1 a LEFT JOIN t2 b ON a.col1=b.col1
-WHERE b.col2 IS NULL OR
+WHERE b.col2 IS NULL OR
b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
col1 col2 col2 col3
1 trudy 2 y
@@ -1737,7 +1737,7 @@ A A
2 2
3 3
create table t3 as select a a,a b from t2;
-create view v2 as select * from t3 where
+create view v2 as select * from t3 where
a in (select * from t1) or b in (select * from t2);
select * from v2 A, v2 B where A.a = B.b;
a b a b
@@ -1993,7 +1993,7 @@ dkjhgd
drop view v1;
create table t1 (f59 int, f60 int, f61 int);
insert into t1 values (19,41,32);
-create view v1 as select f59, f60 from t1 where f59 in
+create view v1 as select f59, f60 from t1 where f59 in
(select f59 from t1);
update v1 set f60=2345;
ERROR HY000: The target table v1 of the UPDATE is not updatable
@@ -2120,7 +2120,7 @@ pid int NOT NULL
INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d');
INSERT INTO t2 values (1,1), (2,1), (2,2);
CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid;
-SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
+SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
WHERE t1.aid = t2.aid GROUP BY pid;
pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1)
1 a b,c d
@@ -2222,7 +2222,7 @@ group_name varchar(32) NOT NULL
) engine = InnoDB;
create table t2 (
r_object_id char(16) NOT NULL,
-i_position int(11) NOT NULL,
+i_position int(11) NOT NULL,
users_names varchar(32) default NULL
) Engine = InnoDB;
create view v1 as select r_object_id, group_name from t1;
@@ -2235,7 +2235,7 @@ insert into t1 values('120001a080000542','tstgroup1');
insert into t2 values('120001a080000542',-1, 'guser01');
insert into t2 values('120001a080000542',-2, 'guser02');
select v1.r_object_id, v2.users_names from v1, v2
-where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
+where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
order by users_names;
r_object_id users_names
120001a080000542 guser01
@@ -2385,8 +2385,8 @@ create table t4 (x int, y int, z int);
create view v1 as
select t1.x
from (
-(t1 join t2 on ((t1.y = t2.y)))
-join
+(t1 join t2 on ((t1.y = t2.y)))
+join
(t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
);
prepare stmt1 from "select count(*) from v1 where x = ?";
@@ -2562,12 +2562,12 @@ Warnings:
Warning 1052 Column 'x' in group statement is ambiguous
DROP VIEW v1;
DROP TABLE t1;
-drop table if exists t1;
-drop view if exists v1;
-create table t1 (id int);
-create view v1 as select * from t1;
-drop table t1;
-show create view v1;
+drop table if exists t1;
+drop view if exists v1;
+create table t1 (id int);
+create view v1 as select * from t1;
+drop table t1;
+show create view v1;
drop view v1;
//
View Create View
@@ -2614,7 +2614,7 @@ DROP VIEW v2;
DROP TABLE t1, t2;
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
td date DEFAULT NULL, KEY idx(td));
-INSERT INTO t1 VALUES
+INSERT INTO t1 VALUES
(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
@@ -2978,10 +2978,10 @@ drop view v1;
drop table t1;
CREATE TABLE t1(pk int PRIMARY KEY);
CREATE TABLE t2(pk int PRIMARY KEY, fk int, ver int, org int);
-CREATE ALGORITHM=MERGE VIEW v1 AS
+CREATE ALGORITHM=MERGE VIEW v1 AS
SELECT t1.*
-FROM t1 JOIN t2
-ON t2.fk = t1.pk AND
+FROM t1 JOIN t2
+ON t2.fk = t1.pk AND
t2.ver = (SELECT MAX(t.ver) FROM t2 t WHERE t.org = t2.org);
SHOW WARNINGS;
Level Code Message
@@ -3311,7 +3311,7 @@ name char(10) NOT NULL
INSERT INTO t1 (lid, name) VALUES
(1, 'YES'), (2, 'NO');
CREATE TABLE t2 (
-id int NOT NULL PRIMARY KEY,
+id int NOT NULL PRIMARY KEY,
gid int NOT NULL,
lid int NOT NULL,
dt date
@@ -3410,8 +3410,8 @@ CREATE TABLE t1 (id int);
CREATE TABLE t2 (id int, c int DEFAULT 0);
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id) VALUES (1);
-CREATE VIEW v1 AS
-SELECT t2.c FROM t1, t2
+CREATE VIEW v1 AS
+SELECT t2.c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
UPDATE v1 SET c=1;
DROP VIEW v1;
@@ -3519,7 +3519,7 @@ role_name varchar(100) default NULL,
app_name varchar(40) NOT NULL,
INDEX idx_app_name(app_name)
);
-CREATE VIEW v1 AS
+CREATE VIEW v1 AS
SELECT profile.person_id AS person_id
FROM t1 profile, t2 userrole, t3 role
WHERE userrole.person_id = profile.person_id AND
@@ -3531,7 +3531,7 @@ INSERT INTO t1 VALUES
(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
INSERT INTO t2 VALUES
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
-INSERT INTO t3 VALUES
+INSERT INTO t3 VALUES
(1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'),
(3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'),
(5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'),
@@ -3557,7 +3557,7 @@ i
2
3
4
-select table_name, is_updatable from information_schema.views
+select table_name, is_updatable from information_schema.views
where table_name = 'v1';
table_name is_updatable
v1 NO
@@ -3603,8 +3603,8 @@ DROP VIEW v2;
DROP VIEW v3;
DROP TABLE t1;
#
-# Bug#29477: Not all fields of the target table were checked to have
-# a default value when inserting into a view.
+# Bug#29477 Not all fields of the target table were checked to have
+# a default value when inserting into a view.
#
create table t1(f1 int, f2 int not null);
create view v1 as select f1 from t1;
@@ -3621,7 +3621,7 @@ drop table t1;
create table t1 (a int, key(a));
create table t2 (c int);
create view v1 as select a b from t1;
-create view v2 as select 1 a from t2, v1 where c in
+create view v2 as select 1 a from t2, v1 where c in
(select 1 from t1 where b = a);
insert into t1 values (1), (1);
insert into t2 values (1), (1);
@@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a)
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
-# -- Bug#34337: Server crash when Altering a view using a table name.
+# -- Bug#34337 Server crash when Altering a view using a table name.
# -----------------------------------------------------------------
DROP TABLE IF EXISTS t1;
@@ -3660,8 +3660,8 @@ DROP TABLE t1;
# -- End of test case for Bug#34337.
# -----------------------------------------------------------------
-# -- Bug#35193: VIEW query is rewritten without "FROM DUAL",
-# -- causing syntax error
+# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
+# -- causing syntax error
# -----------------------------------------------------------------
CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 53ad8642ba4..e7a50451cec 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -26,7 +26,7 @@ create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
grant create view,drop,select on test.* to mysqltest_1@localhost;
use test;
alter view v1 as select * from mysqltest.t1;
@@ -307,7 +307,7 @@ grant create view,select on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1;
show create view v1;
View Create View
-v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
revoke select on mysqltest.t1 from mysqltest_1@localhost;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
@@ -644,7 +644,7 @@ CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
-CREATE OR REPLACE VIEW test.v1 AS
+CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
DROP VIEW test2.t3;
@@ -788,7 +788,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP USER u26813@localhost;
DROP DATABASE db26813;
#
-# Bug#29908: A user can gain additional access through the ALTER VIEW.
+# Bug#29908 A user can gain additional access through the ALTER VIEW.
#
CREATE DATABASE mysqltest_29908;
USE mysqltest_29908;
@@ -919,4 +919,30 @@ c4
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_u1@localhost;
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
+GRANT SELECT (f1) ON t1 TO foo;
+GRANT SELECT (f1) ON v1 TO foo;
+USE db1;
+SELECT f1 FROM t1;
+f1
+SELECT f2 FROM t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 't1'
+SELECT * FROM t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
+SELECT f1 FROM v1;
+f1
+SELECT f2 FROM v1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1'
+SELECT * FROM v1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v1'
+USE test;
+REVOKE SELECT (f1) ON db1.t1 FROM foo;
+REVOKE SELECT (f1) ON db1.v1 FROM foo;
+DROP USER foo;
+DROP VIEW db1.v1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
End of 5.0 tests.
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index 5a54db8bb84..43ba878b9a5 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -19,4 +19,22 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
DROP TABLE t1;
+CREATE DATABASE `TESTDB`;
+USE `TESTDB`;
+CREATE FUNCTION test_fn() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+CREATE FUNCTION test_fn2() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+DROP FUNCTION `TESTDB`.`test_fn`;
+DROP FUNCTION `testdb`.`test_fn2`;
+USE test;
+DROP DATABASE `TESTDB`;
End of 5.0 tests.
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 c2689a36801..0bd83c81bcf 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -5245,7 +5245,7 @@ WHERE select_id = 1 OR select_id IS NULL order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
-3037000499.976 9223372036854775807 3
+3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
@@ -5259,7 +5259,7 @@ WHERE select_id = 1 OR select_id IS NULL) order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
-3037000499.976 9223372036854775807 3
+3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index d29e38925f6..30c7261d09e 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -21367,7 +21367,7 @@ 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 Corrupt
+test.v1 check status Operation failed
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
@@ -22824,7 +22824,7 @@ f1 f2
ABC 3
SELECT * FROM v1 order by 2;
f1 my_sqrt
-ABC 1.7320508075689
+ABC 1.73205080756888
ALTER TABLE t1 CHANGE COLUMN f2 f2 VARCHAR(30);
INSERT INTO t1 SET f1 = 'ABC', f2 = 'DEF';
DESCRIBE t1;
@@ -22842,7 +22842,7 @@ ABC DEF
SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
-ABC 1.7320508075689
+ABC 1.73205080756888
SELECT SQRT('DEF');
SQRT('DEF')
0
@@ -22862,7 +22862,7 @@ my_sqrt double YES NULL
SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
-ABC 1.7320508075689
+ABC 1.73205080756888
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
SELECT * FROM t2 order by 2;
f1 ABC
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 c2689a36801..0bd83c81bcf 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -5245,7 +5245,7 @@ WHERE select_id = 1 OR select_id IS NULL order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
-3037000499.976 9223372036854775807 3
+3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
@@ -5259,7 +5259,7 @@ WHERE select_id = 1 OR select_id IS NULL) order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
-3037000499.976 9223372036854775807 3
+3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 7bd674b8d76..9935e17a1dc 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -21368,7 +21368,7 @@ 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 Corrupt
+test.v1 check status Operation failed
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
@@ -22825,7 +22825,7 @@ f1 f2
ABC 3
SELECT * FROM v1 order by 2;
f1 my_sqrt
-ABC 1.7320508075689
+ABC 1.73205080756888
ALTER TABLE t1 CHANGE COLUMN f2 f2 VARCHAR(30);
INSERT INTO t1 SET f1 = 'ABC', f2 = 'DEF';
DESCRIBE t1;
@@ -22843,7 +22843,7 @@ ABC DEF
SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
-ABC 1.7320508075689
+ABC 1.73205080756888
SELECT SQRT('DEF');
SQRT('DEF')
0
@@ -22863,7 +22863,7 @@ my_sqrt double YES NULL
SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
-ABC 1.7320508075689
+ABC 1.73205080756888
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
SELECT * FROM t2 order by 2;
f1 ABC
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 c2689a36801..0bd83c81bcf 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -5245,7 +5245,7 @@ WHERE select_id = 1 OR select_id IS NULL order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
-3037000499.976 9223372036854775807 3
+3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
@@ -5259,7 +5259,7 @@ WHERE select_id = 1 OR select_id IS NULL) order by id;
sqrt(my_bigint) my_bigint id
NULL NULL 1
NULL -9223372036854775808 2
-3037000499.976 9223372036854775807 3
+3037000499.97605 9223372036854775807 3
0 0 4
NULL -1 5
2 4 6
diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result
index bde591c13bf..c0b12796355 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views.result
@@ -23043,7 +23043,7 @@ 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 Corrupt
+test.v1 check status Operation failed
DESCRIBE v1;
ERROR 42S02: Table 'test.v1' doesn't exist
EXPLAIN SELECT * FROM v1;
@@ -24527,7 +24527,7 @@ f1 f2
ABC 3
SELECT * FROM v1 order by 2;
f1 my_sqrt
-ABC 1.7320508075689
+ABC 1.73205080756888
ALTER TABLE t1 CHANGE COLUMN f2 f2 VARCHAR(30);
INSERT INTO t1 SET f1 = 'ABC', f2 = 'DEF';
DESCRIBE t1;
@@ -24545,7 +24545,7 @@ ABC DEF
SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
-ABC 1.7320508075689
+ABC 1.73205080756888
SELECT SQRT('DEF');
SQRT('DEF')
0
@@ -24565,7 +24565,7 @@ my_sqrt double YES NULL
SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
-ABC 1.7320508075689
+ABC 1.73205080756888
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
SELECT * FROM t2 order by 2;
f1 ABC
diff --git a/mysql-test/t/alter_table-big.test b/mysql-test/t/alter_table-big.test
index 9a773f48a9c..acc4f73dfff 100644
--- a/mysql-test/t/alter_table-big.test
+++ b/mysql-test/t/alter_table-big.test
@@ -1,4 +1,4 @@
-# In order to be more or less robust test for bug#25044 has to take
+# In order to be more or less robust test for Bug#25044 has to take
# significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog.
@@ -6,8 +6,8 @@
#
-# Test for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global
-# 'opening tables' lock".
+# Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
+# 'opening tables' lock
#
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution.
@@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
# Clean up
drop tables t1, t2;
+disconnect addconroot;
--echo End of 5.0 tests
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index b05eef6a3ad..34982b391ac 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -1,7 +1,10 @@
# The server need to be started in $MYSQLTEST_VARDIR since it
# uses ../std_data_ln/
--- source include/uses_vardir.inc
+--source include/uses_vardir.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
#
# This test is a bit tricky as we can't use backup table to overwrite an old
@@ -12,7 +15,7 @@ connect (con2,localhost,root,,);
connection con1;
set SQL_LOG_BIN=0;
--disable_warnings
-drop table if exists t1, t2, t3;
+drop table if exists t1, t2, t3, t4;
--enable_warnings
create table t4(n int);
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -57,6 +60,9 @@ unlock tables;
connection con1;
reap;
drop table t5;
+connection default;
+disconnect con1;
+disconnect con2;
remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
@@ -68,4 +74,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
+
# End of 4.1 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
index 698f6538529..ff23b352b5a 100644
--- a/mysql-test/t/check.test
+++ b/mysql-test/t/check.test
@@ -1,8 +1,12 @@
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
+drop view if exists v1;
--enable_warnings
# Add a lot of keys to slow down check
@@ -20,16 +24,18 @@ connection con2;
insert into t1 values (200000);
connection con1;
reap;
+connection default;
+disconnect con1;
+disconnect con2;
drop table t1;
+
# End of 4.1 tests
#
-# Bug #9897 Views: 'Check Table' crashes MySQL, with a view and a table
-# in the statement
+# Bug#9897 Views: 'Check Table' crashes MySQL, with a view and a table
+# in the statement
#
-
-connection default;
Create table t1(f1 int);
Create table t2(f1 int);
Create view v1 as Select * from t1;
@@ -37,11 +43,15 @@ Check Table v1,t2;
drop view v1;
drop table t1, t2;
+
#
-# BUG#26325 - TEMPORARY TABLE "corrupt" after first read, according to CHECK
-# TABLE
+# 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;
+
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/compress.test b/mysql-test/t/compress.test
index 3f1892b5dec..8e12ab46f06 100644
--- a/mysql-test/t/compress.test
+++ b/mysql-test/t/compress.test
@@ -6,6 +6,10 @@
-- source include/have_compress.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+
connect (comp_con,localhost,root,,,,,COMPRESS);
# Check compression turned on
@@ -16,3 +20,10 @@ SHOW STATUS LIKE 'Compression';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
+
+connection default;
+disconnect comp_con;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index 2147d5b71af..c3a14964bb7 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -18,12 +18,16 @@ connect (con2,localhost,root,,test);
show tables;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,);
+connection default;
+disconnect con1;
+disconnect con2;
+
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
@@ -35,20 +39,23 @@ show tables;
connect (con4,localhost,test,gambling,test);
show tables;
+connection default;
+disconnect con3;
+disconnect con4;
+
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,"");
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
-
# check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
@@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql);
connection con5;
set password="";
---error 1372
+--error ER_PASSWD_LENGTH
set password='gambling3';
set password=old_password('gambling3');
show tables;
connect (con6,localhost,test,gambling3,test);
show tables;
+connection default;
+disconnect con10;
+disconnect con5;
+disconnect con6;
+
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
-
delete from mysql.user where user=_binary"test";
flush privileges;
@@ -98,4 +109,5 @@ disconnect con7;
connection default;
drop table t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/consistent_snapshot.test b/mysql-test/t/consistent_snapshot.test
index 8da8e9ce660..82edf2e22b2 100644
--- a/mysql-test/t/consistent_snapshot.test
+++ b/mysql-test/t/consistent_snapshot.test
@@ -1,43 +1,61 @@
--- source include/have_innodb.inc
+--source include/have_innodb.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
+--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
+--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
+--echo # Switch to connection con1
connection con1;
-create table t1 (a int) engine=innodb;
-start transaction with consistent snapshot;
+CREATE TABLE t1 (a INT) ENGINE=innodb;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+--echo # Switch to connection con2
connection con2;
-insert into t1 values(1);
+INSERT INTO t1 VALUES(1);
+--echo # Switch to connection con1
connection con1;
-select * from t1; # if consistent snapshot was set as expected, we
+SELECT * FROM t1; # if consistent snapshot was set as expected, we
# should see nothing.
-commit;
+COMMIT;
### Test 2:
### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction.
-delete from t1;
-start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
+DELETE FROM t1;
+START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
+--echo # Switch to connection con2
connection con2;
-insert into t1 values(1);
+INSERT INTO t1 VALUES(1);
+--echo # Switch to connection con1
connection con1;
-select * from t1; # if consistent snapshot was not set, as expected, we
+SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
# should see 1.
-commit;
+COMMIT;
-drop table t1;
+--echo # Switch to connection default + close connections con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1;
# End of 4.1 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test
index cfef8dfe81a..6b6abbcfbcc 100644
--- a/mysql-test/t/ctype_collate.test
+++ b/mysql-test/t/ctype_collate.test
@@ -229,3 +229,17 @@ insert into t1 set a=0x6c;
insert into t1 set a=0x4c98;
check table t1 extended;
drop table t1;
+
+#
+# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
+#
+select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
+create table t1
+select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
+show create table t1;
+drop table t1;
+
+select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
+latin5_turkish_ci then 2 else 3 end;
+
+select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test
index f1c2c88ae83..1bbd53e8c06 100644
--- a/mysql-test/t/dirty_close.test
+++ b/mysql-test/t/dirty_close.test
@@ -1,3 +1,7 @@
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
@@ -5,12 +9,19 @@ dirty_close con1;
connection con2;
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1 (n int);
-insert into t1 values (1),(2),(3);
-select * from t1;
-drop table t1;
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection default;
+disconnect con2;
# End of 4.1 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 0247aca82df..1bc98a8acb1 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -123,4 +123,17 @@ execute s1;
DROP TABLE t1,t2;
+
+#
+# Bug #43354: Use key hint can crash server in explain extended query
+#
+
+CREATE TABLE t1 (a INT PRIMARY KEY);
+
+--error ER_KEY_DOES_NOT_EXITS
+EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
+
+DROP TABLE t1;
+
+
# End of 5.0 tests.
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index c977cb65fa0..ee9d1981558 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -1843,6 +1843,28 @@ DROP TABLE t1;
connection master;
DROP TABLE t1;
+--echo #
+--echo # BUG#21360 - mysqldump error on federated tables
+--echo #
+connection slave;
+--echo #Switch to Connection Slave
+CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
+INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
+
+connection master;
+--echo #Switch to Connection Master
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+--echo # Dump table t1 using mysqldump tool
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--exec $MYSQL_DUMP --compact test t1
+DROP TABLE t1;
+
+connection slave;
+--echo #Switch to Connection Slave
+DROP TABLE t1;
+
connection default;
--echo End of 5.0 tests
diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test
index 0c1d2b82df6..74892def63f 100644
--- a/mysql-test/t/flush_block_commit.test
+++ b/mysql-test/t/flush_block_commit.test
@@ -4,74 +4,106 @@
# This is intended to mimick how mysqldump and innobackup work.
# And it requires InnoDB
--- source include/have_innodb.inc
+--source include/have_innodb.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
+--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
+--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,);
+--echo # Switch to connection con1
connection con1;
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1 (a int) engine=innodb;
+CREATE TABLE t1 (a INT) ENGINE=innodb;
# blocks COMMIT ?
-begin;
-insert into t1 values(1);
+BEGIN;
+INSERT INTO t1 VALUES(1);
+--echo # Switch to connection con2
connection con2;
-flush tables with read lock;
-select * from t1;
+FLUSH TABLES WITH READ LOCK;
+SELECT * FROM t1;
+--echo # Switch to connection con1
connection con1;
-send commit; # blocked by con2
+send COMMIT; # blocked by con2
sleep 1;
+--echo # Switch to connection con2
connection con2;
-select * from t1; # verify con1 was blocked and data did not move
-unlock tables;
+SELECT * FROM t1; # verify con1 was blocked and data did not move
+UNLOCK TABLES;
+--echo # Switch to connection con1
connection con1;
reap;
# No deadlock ?
+--echo # Switch to connection con1
connection con1;
-begin;
-select * from t1 for update;
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+--echo # Switch to connection con2
connection con2;
-begin;
-send select * from t1 for update; # blocked by con1
+BEGIN;
+send SELECT * FROM t1 FOR UPDATE; # blocked by con1
sleep 1;
+--echo # Switch to connection con3
connection con3;
-send flush tables with read lock; # blocked by con2
+send FLUSH TABLES WITH READ LOCK; # blocked by con2
+--echo # Switch to connection con1
connection con1;
-commit; # should not be blocked by con3
+COMMIT; # should not be blocked by con3
+--echo # Switch to connection con2
connection con2;
reap;
+--echo # Switch to connection con3
connection con3;
reap;
-unlock tables;
+UNLOCK TABLES;
-# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
-# WITH READ LOCK
+# Bug#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
+# WITH READ LOCK
+--echo # Switch to connection con2
connection con2;
-commit; # unlock InnoDB row locks to allow insertions
+COMMIT; # unlock InnoDB row locks to allow insertions
+--echo # Switch to connection con1
connection con1;
-begin;
-insert into t1 values(10);
-flush tables with read lock;
-commit;
-unlock tables;
+BEGIN;
+INSERT INTO t1 VALUES(10);
+FLUSH TABLES WITH READ LOCK;
+COMMIT;
+UNLOCK TABLES;
+--echo # Switch to connection con2
connection con2;
-flush tables with read lock; # bug caused hang here
-unlock tables;
+FLUSH TABLES WITH READ LOCK; # bug caused hang here
+UNLOCK TABLES;
+
+# Bug#7358 SHOW CREATE DATABASE fails if open transaction
+
+BEGIN;
+SELECT * FROM t1;
+SHOW CREATE DATABASE test;
-# BUG#7358 SHOW CREATE DATABASE fails if open transaction
+DROP TABLE t1;
-begin;
-select * from t1;
-show create database test;
-drop table t1;
+# Cleanup
+--echo # Switch to connection default and close connections con1, con2, con3
+connection default;
+disconnect con1;
+disconnect con2;
+disconnect con3;
# End of 4.1 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test
index 4a0300acf78..aea38250218 100644
--- a/mysql-test/t/flush_block_commit_notembedded.test
+++ b/mysql-test/t/flush_block_commit_notembedded.test
@@ -3,32 +3,51 @@
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
--- source include/have_log_bin.inc
+--source include/have_log_bin.inc
# And it requires InnoDB
--- source include/have_log_bin.inc
--- source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/have_innodb.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+
+--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
+--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
+--echo # Switch to connection con1
connection con1;
-create table t1 (a int) engine=innodb;
-reset master;
-set autocommit=0;
-insert t1 values (1);
+CREATE TABLE t1 (a INT) ENGINE=innodb;
+RESET MASTER;
+SET AUTOCOMMIT=0;
+INSERT t1 VALUES (1);
+--echo # Switch to connection con2
connection con2;
-flush tables with read lock;
-show master status;
+FLUSH TABLES WITH READ LOCK;
+SHOW MASTER STATUS;
+--echo # Switch to connection con1
connection con1;
-send commit;
+send COMMIT;
+--echo # Switch to connection con2
connection con2;
sleep 1;
-show master status;
-unlock tables;
+SHOW MASTER STATUS;
+UNLOCK TABLES;
+--echo # Switch to connection con1
connection con1;
reap;
-drop table t1;
-set autocommit=1;
+DROP TABLE t1;
+SET AUTOCOMMIT=1;
+
+--echo # Switch to connection default and close connections con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test
index 19a47b2893a..b767a0758d4 100644
--- a/mysql-test/t/flush_read_lock_kill.test
+++ b/mysql-test/t/flush_read_lock_kill.test
@@ -8,19 +8,27 @@
# won't test anything interesting).
# This also won't work with the embedded server test
--- source include/not_embedded.inc
+--source include/not_embedded.inc
--- source include/have_debug.inc
+--source include/have_debug.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# Disable concurrent inserts to avoid test failures when reading the
+# connection id which was inserted into a table by another thread.
+SET @old_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1 (kill_id int);
-insert into t1 values(connection_id());
+CREATE TABLE t1 (kill_id INT);
+INSERT INTO t1 VALUES(connection_id());
# Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It
@@ -28,14 +36,14 @@ insert into t1 values(connection_id());
# --debug) it will succeed immediately
connection con1;
-send flush tables with read lock;
+send FLUSH TABLES WITH READ LOCK;
# kill con1
connection con2;
-select ((@id := kill_id) - kill_id) from t1;
+SELECT ((@id := kill_id) - kill_id) FROM t1;
--sleep 2 # leave time for FLUSH to block
-kill connection @id;
+KILL CONNECTION @id;
connection con1;
# On debug builds it will be error 1053 (killed); on non-debug, or
@@ -46,4 +54,13 @@ connection con1;
reap;
connection con2;
-drop table t1;
+DROP TABLE t1;
+connection default;
+disconnect con2;
+
+# Restore global concurrent_insert value
+SET @@global.concurrent_insert= @old_concurrent_insert;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 77d84c730d9..76661ba4e63 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -432,3 +432,11 @@ INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
DROP TABLE t1;
+
+#
+# BUG#36737 - having + full text operator crashes mysql
+#
+CREATE TABLE t1(a TEXT);
+--error ER_WRONG_ARGUMENTS
+SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
+DROP TABLE t1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 9f12fdd696e..593cfe90c1b 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -229,5 +229,25 @@ INSERT INTO t1 VALUES ('a');
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
DROP TABLE t1;
+#
+# Bug #15936: "round" differs on Windows to Unix
+#
+
+CREATE TABLE t1 (a DOUBLE);
+
+INSERT INTO t1 VALUES (-1.1), (1.1),
+ (-1.5), (1.5),
+ (-1.9), (1.9),
+ (-2.1), (2.1),
+ (-2.5), (2.5),
+ (-2.9), (2.9),
+# Check numbers with absolute values > 2^53 - 1
+# (see comments for MAX_EXACT_INTEGER)
+ (-1e16 - 0.5), (1e16 + 0.5),
+ (-1e16 - 1.5), (1e16 + 1.5);
+
+SELECT a, ROUND(a) FROM t1;
+
+DROP TABLE t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 8298a50c277..389538c4cc0 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1159,4 +1159,13 @@ select format(a, 2) from t1;
--disable_metadata
drop table t1;
+#
+# Bug #41868: crash or memory overrun with concat + upper, date_format functions
+#
+
+CREATE TABLE t1 (c DATE, aa VARCHAR(30));
+INSERT INTO t1 VALUES ('2008-12-31','aaaaaa');
+SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index cf2e4a21419..cc2ac5b7392 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -355,6 +355,9 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
+# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904
+# due to fused multiply-add instructions.
+--replace_result 36.3310176346904 36.3310176346905
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 14c5879d007..1b2b8465c83 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -3,6 +3,9 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
# Cleanup
--disable_warnings
drop table if exists t1;
@@ -78,7 +81,7 @@ delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
---error 1141
+--error ER_NONEXISTING_GRANT
show grants for mysqltest_1@localhost;
#
@@ -116,15 +119,15 @@ drop table t1;
#
# Test some error conditions
#
---error 1221
+--error ER_WRONG_USAGE
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
-select 1; # To test that the previous command didn't cause problems
+select 1; # To test that the previous command didn't cause problems
#
-# Bug #4898: User privileges depending on ORDER BY Settings of table db
+# Bug#4898 User privileges depending on ORDER BY Settings of table db
#
insert into mysql.user (host, user) values ('localhost', 'test11');
-insert into mysql.db (host, db, user, select_priv) values
+insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
flush privileges;
@@ -136,7 +139,7 @@ delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
#
-# Bug#6123: GRANT USAGE inserts useless Db row
+# Bug#6123 GRANT USAGE inserts useless Db row
#
create database mysqltest1;
grant usage on mysqltest1.* to test6123 identified by 'magic123';
@@ -145,7 +148,7 @@ delete from mysql.user where user='test6123';
drop database mysqltest1;
#
-# Test for 'drop user', 'revoke privileges, grant'
+# Test for 'drop user', 'revoke privileges, grant'
#
create table t1 (a int);
@@ -160,7 +163,7 @@ grant select(a) on test.t1 to drop_user@localhost;
show grants for drop_user@localhost;
#
-# Bug3086
+# Bug#3086 SHOW GRANTS doesn't follow ANSI_QUOTES
#
set sql_mode=ansi_quotes;
show grants for drop_user@localhost;
@@ -178,7 +181,7 @@ show grants for drop_user@localhost;
revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost;
drop user drop_user@localhost;
---error 1269
+--error ER_REVOKE_GRANTS
revoke all privileges, grant option from drop_user@localhost;
grant select(a) on test.t1 to drop_user1@localhost;
@@ -188,10 +191,10 @@ grant select on *.* to drop_user4@localhost;
# Drop user now implicitly revokes all privileges.
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
---error 1269
+--error ER_REVOKE_GRANTS
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
---error 1396
+--error ER_CANNOT_USER
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
drop table t1;
@@ -201,12 +204,12 @@ show grants for mysqltest_1@localhost;
drop user mysqltest_1@localhost;
#
-# Bug #3403 Wrong encodin in SHOW GRANTS output
+# Bug#3403 Wrong encoding in SHOW GRANTS, EXPLAIN SELECT output
#
SET NAMES koi8r;
CREATE DATABASE ÂÄ;
USE ÂÄ;
-CREATE TABLE ÔÁÂ (ËÏÌ int);
+CREATE TABLE ÔÁÂ (ËÏÌ INT);
GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
SHOW GRANTS FOR ÀÚÅÒ@localhost;
@@ -227,7 +230,7 @@ DROP DATABASE ÂÄ;
SET NAMES latin1;
#
-# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
+# Bug#5831 REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
#
USE test;
CREATE TABLE t1 (a int );
@@ -296,7 +299,7 @@ DROP DATABASE testdb9;
DROP DATABASE testdb10;
#
-# Bug #6932: a problem with 'revoke ALL PRIVILEGES'
+# Bug#6932 a problem with 'revoke ALL PRIVILEGES'
#
create table t1(a int, b int, c int, d int);
@@ -310,7 +313,7 @@ drop user grant_user@localhost;
drop table t1;
#
-# Bug#7391: Cross-database multi-table UPDATE security problem
+# Bug#7391 Cross-database multi-table UPDATE security problem
#
create database mysqltest_1;
create database mysqltest_2;
@@ -319,36 +322,36 @@ create table mysqltest_1.t2 select 1 b, 2 r;
create table mysqltest_2.t1 select 1 c, 2 s;
create table mysqltest_2.t2 select 1 d, 2 t;
-#test the column privileges
+# test the column privileges
grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
connect (conn1,localhost,mysqltest_3,,);
connection conn1;
-SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
+ WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
+ WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE;
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
-#the following two should work
+# the following two should work
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
connection master;
@@ -359,7 +362,7 @@ revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
-#test the db/table level privileges
+# test the db/table level privileges
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
# Next grant is needed to trigger bug#7391. Do not optimize!
@@ -371,17 +374,17 @@ connection conn2;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
# the following failed before, should fail now.
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
use mysqltest_2;
-#the following used to succeed, it must fail now.
---error 1142
+# the following used to succeed, it must fail now.
+--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
-#lets see the result
+# lets see the result
connection master;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
@@ -393,6 +396,7 @@ delete from mysql.columns_priv where user="mysqltest_3";
flush privileges;
drop database mysqltest_1;
drop database mysqltest_2;
+disconnect conn2;
#
# just SHOW PRIVILEGES test
@@ -400,7 +404,7 @@ drop database mysqltest_2;
SHOW PRIVILEGES;
#
-# Rights for renaming test (Bug #3270)
+# Rights for renaming test (Bug#3270)
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
@@ -411,16 +415,18 @@ create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
--- error 1142
+-- error ER_TABLEACCESS_DENIED_ERROR
alter table t1 rename t2;
disconnect user1;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
+connection default;
+disconnect root;
#
-# check all new table priveleges
+# check all new table privileges
#
CREATE USER dummy@localhost;
CREATE DATABASE mysqltest;
@@ -485,7 +491,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
DROP USER dummy@localhost;
DROP DATABASE mysqltest;
#
-# Bug #11330: Entry in tables_priv with host = '' causes crash
+# Bug#11330 Entry in tables_priv with host = '' causes crash
#
connection default;
use mysql;
@@ -496,7 +502,7 @@ flush privileges;
use test;
#
-# Bug #10892 user variables not auto cast for comparisons
+# Bug#10892 user variables not auto cast for comparisons
# Check that we don't get illegal mix of collations
#
set @user123="non-existent";
@@ -515,18 +521,18 @@ show grants for root@localhost;
set names latin1;
#
-# Bug #15598 Server crashes in specific case during setting new password
+# Bug#15598 Server crashes in specific case during setting new password
# - Caused by a user with host ''
#
create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass');
show grants for mysqltest_7@;
drop user mysqltest_7@;
---error 1141
+--error ER_NONEXISTING_GRANT
show grants for mysqltest_7@;
#
-# Bug#14385: GRANT and mapping to correct user account problems
+# Bug#14385 GRANT and mapping to correct user account problems
#
create database mysqltest;
use mysqltest;
@@ -542,7 +548,7 @@ flush privileges;
drop database mysqltest;
#
-# Bug #27515: DROP previlege is not required for RENAME TABLE
+# Bug#27515 DROP previlege is not required for RENAME TABLE
#
connection master;
create database db27515;
@@ -553,7 +559,7 @@ grant insert, create on db27515.t2 to user27515@localhost;
connect (conn27515, localhost, user27515, , db27515);
connection conn27515;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
rename table t1 to t2;
disconnect conn27515;
@@ -565,7 +571,7 @@ drop database db27515;
--echo End of 4.1 tests
#
-# Bug #16297 In memory grant tables not flushed when users's hostname is ""
+# Bug#16297 In memory grant tables not flushed when users's hostname is ""
#
use test;
create table t1 (a int);
@@ -582,11 +588,11 @@ create user mysqltest_8;
create user mysqltest_8@host8;
# Try to create them again
---error 1396
+--error ER_CANNOT_USER
create user mysqltest_8@'';
---error 1396
+--error ER_CANNOT_USER
create user mysqltest_8;
---error 1396
+--error ER_CANNOT_USER
create user mysqltest_8@host8;
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
@@ -681,44 +687,43 @@ flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
drop user mysqltest_8@'';
---error 1141
+--error ER_NONEXISTING_GRANT
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%";
drop user mysqltest_8;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1045
+--error ER_ACCESS_DENIED_ERROR
connect (conn6,localhost,mysqltest_8,,);
connection master;
---error 1141
+--error ER_NONEXISTING_GRANT
show grants for mysqltest_8;
drop user mysqltest_8@host8;
---error 1141
+--error ER_NONEXISTING_GRANT
show grants for mysqltest_8@host8;
# Restore the anonymous users.
insert into mysql.user select * from t2;
flush privileges;
drop table t2;
-
drop table t1;
#
-# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
-# privileged view
+# Bug#20214 Incorrect error when user calls SHOW CREATE VIEW on non
+# privileged view
#
connection master;
CREATE DATABASE mysqltest3;
-use mysqltest3;
+USE mysqltest3;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2;
-use mysqltest2;
+USE mysqltest2;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
@@ -740,24 +745,18 @@ SHOW CREATE VIEW mysqltest2.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_nn;
-
-
# fail because of missing SHOW VIEW
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest2.v_yn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_yn;
-
-
# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE TABLE mysqltest2.v_ny;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE VIEW mysqltest2.v_ny;
-
-
# fail because of missing (specific or generic) SELECT
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.t_nn;
@@ -766,16 +765,12 @@ SHOW CREATE TABLE mysqltest3.t_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.t_nn;
-
-
# fail because of missing missing (specific or generic) SELECT (and SHOW VIEW)
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.v_nn;
-
-
# succeed thanks to generic SELECT
SHOW CREATE TABLE mysqltest2.t_nn;
@@ -783,17 +778,13 @@ SHOW CREATE TABLE mysqltest2.t_nn;
--error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn;
-
-
# succeed, have SELECT and SHOW VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
# succeed, have SELECT and SHOW VIEW
SHOW CREATE TABLE mysqltest2.v_yy;
-
-
-#clean-up
+# clean-up
connection master;
# succeed, we're root
@@ -806,38 +797,30 @@ SHOW CREATE TABLE mysqltest2.t_nn;
--error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn;
-
-
DROP VIEW mysqltest2.v_nn;
DROP VIEW mysqltest2.v_yn;
DROP VIEW mysqltest2.v_ny;
DROP VIEW mysqltest2.v_yy;
-
DROP TABLE mysqltest2.t_nn;
-
DROP DATABASE mysqltest2;
-
-
-
DROP VIEW mysqltest3.v_nn;
DROP TABLE mysqltest3.t_nn;
-
DROP DATABASE mysqltest3;
-
+disconnect mysqltest_1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
# restore the original database
-use test;
+USE test;
#
-# Bug #10668: CREATE USER does not enforce username length limit
+# Bug#10668 CREATE USER does not enforce username length limit
#
--error ER_WRONG_STRING_LENGTH
create user mysqltest1_thisisreallytoolong;
#
-# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
+# Test for Bug#16899 Possible buffer overflow in handling of DEFINER-clause.
#
# These checks are intended to ensure that appropriate errors are risen when
# illegal user name or hostname is specified in user-clause of GRANT/REVOKE
@@ -887,7 +870,7 @@ REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
#
-# Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
+# Bug#6774 Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
#
# Check if GRANT ... ON * ... fails when no database is selected
connect (con1, localhost, root,,*NO-ONE*);
@@ -899,7 +882,7 @@ connection default;
#
-# BUG#9504: Stored procedures: execute privilege doesn't make 'use database'
+# Bug#9504 Stored procedures: execute privilege doesn't make 'use database'
# okay.
#
@@ -924,8 +907,8 @@ CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
SELECT 1;
CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
- RETURN 1;
-
+ RETURN 1;
+
CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
RETURN 1;
@@ -981,7 +964,7 @@ DROP USER mysqltest_1@localhost;
#
-# BUG#27337: Privileges are not restored properly.
+# Bug#27337 Privileges are not restored properly.
#
# Actually, the patch for this bugs fixes two problems. So, here are two test
# cases.
@@ -1043,7 +1026,7 @@ DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
-# Test case 2: priveleges are not checked properly for prepared statements.
+# Test case 2: privileges are not checked properly for prepared statements.
# Prepare.
@@ -1116,6 +1099,7 @@ EXECUTE stmt2;
--echo
--echo ---> connection: default
+--disconnect bug27337_con1
--disconnect bug27337_con2
DROP DATABASE mysqltest1;
@@ -1125,21 +1109,21 @@ DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
#
-# Bug#27878: Unchecked privileges on a view referring to a table from another
-# database.
+# Bug#27878 Unchecked privileges on a view referring to a table from another
+# database.
#
-use test;
+USE test;
CREATE TABLE t1 (f1 int, f2 int);
INSERT INTO t1 VALUES(1,1), (2,2);
CREATE DATABASE db27878;
GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
-use db27878;
+USE db27878;
CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
-use db27878;
+USE db27878;
--error 1356
UPDATE v1 SET f2 = 4;
SELECT * FROM test.t1;
@@ -1150,11 +1134,11 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
DROP USER mysqltest_1@localhost;
DROP DATABASE db27878;
-use test;
+USE test;
DROP TABLE t1;
#
-# Bug #33201 Crash occurs when granting update privilege on one column of a view
+# Bug#33201 Crash occurs when granting update privilege on one column of a view
#
drop table if exists test;
drop function if exists test_function;
@@ -1183,3 +1167,7 @@ SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
--echo End of 5.0 tests
+
+disconnect master;
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index 8f83c365170..2393bb1c6d8 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -615,7 +615,7 @@ connection conn1;
USE db1;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT c FROM t2;
---error ER_COLUMNACCESS_DENIED_ERROR
+--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM t2;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT * FROM t1 JOIN t2 USING (b);
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index f7aed7301fb..e124bf9e786 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -935,3 +935,26 @@ insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
select * from t1;
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
drop table t1;
+
+
+#
+# Bug #41610: key_infix_len can be overwritten causing some group by queries
+# to return no rows
+#
+
+CREATE TABLE t1 (a int, b int, c int, d int,
+ KEY foo (c,d,a,b), KEY bar (c,a,b,d));
+
+INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
+
+#Should be non-empty
+--ordered_result
+EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
+SELECT DISTINCT c FROM t1 WHERE d=4;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index caf38945cbc..079f96777bf 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -36,11 +36,11 @@ insert into t5 values (10);
create view v1 (c) as select table_name from information_schema.TABLES;
select * from v1;
-select c,table_name from v1
+select c,table_name from v1
inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
-select c,table_name from v1
+select c,table_name from v1
left join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
@@ -69,7 +69,7 @@ grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
grant select on mysqltest.v1 to mysqltest_3;
connect (user3,localhost,mysqltest_2,,);
connection user3;
-select table_name, column_name, privileges from information_schema.columns
+select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
show columns from mysqltest.t1;
connect (user4,localhost,mysqltest_3,,mysqltest);
@@ -77,6 +77,7 @@ connection user4;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
connection default;
+disconnect user4;
drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
@@ -126,7 +127,7 @@ delimiter ;|
#
# Bug#7222 information_schema: errors in "routines"
#
-select parameter_style, sql_data_access, dtd_identifier
+select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
--replace_column 5 # 6 #
@@ -145,7 +146,7 @@ select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
select count(*) from information_schema.ROUTINES;
-create view v1 as select routine_schema, routine_name from information_schema.routines
+create view v1 as select routine_schema, routine_name from information_schema.routines
order by routine_schema, routine_name;
select * from v1;
drop view v1;
@@ -153,7 +154,7 @@ drop view v1;
connect (user1,localhost,mysqltest_1,,);
connection user1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
show create function sub1;
connection user3;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
@@ -172,6 +173,7 @@ show create function sub2;
show function status like "sub2";
connection default;
disconnect user1;
+disconnect user3;
drop function sub2;
show create procedure sel2;
@@ -311,7 +313,7 @@ drop view v1;
create table t1(a NUMERIC(5,3), b NUMERIC(5,1), c float(5,2),
d NUMERIC(6,4), e float, f DECIMAL(6,3), g int(11), h DOUBLE(10,3),
i DOUBLE);
-select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
+select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
from information_schema.columns where table_name= 't1';
drop table t1;
@@ -324,7 +326,7 @@ drop table t115;
delimiter //;
create procedure p108 () begin declare c cursor for select data_type
from information_schema.columns; open c; open c; end;//
---error 1325
+--error ER_SP_CURSOR_ALREADY_OPEN
call p108()//
delimiter ;//
drop procedure p108;
@@ -334,24 +336,24 @@ where table_name= "user";
select * from v1;
drop view v1;
-create view vo as select 'a' union select 'a';
+create view vo as select 'a' union select 'a';
show index from vo;
select * from information_schema.TABLE_CONSTRAINTS where
TABLE_NAME= "vo";
select * from information_schema.KEY_COLUMN_USAGE where
-TABLE_NAME= "vo";
+TABLE_NAME= "vo";
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
-from information_schema.tables
+from information_schema.tables
where table_schema='information_schema' limit 2;
show tables from information_schema like "T%";
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
create database information_schema;
use information_schema;
show full tables like "T%";
---error 1109
+--error ER_UNKNOWN_TABLE
create table t1(a int);
use test;
show tables;
@@ -359,15 +361,15 @@ use information_schema;
show tables like "T%";
#
-# Bug#7210: information_schema: can't access when table-name = reserved word
+# Bug#7210 information_schema: can't access when table-name = reserved word
#
select table_name from tables where table_name='user';
select column_name, privileges from columns
where table_name='user' and column_name like '%o%';
#
-# Bug#7212: information_schema: "Can't find file" errors if storage engine gone
-# Bug#7211: information_schema: crash if bad view
+# Bug#7212 information_schema: "Can't find file" errors if storage engine gone
+# Bug#7211 information_schema: crash if bad view
#
use test;
create function sub1(i int) returns int
@@ -394,9 +396,9 @@ drop view v3;
drop table t4;
#
-# Bug#7213: information_schema: redundant non-standard TABLE_NAMES table
+# Bug#7213 information_schema: redundant non-standard TABLE_NAMES table
#
---error 1109
+--error ER_UNKNOWN_TABLE
select * from information_schema.table_names;
#
@@ -409,7 +411,7 @@ where table_schema="information_schema" and table_name="COLUMNS" and
#
# Bug#2718 information_schema: errors in "tables"
#
-select TABLE_ROWS from information_schema.tables where
+select TABLE_ROWS from information_schema.tables where
table_schema="information_schema" and table_name="COLUMNS";
select table_type from information_schema.tables
where table_schema="mysql" and table_name="user";
@@ -422,14 +424,14 @@ show status where variable_name like "%database%";
show variables where variable_name like "skip_show_databas";
#
-# Bug #7981:SHOW GLOBAL STATUS crashes server
+# Bug#7981 SHOW GLOBAL STATUS crashes server
#
# We don't actually care about the value, just that it doesn't crash.
--replace_column 2 #
show global status like "Threads_running";
#
-# Bug #7915 crash,JOIN VIEW, subquery,
+# Bug#7915 crash,JOIN VIEW, subquery,
# SELECT .. FROM INFORMATION_SCHEMA.COLUMNS
#
create table t1(f1 int);
@@ -440,7 +442,7 @@ drop view v1;
drop table t1, t2;
#
-# Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
+# Bug#7476 crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
#
CREATE TABLE t_crashme ( f1 BIGINT);
@@ -468,26 +470,26 @@ drop view a2, a1;
drop table t_crashme;
#
-# Bug #7215 information_schema: columns are longtext instead of varchar
-# Bug #7217 information_schema: columns are varbinary() instead of timestamp
+# Bug#7215 information_schema: columns are longtext instead of varchar
+# Bug#7217 information_schema: columns are varbinary() instead of timestamp
#
select table_schema,table_name, column_name from
-information_schema.columns
+information_schema.columns
where data_type = 'longtext';
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
#
-# Bug #8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
+# Bug#8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
#
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
-WHERE NOT EXISTS
+WHERE NOT EXISTS
(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
AND A.TABLE_NAME = B.TABLE_NAME);
#
-# Bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns
+# Bug#9344 INFORMATION_SCHEMA, wrong content, numeric columns
#
create table t1
@@ -505,21 +507,22 @@ WHERE TABLE_NAME= 't1';
drop table t1;
#
-# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
+# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
#
grant select on test.* to mysqltest_4@localhost;
connect (user10261,localhost,mysqltest_4,,);
connection user10261;
-SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
+SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME';
connection default;
+disconnect user10261;
delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4';
flush privileges;
#
-# Bug #9404 information_schema: Weird error messages
+# Bug#9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
@@ -560,7 +563,7 @@ drop table t1;
#
-# Bug #10964 Information Schema:Authorization check on privilege tables is improper
+# Bug#10964 Information Schema:Authorization check on privilege tables is improper
#
create database mysqltest;
@@ -604,12 +607,16 @@ select * from information_schema.user_privileges where grantee like '%user%'
order by grantee;
show grants;
connection default;
+disconnect con1;
+disconnect con2;
+disconnect con3;
+disconnect con4;
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
use test;
drop database mysqltest;
#
-# Bug #11055 information_schema: routines.sql_data_access has wrong value
+# Bug#11055 information_schema: routines.sql_data_access has wrong value
#
--disable_warnings
drop procedure if exists p1;
@@ -624,13 +631,13 @@ drop procedure p1;
drop procedure p2;
#
-# Bug #9434 SHOW CREATE DATABASE information_schema;
+# Bug#9434 SHOW CREATE DATABASE information_schema;
#
show create database information_schema;
#
-# Bug #11057 information_schema: columns table has some questionable contents
-# Bug #12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
+# Bug#11057 information_schema: columns table has some questionable contents
+# Bug#12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
#
create table t1(f1 LONGBLOB, f2 LONGTEXT);
select column_name,data_type,CHARACTER_OCTET_LENGTH,
@@ -646,7 +653,7 @@ where table_name='t1';
drop table t1;
#
-# Bug #12127 triggers do not show in info_schema before they are used if set to the database
+# Bug#12127 triggers do not show in info_schema before they are used if set to the database
#
create table t1 (f1 integer);
create trigger tr1 after insert on t1 for each row set @test_var=42;
@@ -668,8 +675,8 @@ show columns from t1;
drop table t1;
#
-# Bug #12636: SHOW TABLE STATUS with where condition containing a subquery
-# over information schema
+# Bug#12636 SHOW TABLE STATUS with where condition containing a subquery
+# over information schema
#
CREATE TABLE t1 (a int);
@@ -683,7 +690,7 @@ SHOW TABLE STATUS FROM test
DROP TABLE t1,t2;
#
-# Bug #12905 show fields from view behaving erratically with current database
+# Bug#12905 show fields from view behaving erratically with current database
#
create table t1(f1 int);
create view v1 (c) as select f1 from t1;
@@ -691,28 +698,29 @@ connect (con5,localhost,root,,*NO-ONE*);
select database();
show fields from test.v1;
connection default;
+disconnect con5;
drop view v1;
drop table t1;
#
-# Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
+# Bug#9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
#
--error ER_PARSE_ERROR
alter database information_schema;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
drop database information_schema;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
drop table information_schema.tables;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
alter table information_schema.tables;
#
-# Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
+# Bug#9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
#
use information_schema;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
create temporary table schemata(f1 char(10));
#
-# Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
+# Bug#10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
#
delimiter |;
--error ER_BAD_DB_ERROR
@@ -721,13 +729,13 @@ BEGIN
SELECT 'foo' FROM DUAL;
END |
delimiter ;|
-select ROUTINE_NAME from routines;
+select ROUTINE_NAME from routines;
#
-# Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema
+# Bug#10734 Grant of privileges other than 'select' and 'create view' should fail on schema
#
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
grant all on information_schema.* to 'user1'@'localhost';
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
grant select on information_schema.* to 'user1'@'localhost';
#
@@ -753,9 +761,9 @@ where table_name="v1";
drop view v1;
#
-# Bug #14387 SHOW COLUMNS doesn't work on temporary tables
-# Bug #15224 SHOW INDEX from temporary table doesn't work
-# Bug #12770 DESC cannot display the info. about temporary table
+# Bug#14387 SHOW COLUMNS doesn't work on temporary tables
+# Bug#15224 SHOW INDEX from temporary table doesn't work
+# Bug#12770 DESC cannot display the info. about temporary table
#
create temporary table t1(f1 int, index(f1));
show columns from t1;
@@ -839,6 +847,7 @@ connection con16681;
select * from information_schema.views
where table_name='v1' or table_name='v2';
connection default;
+disconnect con16681;
drop view v1, v2;
drop table t1;
drop user mysqltest_1@localhost;
@@ -855,7 +864,7 @@ drop table t1,t2;
#
-# Bug#20230: routine_definition is not null
+# Bug#20230 routine_definition is not null
#
--disable_warnings
DROP PROCEDURE IF EXISTS p1;
@@ -888,7 +897,7 @@ DROP PROCEDURE p1;
DROP USER mysql_bug20230@localhost;
#
-# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
+# Bug#18925 subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
#
SELECT t.table_name, c1.column_name
@@ -921,8 +930,8 @@ SELECT t.table_name, c1.column_name
);
#
-# Bug#21231: query with a simple non-correlated subquery over
-# INFORMARTION_SCHEMA.TABLES
+# Bug#2123 query with a simple non-correlated subquery over
+# INFORMARTION_SCHEMA.TABLES
#
SELECT MAX(table_name) FROM information_schema.tables;
@@ -931,7 +940,7 @@ SELECT table_name from information_schema.tables
FROM information_schema.tables);
#
-# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table"
+# Bug#23037 Bug in field "Default" of query "SHOW COLUMNS FROM table"
#
# Note, MyISAM/InnoDB can't take more that 65532 chars, because the row
# size is limited to 65535 bytes (BLOBs not counted)
@@ -971,11 +980,8 @@ SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=
DROP TABLE bug23037;
DROP FUNCTION get_value;
-
-
-
#
-# Bug#22413: EXPLAIN SELECT FROM view with ORDER BY yield server crash
+# Bug#22413 EXPLAIN SELECT FROM view with ORDER BY yield server crash
#
create view v1 as
select table_schema as object_schema,
@@ -1001,7 +1007,7 @@ drop table t1,t2;
#
-# Bug#24630 Subselect query crashes mysqld
+# Bug#24630 Subselect query crashes mysqld
#
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
(select cast(table_name as char) from information_schema.tables
@@ -1028,8 +1034,8 @@ group by t.table_name order by num1, t.table_name;
#
create table t1(f1 int);
create view v1 as select f1+1 as a from t1;
-create table t2 (f1 int, f2 int);
-create view v2 as select f1+1 as a, f2 as b from t2;
+create table t2 (f1 int, f2 int);
+create view v2 as select f1+1 as a, f2 as b from t2;
select table_name, is_updatable from information_schema.views;
#
# Note: we can perform 'delete' for non updatable view.
@@ -1039,7 +1045,7 @@ drop view v1,v2;
drop table t1,t2;
#
-# Bug#25859 ALTER DATABASE works w/o parameters
+# Bug#25859 ALTER DATABASE works w/o parameters
#
--error ER_PARSE_ERROR
alter database;
@@ -1068,6 +1074,7 @@ show triggers;
select trigger_name from information_schema.triggers
where event_object_table='t1';
connection default;
+disconnect con27629;
drop user mysqltest_1@localhost;
drop database mysqltest;
@@ -1111,13 +1118,13 @@ select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL;
#
# Bug#30079 A check for "hidden" I_S tables is flawed
#
---error 1109
+--error ER_UNKNOWN_TABLE
show fields from information_schema.table_names;
---error 1109
+--error ER_UNKNOWN_TABLE
show keys from information_schema.table_names;
#
-# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
+# Bug#34529 Crash on complex Falcon I_S select after ALTER .. PARTITION BY
#
USE information_schema;
SET max_heap_table_size = 16384;
@@ -1126,9 +1133,9 @@ CREATE TABLE test.t1( a INT );
# What we need to create here is a bit of a corner case:
# We need a star query with information_schema tables, where the first
-# branch of the star join produces zero rows, so that reading of the
+# branch of the star join produces zero rows, so that reading of the
# second branch never happens. At the same time we have to make sure
-# that data for at least the last table is swapped from MEMORY/HEAP to
+# that data for at least the last table is swapped from MEMORY/HEAP to
# MyISAM. This and only this triggers the bug.
SELECT *
FROM tables ta
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
index 0a08559279c..b6bac5f65fa 100644
--- a/mysql-test/t/init_connect.test
+++ b/mysql-test/t/init_connect.test
@@ -5,6 +5,9 @@
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--source include/add_anonymous_users.inc
connect (con0,localhost,root,,);
@@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection con1;
select * from t1;
-connection con0;
+connection default;
+disconnect con0;
disconnect con1;
drop trigger trg1;
@@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1, t2;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/innodb_bug42419.test b/mysql-test/t/innodb_bug42419.test
new file mode 100644
index 00000000000..389093a8465
--- /dev/null
+++ b/mysql-test/t/innodb_bug42419.test
@@ -0,0 +1,77 @@
+#
+# Testcase for InnoDB
+# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections
+#
+
+--source include/have_innodb.inc
+
+let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
+if (`SELECT $innodb_lock_wait_timeout < 10`)
+{
+ --echo # innodb_lock_wait_timeout must be >= 10 seconds
+ --echo # so that this test can work all time fine on an overloaded testing box
+ SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';
+ exit;
+}
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# First session
+connection default;
+
+
+--enable_warnings
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
+
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+COMMIT;
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t1_tmp ( b INT );
+
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
+
+# Second session
+connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK);
+
+SET AUTOCOMMIT = 0;
+
+CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
+INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
+
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
+send
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
+
+# The last update will wait for a lock held by the first session
+
+# First session
+connection default;
+
+# Poll till the UPDATE of the second session waits for lock
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Updating';
+--source include/wait_show_condition.inc
+
+# If the testing box is overloadeded and innodb_lock_wait_timeout is too small
+# we might get here ER_LOCK_WAIT_TIMEOUT.
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
+
+# Second session
+connection user2;
+--echo Reap the server message for connection user2 UPDATE t1 ...
+reap;
+
+# The server crashed when executing this UPDATE or the succeeding SQL command.
+UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
+
+connection default;
+disconnect user2;
+DROP TABLE t1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index 089a60edb3d..e3a577127fa 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -1,4 +1,8 @@
-- source include/not_embedded.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@@ -14,12 +18,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
connection writer;
-send update low_priority t1 set n = 4;
+send
+update low_priority t1 set n = 4;
connection reader;
---sleep 2
-send select n from t1;
+# Sleep a bit till the update of connection writer is in work and hangs
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Locked';
+--source include/wait_show_condition.inc
+send
+select n from t1;
connection locker;
---sleep 2
+# Sleep a bit till the select of connection reader is in work and hangs
+# Here we cannot use include/wait_show_condition.inc because this routine
+# cannot count the number of 'Locked' sessions or access two columns within
+# the same query_get_value call.
+--sleep 3
unlock tables;
connection writer;
reap;
@@ -32,12 +47,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
connection writer;
-send update low_priority t1 set n = 4;
+send
+update low_priority t1 set n = 4;
connection reader;
---sleep 2
-send select n from t1;
+# Sleep a bit till the update of connection writer is in work and hangs
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Locked';
+--source include/wait_show_condition.inc
+#
+send
+select n from t1;
connection locker;
---sleep 2
+# Sleep a bit till the select of connection reader is in work and hangs
+# Here we cannot use include/wait_show_condition.inc.
+--sleep 3
+#
unlock tables;
connection writer;
reap;
@@ -58,10 +84,15 @@ insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
connection writer;
---sleep 2
-send update t1,t2 set c=a where b=d;
+# mleich: IMHO the "send is not necessary because the update should not block.
+# But it will save some runtime in case we block because of an error.
+send
+update t1,t2 set c=a where b=d;
connection reader;
---sleep 2
+# Sleep a bit till the update of connection writer is finished
+# Here we cannot use include/wait_show_condition.inc.
+--sleep 3
+#
select c from t2;
connection writer;
reap;
@@ -70,7 +101,7 @@ drop table t1;
drop table t2;
#
-# Test problem when using locks on many tables and droping a table that
+# Test problem when using locks on many tables and dropping a table that
# is to-be-locked by another thread
#
@@ -79,11 +110,18 @@ create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
connection reader;
-send insert t1 select * from t2;
+send
+insert t1 select * from t2;
connection locker;
+# Sleep a bit till the insert of connection reader is in work and hangs
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Locked';
+--source include/wait_show_condition.inc
drop table t2;
connection reader;
---error 1146
+--error ER_NO_SUCH_TABLE
reap;
connection locker;
drop table t1;
@@ -91,7 +129,7 @@ drop table t1;
# End of 4.1 tests
#
-# BUG#9998 - MySQL client hangs on USE "database"
+# Bug#9998 MySQL client hangs on USE "database"
#
create table t1(a int);
lock tables t1 write;
@@ -102,7 +140,7 @@ unlock tables;
drop table t1;
#
-# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
+# Bug#19815 CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@@ -114,12 +152,18 @@ FLUSH TABLES WITH READ LOCK;
# With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock().
connection con2;
-send DROP DATABASE mysqltest_1;
---sleep 1
+send
+DROP DATABASE mysqltest_1;
#
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
connection con1;
+# Wait a bit so that the session con2 is in state "Waiting for release of readlock"
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Waiting for release of readlock';
+--source include/wait_show_condition.inc
--error ER_CANT_UPDATE_WITH_READLOCK
DROP DATABASE mysqltest_1;
UNLOCK TABLES;
@@ -135,26 +179,33 @@ disconnect con2;
--error ER_DB_DROP_EXISTS
DROP DATABASE mysqltest_1;
+
#
-# Bug#16986 - Deadlock condition with MyISAM tables
+# Bug#16986 Deadlock condition with MyISAM tables
#
# Need a matching user in mysql.user for multi-table select
--source include/add_anonymous_users.inc
connection locker;
-use mysql;
+USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
--sleep 1
#
connection reader;
-use mysql;
-#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
-send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
---sleep 1
+USE mysql;
+# Note: This must be a multi-table select, otherwise the deadlock will not occur
+send
+SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
#
connection locker;
+# Sleep a bit till the select of connection reader is in work and hangs
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Locked';
+--source include/wait_show_condition.inc
# Make test case independent from earlier grants.
--replace_result "Table is already up to date" "OK"
OPTIMIZE TABLES columns_priv, db, host, user;
@@ -162,7 +213,7 @@ UNLOCK TABLES;
#
connection reader;
reap;
-use test;
+USE test;
#
connection locker;
use test;
@@ -177,11 +228,17 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
-send FLUSH TABLES WITH READ LOCK;
---sleep 1
+send
+FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
+# Sleep a bit till the flush of connection locker is in work and hangs
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Flushing tables';
+--source include/wait_show_condition.inc
CREATE TABLE t2 (c1 int);
UNLOCK TABLES;
#
@@ -201,12 +258,18 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
-send FLUSH TABLES WITH READ LOCK;
---sleep 1
+send
+FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
---error 1100
+# Sleep a bit till the flush of connection locker is in work and hangs
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Flushing tables';
+--source include/wait_show_condition.inc
+--error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1;
UNLOCK TABLES;
#
@@ -220,8 +283,9 @@ DROP TABLE t1;
--source include/delete_anonymous_users.inc
+
#
-# Bug #17264: MySQL Server freeze
+# Bug#17264 MySQL Server freeze
#
connection locker;
# Disable warnings to allow test to run also without InnoDB
@@ -230,17 +294,29 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
--enable_warnings
lock tables t1 write;
connection writer;
---sleep 2
+# mleich: I have doubts if the next sleep is really necessary
+# Therefore I set it to comment but don't remove it
+# in case it hat to be enabled again.
+# --sleep 2
delimiter //;
-send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+send
+alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection reader;
---sleep 2
+# Wait till connection writer is blocked
+let $wait_timeout= 5;
+let $show_statement= SHOW PROCESSLIST;
+let $field= State;
+let $condition= = 'Locked';
+--source include/wait_show_condition.inc
delimiter //;
-send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
+send
+alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection locker;
---sleep 2
+# Wait till connection reader is blocked
+# Here we cannot use include/wait_show_condition.inc.
+--sleep 3
unlock tables;
connection writer;
reap;
@@ -263,7 +339,7 @@ lock tables t1 read;
--echo connection: writer
connection writer;
let $ID= `select connection_id()`;
---send create table t2 like t1;
+send create table t2 like t1;
--echo connection: default
connection default;
let $show_type= open tables where in_use=2 and name_locked=1;
@@ -282,8 +358,8 @@ connection default;
drop table t1;
#
-# Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
-# ``FLUSH TABLES WITH READ LOCK''
+# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
+# ``FLUSH TABLES WITH READ LOCK''
#
--connection default
@@ -354,7 +430,7 @@ while ($i) {
dec $i;
--connection locker
---error 0,1060
+--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@@ -362,11 +438,11 @@ while ($i) {
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker
---error 0,1091
+--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
---error 0,1054
+--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
@@ -379,7 +455,7 @@ while ($i) {
dec $i;
--connection locker
---error 0,1060
+--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@@ -388,11 +464,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
---error 0,1091
+--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
---error 0,1054
+--error 0,ER_BAD_FIELD_ERROR
--reap
}
@@ -400,8 +476,9 @@ while ($i) {
--connection default
DROP TABLE t1, t2, t3;
+
#
-# Bug#38499: flush tables and multitable table update with derived table cause
+# Bug#38499: flush tables and multitable table update with derived table cause
# crash
#
@@ -460,7 +537,7 @@ while ($i) {
dec $i;
--connection locker
---error 0,1060
+--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@@ -468,11 +545,11 @@ while ($i) {
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
---error 0,1091
+--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
---error 0,1054 # unknown column error
+--error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap
}
--enable_query_log
@@ -485,7 +562,7 @@ while ($i) {
dec $i;
--connection locker
---error 0,1060
+--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@@ -494,11 +571,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
---error 0,1091
+--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
---error 0,1054 # Unknown column 'a' in 'field list'
+--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@@ -557,7 +634,7 @@ while ($i) {
dec $i;
--connection locker
---error 0,1060
+--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@@ -565,11 +642,11 @@ while ($i) {
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
---error 0,1091
+--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
---error 0,1054 # Unknown column 'a' in 'field list'
+--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@@ -582,7 +659,7 @@ while ($i) {
dec $i;
--connection locker
---error 0,1060
+--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@@ -591,15 +668,25 @@ while ($i) {
--send EXECUTE stmt
--connection locker
---error 0,1091
+--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
---error 0,1054 # Unknown column 'a' in 'field list'
+--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
DROP TABLE t1;
+
+# Close connections used in many subtests
+--disconnect reader
+--disconnect locker
+--disconnect writer
+
# End of 5.0 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/lowercase_utf8-master.opt b/mysql-test/t/lowercase_utf8-master.opt
new file mode 100644
index 00000000000..1b70aa33023
--- /dev/null
+++ b/mysql-test/t/lowercase_utf8-master.opt
@@ -0,0 +1,4 @@
+--lower-case-table-names=1 --character-set-server=utf8
+
+
+
diff --git a/mysql-test/t/lowercase_utf8.test b/mysql-test/t/lowercase_utf8.test
new file mode 100644
index 00000000000..a0d847d5b9f
--- /dev/null
+++ b/mysql-test/t/lowercase_utf8.test
@@ -0,0 +1,9 @@
+#
+# Bug#25830 SHOW TABLE STATUS behaves differently depending on table name
+#
+set names utf8;
+create table `Ð` (id int);
+show tables from test like 'Ð';
+show tables from test like 'а';
+drop table `Ð`;
+
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 2bb3b17340c..9f493189e6d 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -24,17 +24,17 @@ let $1 = 100;
while ($1)
{
let $2 = 5;
- eval insert into t1(t) values ('$1');
+ eval insert into t1(t) values ('$1');
while ($2)
{
- eval insert into t2(id2,t) values ($1,'$2');
+ eval insert into t2(id2,t) values ($1,'$2');
let $3 = 10;
while ($3)
{
- eval insert into t3(id3,t) values ($1,'$2');
+ eval insert into t3(id3,t) values ($1,'$2');
dec $3;
}
- dec $2;
+ dec $2;
}
dec $1;
}
@@ -79,11 +79,11 @@ let $1 = 1000;
while ($1)
{
let $2 = 5;
- eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa');
+ eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa');
while ($2)
{
- eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
- dec $2;
+ eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
+ dec $2;
}
dec $1;
}
@@ -317,7 +317,7 @@ update t2, t1 set t2.field=t1.field
delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2
where 0=1;
-delete t1, t2 from t2,t1
+delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
@@ -351,7 +351,7 @@ create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(1
insert into t1 values (0,'A01-Comp',1);
insert into t1 values (0,'B01-Comp',1);
insert into t2 values (0,1,'A Note',1);
-update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
+update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
select * from t1;
select * from t2;
drop table t1, t2;
@@ -379,6 +379,9 @@ revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
+connection default;
+disconnect user1;
+disconnect root;
#
# multi delete wrong table check
@@ -393,7 +396,7 @@ drop table t1, t2, t3;
#
# multi* unique updating table check
#
-create table t1 (col1 int);
+create table t1 (col1 int);
create table t2 (col1 int);
-- error ER_UPDATE_TABLE_USED
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
@@ -401,16 +404,16 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
drop table t1,t2;
-# Test for BUG#5837 - delete with outer join and const tables
+# Test for Bug#5837 delete with outer join and const tables
--disable_warnings
create table t1 (
- aclid bigint not null primary key,
- status tinyint(1) not null
+ aclid bigint not null primary key,
+ status tinyint(1) not null
) engine = innodb;
create table t2 (
- refid bigint not null primary key,
- aclid bigint, index idx_acl(aclid)
+ refid bigint not null primary key,
+ aclid bigint, index idx_acl(aclid)
) engine = innodb;
--enable_warnings
insert into t2 values(1,null);
@@ -418,7 +421,7 @@ delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
#
-# Bug#19225: unchecked error leads to server crash
+# Bug#19225 unchecked error leads to server crash
#
create table t1(a int);
create table t2(a int);
@@ -428,7 +431,7 @@ drop table t1, t2;
# End of 4.1 tests
#
-# Test for bug #1980.
+# Test for Bug#1980.
#
--disable_warnings
create table t1 ( c char(8) not null ) engine=innodb;
@@ -484,9 +487,12 @@ send alter table t1 add column c int default 100 after a;
connect (updater,localhost,root,,test);
connection updater;
+# Wait till "alter table t1 ..." is in work.
+sleep 2;
send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
connection locker;
+# Wait till "update t1, v1 ..." is in work.
sleep 2;
unlock tables;
@@ -500,8 +506,14 @@ select * from t2;
drop view v1;
drop table t1, t2;
+connection default;
+disconnect locker;
+disconnect changer;
+disconnect updater;
+
+
#
-# Bug#27716 multi-update did partially and has not binlogged
+# Bug#27716 multi-update did partially and has not binlogged
#
CREATE TABLE `t1` (
@@ -536,11 +548,12 @@ reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be the UPDATE query event */;
-# cleanup bug#27716
+# cleanup
drop table t1, t2;
+
#
-# Bug #29136 erred multi-delete on trans table does not rollback
+# Bug#29136 erred multi-delete on trans table does not rollback
#
# prepare
@@ -569,7 +582,7 @@ select count(*) from t3 /* must be 1 */;
# the query must be in binlog (no surprise though)
source include/show_binlog_events.inc;
-# cleanup bug#29136
+# cleanup
drop table t1, t2, t3;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 68a01a309d4..54b204d3821 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -98,35 +98,43 @@ drop table t1;
# Bug #20432: mysql client interprets commands in comments
#
+--let $file = $MYSQLTEST_VARDIR/tmp/bug20432.sql
+
# if the client sees the 'use' within the comment, we haven't fixed
---exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
+--exec echo "/*" > $file
+--exec echo "use" >> $file
+--exec echo "*/" >> $file
+--exec $MYSQL < $file 2>&1
# SQL can have embedded comments => workie
---exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
+--exec echo "select /*" > $file
+--exec echo "use" >> $file
+--exec echo "*/ 1" >> $file
+--exec $MYSQL < $file 2>&1
# client commands on the other hand must be at BOL => error
---exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
+--exec echo "/*" > $file
+--exec echo "xxx" >> $file
+--exec echo "*/ use" >> $file
--error 1
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
+--exec $MYSQL < $file 2>&1
# client comment recognized, but parameter missing => error
---exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
+--exec echo "use" > $file
+--exec $MYSQL < $file 2>&1
+
+--remove_file $file
#
# Bug #20328: mysql client interprets commands in comments
#
---exec $MYSQL -e "help" > $MYSQLTEST_VARDIR/tmp/bug20328_1.result
---exec $MYSQL -e "help " > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
---diff_files $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result
+--let $file1 = $MYSQLTEST_VARDIR/tmp/bug20328_1.result
+--let $file2 = $MYSQLTEST_VARDIR/tmp/bug20328_2.result
+--exec $MYSQL -e "help" > $file1
+--exec $MYSQL -e "help " > $file2
+--diff_files $file1 $file2
+--remove_file $file1
+--remove_file $file2
#
# Bug #19216: Client crashes on long SELECT
@@ -152,13 +160,15 @@ EOF
#
# Bug #20103: Escaping with backslash does not work
#
---exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
---exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
+--let $file = $MYSQLTEST_VARDIR/tmp/bug20103.sql
+--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $file
+--exec echo "SELECT '\';" >> $file
+--exec $MYSQL < $file 2>&1
---exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
---exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
+--exec echo "SET SQL_MODE = '';" > $file
+--exec echo "SELECT '\';';" >> $file
+--exec $MYSQL < $file 2>&1
+--remove_file $file
#
# Bug#17583: mysql drops connection when stdout is not writable
@@ -314,4 +324,54 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
#
--exec $MYSQL -e "select @z:='1',@z=database()"
+
+#
+# Bug #31060: MySQL CLI parser bug 2
+#
+
+--write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql
+;DELIMITER DELIMITER
+;
+SELECT 1DELIMITER
+DELIMITER ;
+SELECT 1;
+EOF
+
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1
+
+remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
+
+#
+# Bug #41486: extra character appears in BLOB for every ~40Mb after
+# mysqldump/import
+#
+
+# Have to change the global variable as the session variable is
+# read-only.
+set @old_max_allowed_packet = @@global.max_allowed_packet;
+# 2 MB blob length + some space for the rest of INSERT query
+set @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
+
+# Create a new connection since the global max_allowed_packet
+# has no effect for the current connection
+connect (con1, localhost, root,,);
+connection con1;
+
+CREATE TABLE t1(data LONGBLOB);
+INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
+
+--exec $MYSQL_DUMP test t1 >$MYSQLTEST_VARDIR/tmp/bug41486.sql
+# Check that the mysql client does not insert extra newlines when loading
+# strings longer than client's max_allowed_packet
+--exec $MYSQL --max_allowed_packet=1M test < $MYSQLTEST_VARDIR/tmp/bug41486.sql 2>&1
+SELECT LENGTH(data) FROM t1;
+
+remove_file $MYSQLTEST_VARDIR/tmp/bug41486.sql;
+DROP TABLE t1;
+
+connection default;
+disconnect con1;
+
+set @@global.max_allowed_packet = @old_max_allowed_packet;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 5b4a43c8fe8..1ca07a40df1 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -1,5 +1,4 @@
# We are using .opt file since we need small binlog size
-
-- source include/have_log_bin.inc
# we need this for getting fixed timestamps inside of this test
@@ -19,7 +18,7 @@ insert into t2 values ();
# set @a:=1
# insert into t2 values (@a);
-# test for load data and load data distributed among the several
+# test for load data and load data distributed among the several
# files (we need to fill up first binlog)
load data infile '../std_data_ln/words.dat' into table t1;
load data infile '../std_data_ln/words.dat' into table t1;
@@ -104,7 +103,7 @@ select "--- --position --" as "";
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
-# Bug#7853 (mysqlbinlog does not accept input from stdin)
+# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
select "--- reading stdin --" as "";
--enable_query_log
@@ -118,7 +117,7 @@ select "--- reading stdin --" as "";
drop table t1,t2;
#
-#BUG#14157: utf8 encoding in binlog without set character_set_client
+# Bug#14157 utf8 encoding in binlog without set character_set_client
#
flush logs;
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
@@ -131,8 +130,8 @@ EOF
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
-# resulted binlog, parly consisting of multi-byte utf8 chars,
-# must be digestable for both client and server. In 4.1 the client
+# resulted binlog, parly consisting of multi-byte utf8 chars,
+# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
select * from t5 /* must be (1),(1) */;
@@ -158,7 +157,7 @@ select * from t5 order by c1;
drop table t5;
#
-# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
+# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
#
--disable_warnings
drop procedure if exists p1;
@@ -174,7 +173,7 @@ delimiter ;//
flush logs;
call p1();
drop procedure p1;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
@@ -217,40 +216,82 @@ flush logs;
#
# Bug#28293 missed '#' sign in the hex dump when the dump length
-# is divisible by 16.
+# is divisible by 16.
#
CREATE TABLE t1 (c1 CHAR(10));
# we need this for getting fixed timestamps inside of this test
-flush logs;
+FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
-flush logs;
+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'
+
+# We create a table, patch, and load the output into it
+# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
+# We can easily see if a 'Query' line is missing the '#' character
+# as described in the original bug
+
+--disable_query_log
+CREATE TABLE patch (a BLOB);
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
+ INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
+--enable_query_log
+
+--echo We expect this value to be 1
+--echo The bug being tested was that 'Query' lines were not preceded by '#'
+--echo If the line is in the table, it had to have been preceded by a '#'
+--echo
+SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
+DROP TABLE patch;
#
-# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
+# 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;
+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);
+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`;
+let $b= `SELECT a FROM t1`;
disconnect con1;
connection default;
-let $c= `select $a=$b`;
+let $c= `SELECT $a=$b`;
--echo $c
-drop table t1;
+DROP TABLE t1;
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
+remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql;
+
+#
+# Bug#37313 BINLOG Contains Incorrect server id
+#
+
+let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
+let $save_server_id= `SELECT @@global.server_id`;
+let $s_id_max= `SELECT (1 << 32) - 1`;
+eval SET @@global.server_id= $s_id_max;
+
+RESET MASTER;
+FLUSH LOGS;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $binlog_file
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval SELECT
+(@a:=LOAD_FILE("$binlog_file"))
+IS NOT NULL;
+let $s_id_unsigned= `SELECT @a LIKE "%server id $s_id_max%" /* must return 1 */`;
+echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
+
+eval SET @@global.server_id= $save_server_id;
+--remove_file $binlog_file
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqldump-compat.test b/mysql-test/t/mysqldump-compat.test
index 848d66cc728..9a830b16f26 100644
--- a/mysql-test/t/mysqldump-compat.test
+++ b/mysql-test/t/mysqldump-compat.test
@@ -5,9 +5,13 @@
# Bug #30126: semicolon before closing */ in /*!... CREATE DATABASE ;*/
#
+--let $file = $MYSQLTEST_VARDIR/tmp/bug30126.sql
+
CREATE DATABASE mysqldump_30126;
USE mysqldump_30126;
CREATE TABLE t1 (c1 int);
---exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $MYSQLTEST_VARDIR/tmp/bug30126.sql
---exec $MYSQL mysqldump_30126 < $MYSQLTEST_VARDIR/tmp/bug30126.sql
+--exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $file
+--exec $MYSQL mysqldump_30126 < $file
DROP DATABASE mysqldump_30126;
+
+--remove_file $file
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 5cd9c17e2ac..52eecc62931 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1649,6 +1649,38 @@ DROP TABLE t1,t2;
# We reset concurrent_inserts value to whatever it was at the start of the test
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
+--echo #
+--echo # Bug #42635: mysqldump includes views that were excluded using
+--echo # the --ignore-table option
+--echo #
+
+create database db42635;
+use db42635;
+create table t1 (id int);
+create view db42635.v1 (c) as select * from db42635.t1;
+create view db42635.v2 (c) as select * from db42635.t1;
+--exec $MYSQL_DUMP --skip-comments --ignore-table=db42635.v1 db42635
+use test;
+drop database db42635;
+
+
+--echo #
+--echo # Bug#33550 mysqldump 4.0 compatibility broken
+--echo #
+
+SET NAMES utf8;
+CREATE TABLE `straße` ( f1 INT );
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
+DROP TABLE `straße`;
+
+CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
+--error 2
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
+DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`;
+SET NAMES latin1;
+
--echo #
--echo # End of 5.0 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 5856bfff036..0c104a4a6b3 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -6,6 +6,9 @@
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
# ============================================================================
#
# Test of mysqltest itself
@@ -50,7 +53,7 @@ select otto from (select 1 as otto) as t1;
# ----------------------------------------------------------------------------
# Negative case(statement):
-# The derived table t1 does not contain a column named 'friedrich' .
+# The derived table t1 does not contain a column named 'friedrich' .
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
# --> 1054: Unknown column 'friedrich' in 'field list'
# ----------------------------------------------------------------------------
@@ -62,7 +65,8 @@ select otto from (select 1 as otto) as t1;
--exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
# expectation = response
---error 1054
+--error ER_BAD_FIELD_ERROR
+
select friedrich from (select 1 as otto) as t1;
# The following unmasked unsuccessful statement must give
@@ -116,7 +120,7 @@ select friedrich from (select 1 as otto) as t1;
# $mysql_errno is a builtin variable of mysqltest and contains the return code
# of the last command sent to the server.
#
-# The following test cases often initialize $mysql_errno to 1064 by
+# The following test cases often initialize $mysql_errno to 1064 by
# a command with wrong syntax.
# Example: --error 1064 To prevent the abort after the error.
# garbage ;
@@ -131,14 +135,16 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
#----------------------------------------------------------------------------
# check mysql_errno = 1064 after statement with wrong syntax
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ----------------------------------------------------------------------------
# check if let $my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
let $my_var= 'abc' ;
eval select $mysql_errno as "after_let_var_equal_value" ;
@@ -146,7 +152,8 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
# ----------------------------------------------------------------------------
# check if set @my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
set @my_var= 'abc' ;
eval select $mysql_errno as "after_set_var_equal_value" ;
@@ -155,7 +162,8 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
# check if the setting of --disable-warnings itself affects $mysql_errno
# (May be --<whatever> modifies $mysql_errno.)
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
--disable_warnings
eval select $mysql_errno as "after_disable_warnings_command" ;
@@ -166,7 +174,8 @@ eval select $mysql_errno as "after_disable_warnings_command" ;
# (May be disabled warnings affect $mysql_errno.)
# ----------------------------------------------------------------------------
drop table if exists t1 ;
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
drop table if exists t1 ;
eval select $mysql_errno as "after_disable_warnings" ;
@@ -175,21 +184,26 @@ eval select $mysql_errno as "after_disable_warnings" ;
# ----------------------------------------------------------------------------
# check if masked errors affect $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
eval select $mysql_errno as "after_minus_masked" ;
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
eval select $mysql_errno as "after_!_masked" ;
# ----------------------------------------------------------------------------
# Will manipulations of $mysql_errno be possible and visible ?
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
let $mysql_errno= -1;
eval select $mysql_errno as "after_let_errno_equal_value" ;
@@ -198,50 +212,61 @@ eval select $mysql_errno as "after_let_errno_equal_value" ;
# How affect actions on prepared statements $mysql_errno ?
# ----------------------------------------------------------------------------
# failing prepare
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10));
# successful prepare
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_successful_prepare" ;
# successful execute
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
execute stmt;
eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped)
drop table t1;
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
execute stmt;
eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement)
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
+
execute __stmt_;
eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
deallocate prepare stmt;
eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist )
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
+
deallocate prepare __stmt_;
eval select $mysql_errno as "after_failing_deallocate" ;
@@ -266,7 +291,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# ----------------------------------------------------------------------------
# Switch off the abort on error and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
--disable_abort_on_error
eval select $mysql_errno as "after_--disable_abort_on_error" ;
@@ -280,9 +306,11 @@ select 3 from t1 ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response
@@ -296,7 +324,8 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
---error 1064
+--error ER_PARSE_ERROR
+
garbage ;
--enable_abort_on_error
eval select $mysql_errno as "after_--enable_abort_on_error" ;
@@ -305,7 +334,8 @@ eval select $mysql_errno as "after_--enable_abort_on_error" ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
---error 1146
+--error ER_NO_SUCH_TABLE
+
select 3 from t1 ;
# ----------------------------------------------------------------------------
@@ -454,7 +484,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Allow trailing # comment
--sleep 1 # Wait for insert delayed to be executed.
---sleep 1 # Wait for insert delayed to be executed.
+--sleep 1 # Wait for insert delayed to be executed.
# ----------------------------------------------------------------------------
# Test error
@@ -569,9 +599,6 @@ echo ;
# Illegal use of exec
--error 1
---exec echo "--exec false" | $MYSQL_TEST 2>&1
-
---error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
@@ -951,8 +978,6 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn 2> /dev/null;
@@ -1360,7 +1385,7 @@ connection default;
# ----------------------------------------------------------------------------
-# TODO Test queries, especially their errormessages... so it's easy to debug
+# TODO Test queries, especially their errormessages... so it's easy to debug
# new scripts and diagnose errors
# ----------------------------------------------------------------------------
@@ -1370,7 +1395,8 @@ connection default;
let $num= 2;
while ($num)
{
- --error 1064
+ --error ER_PARSE_ERROR
+
failing_statement;
dec $num;
@@ -1401,7 +1427,7 @@ let $message= `SELECT USER()`;
# The message contains more then 80 characters on multiple lines
# and is kept between double quotes.
-let $message=
+let $message=
"Here comes a very very long message that
- is longer then 80 characters and
- consists of several lines";
@@ -1429,14 +1455,14 @@ select "this will be executed";
#
# Test zero length result file. Should not pass
#
---exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
+--exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
--error 0,1
-remove_file $MYSQLTEST_VARDIR/log/zero_length_file.reject;
+remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject;
--error 0,1
remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject;
@@ -1482,7 +1508,8 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent
---exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+--error 1
+--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
@@ -1503,26 +1530,29 @@ drop table t1;
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should exist
---exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
+--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
#
-# Bug#19890 mysqltest: "query" command is broken
+# Bug#19890 mysqltest: "query" command is broken
#
# It should be possible to use the command "query" to force mysqltest to
# send the command to the server although it's a builtin mysqltest command.
---error 1064
+--error ER_PARSE_ERROR
+
query sleep;
---error 1064
+--error ER_PARSE_ERROR
+
--query sleep
# Just an empty query command
---error 1065
+--error ER_EMPTY_QUERY
+
query ;
# test for replace_regex
@@ -1533,7 +1563,7 @@ select "at" as col1, "c" as col2;
select "at" as col1, "AT" as col2, "c" as col3;
--replace_regex /a/b/ /ct/d/
-select "a" as col1, "ct" as col2;
+select "a" as col1, "ct" as col2;
--replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/;
select "strawberry","blueberry","potato";
@@ -1551,7 +1581,7 @@ select "strawberry","blueberry","potato";
--error 1
--exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
--error 1
---exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
+--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
# REQUIREMENT
# replace_regex should replace substitutions from left to right in output
@@ -1915,12 +1945,13 @@ eval $my_stmt;
# 8. Ensure that "sorted_result " does not change the semantics of
# "--error ...." or the protocol output after such an expected failure
--sorted_result
---error 1146
+--error ER_NO_SUCH_TABLE
+
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
-# 9. Ensure that several result formatting options including "sorted_result"
+# 9. Ensure that several result formatting options including "sorted_result"
# - have all an effect
# - "--sorted_result" does not need to be direct before the statement
# - Row sorting is applied after modification of the column content
@@ -2126,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index dc450aeb9cf..73c04ad6764 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -1,6 +1,12 @@
-- source include/have_ndb.inc
-- source include/not_embedded.inc
+# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
+# to 'grep' calls
+# Test is currently disabled on Windows via the next line until this bug
+# can be resolved.
+--source include/not_windows.inc
+
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings
diff --git a/mysql-test/t/overflow.test b/mysql-test/t/overflow.test
index a62ef9c4cd2..774c43be658 100644
--- a/mysql-test/t/overflow.test
+++ b/mysql-test/t/overflow.test
@@ -1,6 +1,14 @@
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (con1,localhost,root,,);
connection con1;
--- error 1064,1102,1280
+--error ER_PARSE_ERROR,ER_WRONG_DB_NAME,ER_WRONG_NAME_FOR_INDEX
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
+connection default;
+disconnect con1;
# End of 4.1 tests
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test
index 4de284b7824..6210e9986ad 100644
--- a/mysql-test/t/packet.test
+++ b/mysql-test/t/packet.test
@@ -4,12 +4,18 @@
# swallowing them and returning an error
--source include/not_windows.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+
#
# Check protocol handling
#
-connect (con1,localhost,root,,);
+set @max_allowed_packet=@@global.max_allowed_packet;
+set @net_buffer_length=@@global.net_buffer_length;
+connect (con1,localhost,root,,);
connection con1;
set global max_allowed_packet=100;
set max_allowed_packet=100;
@@ -19,6 +25,8 @@ set net_buffer_length=100;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
# Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000);
+connection default;
+disconnect con1;
#
# Connection 2 should get error for too big packets
@@ -26,7 +34,7 @@ select repeat('a',2000);
connect (con2,localhost,root,,);
connection con2;
select @@net_buffer_length, @@max_allowed_packet;
---error 1153
+--error ER_NET_PACKET_TOO_LARGE
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
set global max_allowed_packet=default;
set max_allowed_packet=default;
@@ -34,5 +42,13 @@ set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000));
+connection default;
+disconnect con2;
+
+set global max_allowed_packet=@max_allowed_packet;
+set global net_buffer_length=@net_buffer_length;
# End of 4.1 tests
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 6c3f98f6a1a..d9e593fd76f 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -228,6 +228,10 @@ drop table t1;
# statements or are correctly created and deleted on each execute
#
+--let $outfile=$MYSQLTEST_VARDIR/tmp/f1.txt
+--error 0,1
+--remove_file $outfile
+
prepare stmt1 from "select 1 into @var";
execute stmt1;
execute stmt1;
@@ -238,11 +242,14 @@ execute stmt1;
prepare stmt1 from "insert into t1 select i from t1";
execute stmt1;
execute stmt1;
-prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval prepare stmt1 from "select * from t1 into outfile '$outfile'";
execute stmt1;
deallocate prepare stmt1;
drop table t1;
+--remove_file $outfile
+
#
# BUG#5242 "Prepared statement names are case sensitive"
#
diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test
index 421ec913e5d..112856117ce 100644
--- a/mysql-test/t/query_cache_notembedded.test
+++ b/mysql-test/t/query_cache_notembedded.test
@@ -1,6 +1,10 @@
-- source include/have_query_cache.inc
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+
#
# Tests with query cache
#
@@ -79,7 +83,7 @@ show status like "Qcache_free_blocks";
drop table t1, t2, t3, t11, t21;
#
-# do not use QC if tables locked (BUG#12385)
+# do not use QC if tables locked (Bug#12385)
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
@@ -96,10 +100,13 @@ SELECT * FROM t1;
connection root;
SELECT * FROM t1;
drop table t1;
+connection default;
+disconnect root;
+disconnect root2;
#
-# query in QC from normal execution and SP (BUG#6897)
-# improved to also test BUG#3583 and BUG#12990
+# query in QC from normal execution and SP (Bug#6897)
+# improved to also test Bug#3583 and Bug#12990
#
flush query cache;
reset query cache;
@@ -181,7 +188,7 @@ drop procedure f4;
drop table t1;
#
-# bug#14767: INSERT in SF + concurrent SELECT with query cache
+# Bug#14767 INSERT in SF + concurrent SELECT with query cache
#
reset query cache;
--disable_warnings
@@ -224,3 +231,6 @@ connection default;
set GLOBAL query_cache_size=0;
# End of 5.0 tests
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test
index cca9bbd6fde..fdb68b28fdf 100644
--- a/mysql-test/t/read_only.test
+++ b/mysql-test/t/read_only.test
@@ -4,6 +4,9 @@
# should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
@@ -40,24 +43,24 @@ connection con1;
select @@global.read_only;
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
create table t3 (a int);
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
# if a statement, after parse stage, looks like it will update a
# non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
update t1 set a=1 where 1=0;
# multi-update is special (see sql_parse.cc) so we test it
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
# check multi-delete to be sure
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
delete t1,t2 from t1,t2 where t1.a=t2.a;
# With temp tables updates should be accepted:
@@ -71,7 +74,7 @@ insert into t3 values(1);
insert into t4 select * from t3;
# a non-temp table updated:
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
# no non-temp table updated (just swapped):
@@ -79,7 +82,7 @@ update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
delete t1 from t1,t3 where t1.a=t3.a;
delete t3 from t1,t3 where t1.a=t3.a;
@@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1;
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
#
-# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
+# Bug#22077 DROP TEMPORARY TABLE fails with wrong error if read_only is set
#
# check if DROP TEMPORARY on a non-existing temporary table returns the right
# error
@@ -114,11 +117,12 @@ drop temporary table ttt;
drop temporary table if exists ttt;
connection default;
+disconnect con1;
drop table t1,t2;
drop user test@localhost;
--echo #
---echo # Bug #27440 read_only allows create and drop database
+--echo # Bug#27440 read_only allows create and drop database
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
@@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
drop database mysqltest_db1;
set global read_only=0;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 1601f7afd0e..fcc4259168b 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -237,3 +237,21 @@ SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
DROP TABLE t1;
+
+#
+# Bug#37601 Cast Is Not Done On Row Comparison
+#
+create table t1 (a varchar(200),
+ b int unsigned not null primary key auto_increment)
+default character set 'utf8';
+
+create table t2 (c varchar(200),
+ d int unsigned not null primary key auto_increment)
+default character set 'latin1';
+
+insert into t1 (a) values('abc');
+insert into t2 (c) values('abc');
+select * from t1,t2 where (a,b) = (c,d);
+
+select host,user from mysql.user where (host,user) = ('localhost','test');
+drop table t1,t2;
diff --git a/mysql-test/t/rpl_filter_tables_not_exist-slave.opt b/mysql-test/t/rpl_filter_tables_not_exist-slave.opt
new file mode 100644
index 00000000000..42acd3ea33d
--- /dev/null
+++ b/mysql-test/t/rpl_filter_tables_not_exist-slave.opt
@@ -0,0 +1 @@
+--replicate-do-table=test.t1 --replicate-do-table=test.t2 --replicate-do-table=test.t3 --replicate-ignore-table=test.t4 --replicate-ignore-table=test.t5 --replicate-ignore-table=test.t6
diff --git a/mysql-test/t/rpl_filter_tables_not_exist.test b/mysql-test/t/rpl_filter_tables_not_exist.test
new file mode 100644
index 00000000000..d1153e584c8
--- /dev/null
+++ b/mysql-test/t/rpl_filter_tables_not_exist.test
@@ -0,0 +1,206 @@
+# Test evaluation of replication table filter rules
+#
+# ==== Purpose ====
+#
+# Test if replication table filter rules are properly evaluated when
+# some of the tables referenced by the multiple-table update do not
+# exist on slave.
+#
+# ==== Method ====
+#
+# Master creates tables t1, t2, t3, t4, t5, t6, t7, t8, t9 and the
+# slave is started with the following replication table filter rules:
+#
+# --replicate-do-table=t1
+# --replicate-do-table=t2
+# --replicate-do-table=t3
+#
+# and
+#
+# --replicate-ignore-table=t4
+# --replicate-ignore-table=t5
+# --replicate-ignore-table=t6
+#
+# So the slave only replicate changes to tables t1, t2 and t3 and only
+# these tables exist on slave.
+#
+# From now on, tables t1, t2, and t3 are referenced as do tables,
+# tables t4, t5, t6 are referenced as ignore tables, and tables t7,
+# t8, t9 are referenced as other tables.
+#
+# All multi-table update tests reference tables that are not do
+# tables, which do not exist on slave. And the following situations
+# of multi-table update will be tested:
+#
+# 1. Do tables are not referenced at all
+# 2. Do tables are not referenced for update
+# 3. Ignore tables are referenced for update before do tables
+# 4. Only do tables are referenced for update
+# 5. Do tables and other tables are referenced for update
+# 6. Do tables are referenced for update before ignore tables
+#
+# For 1, 2 and 3, the statement should be ignored by slave, for 4, 5
+# and 6 the statement should be accepted by slave and cause an error
+# because of non-exist tables.
+#
+# ==== Related bugs ====
+#
+# BUG#37051 Replication rules not evaluated correctly
+
+
+source include/master-slave.inc;
+
+# These tables are mentioned in do-table rules
+CREATE TABLE t1 (id int, a int);
+CREATE TABLE t2 (id int, b int);
+CREATE TABLE t3 (id int, c int);
+
+# These tables are mentioned in ignore-table rules
+CREATE TABLE t4 (id int, d int);
+CREATE TABLE t5 (id int, e int);
+CREATE TABLE t6 (id int, f int);
+
+# These tables are not mentioned in do-table or ignore-table rules
+CREATE TABLE t7 (id int, g int);
+CREATE TABLE t8 (id int, h int);
+CREATE TABLE t9 (id int, i int);
+
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t3 VALUES (1, 1), (2, 2), (3, 3);
+
+INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t5 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t6 VALUES (1, 1), (2, 2), (3, 3);
+
+INSERT INTO t7 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t8 VALUES (1, 1), (2, 2), (3, 3);
+INSERT INTO t9 VALUES (1, 1), (2, 2), (3, 3);
+
+# Only t1, t2, t3 should be replicated to slave
+sync_slave_with_master;
+echo [on slave];
+SHOW TABLES LIKE 't%';
+
+connection master;
+echo [on master];
+
+#
+# Do tables are not referenced, these statements should be ignored by
+# slave.
+#
+UPDATE t7 LEFT JOIN t4 ON (t4.id=t7.id) SET d=0, g=0 where t7.id=1;
+UPDATE t7 LEFT JOIN (t4, t5, t6) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t6.id) SET d=0, e=0, f=0, g=0 where t7.id=1;
+UPDATE t4 LEFT JOIN (t7, t8, t9) ON (t4.id=t7.id and t4.id=t8.id and t4.id=t9.id) SET d=0, g=0, h=0, i=0 where t4.id=1;
+UPDATE t7 LEFT JOIN (t8, t9) ON (t7.id=t8.id and t7.id=t9.id) SET g=0, h=0, i=0 where t7.id=1;
+
+#
+# Do tables are not referenced for update, these statements should be
+# ignored by slave.
+#
+UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET d=0 where t1.id=1;
+UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET g=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET d=0, e=0, f=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t4, t5, t8) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t8.id) SET d=0, e=0, h=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t7, t8, t5) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t5.id) SET g=0, h=0, e=0 where t1.id=1;
+UPDATE t1 LEFT JOIN (t2, t3, t5) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t5.id) SET e=0 where t1.id=1;
+
+#
+# Ignore tables are referenced for update before do tables, these
+# statements should be ignore by slave.
+#
+UPDATE t4 LEFT JOIN t1 ON (t1.id=t4.id) SET a=0, d=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t7) ON (t4.id=t1.id and t7.id=t4.id) SET a = 0, d=0, g=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t2, t3) ON (t1.id=t4.id and t2.id=t4.id and t3.id=t4.id) SET a=0, b=0, c=0, d=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t2, t5) ON (t1.id=t4.id and t2.id=t4.id and t5.id=t4.id) SET a=0, b=0, e=0, d=0 where t4.id=1;
+UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id) SET a=0, d=0, f=0, g=0 where t4.id=1;
+UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
+UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1;
+
+# Sync slave to make sure all above statements are correctly ignored,
+# if any of the above statement are not ignored, it would cause error
+# and stop slave sql thread.
+sync_slave_with_master;
+connection master;
+
+# Parameters for include/wait_for_slave_sql_error_and_skip.inc:
+# Ask it to show SQL error message.
+let $show_sql_error= 1;
+# The expected error will always be 1146 (ER_NO_SUCH_TABLE).
+let $slave_sql_errno= 1146;
+
+#
+# Only do tables are referenced for update, these statements should
+# cause error on slave
+#
+UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+#
+# Do tables and other tables are referenced for update, these
+# statements should cause error on slave
+#
+UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+#
+# Do tables are referenced for update before ignore tables
+#
+UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
+source include/wait_for_slave_sql_error_and_skip.inc;
+
+sync_slave_with_master;
+echo [on slave];
+
+# We should only have tables t1, t2, t3 on slave
+show tables like 't%';
+
+# The rows in these tables should remain untouched
+SELECT * FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+# Clean up
+connection master;
+echo [on master];
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+source include/master-slave-end.inc;
diff --git a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test
index da6cea10698..d5472b47b7b 100644
--- a/mysql-test/t/rpl_trigger.test
+++ b/mysql-test/t/rpl_trigger.test
@@ -293,7 +293,8 @@ STOP SLAVE;
connection master;
FLUSH LOGS;
-exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
+--remove_file $MYSQLTEST_VARDIR/log/master-bin.000001
+--copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001
# Make the slave to replay the new binlog.
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index f4e0b906f60..51029e376b1 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -1,6 +1,9 @@
# Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
#
# Test of some show commands
#
@@ -33,7 +36,7 @@ check table t1 medium;
check table t1 extended;
show index from t1;
--disable_metadata
---error 1062
+--error ER_DUP_ENTRY
insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the
@@ -191,14 +194,14 @@ show columns from t1;
drop table t1;
#
-# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
+# Test for Bug#2593 SHOW CREATE TABLE doesn't properly double quotes
#
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
######### hook for WL#1324 #
---error 1103
+--error ER_WRONG_TABLE_NAME
CREATE TABLE `a/b` (i INT);
# the above test should WORK when WL#1324 is done,
# it should be removed and
@@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT);
#SHOW CREATE TABLE """a";
#DROP TABLE """a";
#
-#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
+#Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
#set names latin1;
#create database `ä`;
#create table `ä`.`ä` (a int) engine=heap;
@@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode;
#
-# Test for bug #2719 "Heap tables status shows wrong or missing data."
+# Test for Bug#2719 Heap tables status shows wrong or missing data.
#
select @@max_heap_table_size;
@@ -313,7 +316,7 @@ show table status;
drop table t1, t2, t3;
#
-# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
+# Test for Bug#3342 SHOW CREATE DATABASE seems to require DROP privilege
#
create database mysqltest;
@@ -328,36 +331,39 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1;
select * from t1;
show create database mysqltest;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
drop table t1;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
+disconnect con1;
connect (con2,localhost,mysqltest_2,,test);
connection con2;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
drop table mysqltest.t1;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
+disconnect con2;
connect (con3,localhost,mysqltest_3,,test);
connection con3;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
drop table mysqltest.t1;
drop database mysqltest;
+disconnect con3;
connection default;
set names binary;
-delete from mysql.user
+delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
-delete from mysql.db
+delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
@@ -371,7 +377,7 @@ flush privileges;
#drop database `ä`;
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
-# specified during table creation, but not otherwise. (Bug #7235)
+# specified during table creation, but not otherwise. (Bug#7235)
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
@@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
-# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index"
+# Test for Bug#9439 Reporting wrong datatype for sub_part on show index
CREATE TABLE t1(
field1 text NOT NULL,
PRIMARY KEY(field1(1000))
@@ -412,7 +418,7 @@ show index from t1;
--disable_metadata
drop table t1;
-# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
+# Test for Bug#11635 mysqldump exports TYPE instead of USING for HASH
create table t1 (
c1 int NOT NULL,
c2 int NOT NULL,
@@ -422,7 +428,7 @@ create table t1 (
SHOW CREATE TABLE t1;
DROP TABLE t1;
-# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
+# Test for Bug#93 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
flush tables;
@@ -430,7 +436,7 @@ flush tables;
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1';
---error 1033
+--error ER_NOT_FORM_FILE
show create table t1;
drop table t1;
@@ -438,7 +444,7 @@ drop table t1;
--echo End of 4.1 tests
#
-# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
+# Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some.
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
@@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
#
-# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
+# Bug#12591 SHOW TABLES FROM dbname produces wrong error message
#
---error 1049
+--error ER_BAD_DB_ERROR
SHOW TABLES FROM non_existing_database;
#
-# Bug#17203: "sql_no_cache sql_cache" in views created from prepared
+# Bug#17203 "sql_no_cache sql_cache" in views created from prepared
# statement
#
# The problem was that initial user setting was forgotten, and current
@@ -543,7 +549,7 @@ SHOW COLUMNS FROM no_such_table;
#
-# Bug #19764: SHOW commands end up in the slow log as table scans
+# Bug#19764 SHOW commands end up in the slow log as table scans
#
flush status;
show status like 'slow_queries';
@@ -555,8 +561,8 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
-# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
-# FROM I_S.
+# BUG#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
+# FROM I_S.
#
#
@@ -671,7 +677,7 @@ SHOW TRIGGERS LIKE 't1';
--echo ----------------------------------------------------------------
-SELECT
+SELECT
TRIGGER_CATALOG,
TRIGGER_SCHEMA,
TRIGGER_NAME,
@@ -794,10 +800,12 @@ CREATE TABLE t1(ËÏÌÏÎËÁ1 INT);
# Check:
# - Dump mysqltest1;
+--let $outfile1=$MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+
--echo
---echo ---> Dumping mysqltest1 to show_check.mysqltest1.sql
+--echo ---> Dumping mysqltest1 to outfile1
---exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $outfile1
# - Clean mysqltest1;
@@ -812,7 +820,8 @@ DROP DATABASE mysqltest1;
--echo
--echo ---> Restoring mysqltest1...
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
+--exec $MYSQL test < $outfile1
+--remove_file $outfile1
# - Check definition of the table.
@@ -824,7 +833,7 @@ DROP DATABASE mysqltest1;
use test;
#
-# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
+# Bug#28808 log_queries_not_using_indexes variable dynamic change is ignored
#
flush status;
show variables like "log_queries_not_using_indexes";
@@ -840,7 +849,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
-# Bug #30088: Can't disable myisam-recover by a value of ""
+# Bug#30088 Can't disable myisam-recover by a value of ""
#
show variables like 'myisam_recover_options';
@@ -865,3 +874,7 @@ show create table t1;
drop table t1;
--echo End of 5.0 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test
index 3f732c8912b..4e7d927fb15 100644
--- a/mysql-test/t/skip_name_resolve.test
+++ b/mysql-test/t/skip_name_resolve.test
@@ -1,7 +1,10 @@
# Can't be tested with embedded server
--- source include/not_embedded.inc
+--source include/not_embedded.inc
-# Bug #8471: IP address with mask fail when skip-name-resolve is on
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# Bug#8471 IP address with mask fail when skip-name-resolve is on
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
@@ -9,12 +12,17 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
-# Bug #13407 "Remote connecting crashes server".
+# Bug#13407 Remote connecting crashes server
# Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 #
-select user();
+SELECT USER();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
-show processlist;
+SHOW PROCESSLIST;
connection default;
+disconnect con1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index 38c72fd4fa6..b8181fcb89b 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -5,6 +5,9 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (con1root,localhost,root,,);
connection con1root;
@@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select db1_secret.db();
#
-# BUG#2777
+# Bug#2777 Stored procedure doesn't observe definer's rights
#
connection con1root;
@@ -215,7 +218,7 @@ call q();
select * from t2;
#
-# BUG#6030: Stored procedure has no appropriate DROP privilege
+# Bug#6030 Stored procedure has no appropriate DROP privilege
# (or ALTER for that matter)
# still connection con2user1 in db2
@@ -330,7 +333,7 @@ flush privileges;
drop table t1;
#
-# BUG#9503: reseting correct parameters of thread after error in SP function
+# Bug#9503 reseting correct parameters of thread after error in SP function
#
connect (root,localhost,root,,test);
connection root;
@@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503;
use test;
drop database mysqltest;
+connection default;
+disconnect root;
#
# correct value from current_user() in function run from "security definer"
-# (BUG#7291)
+# (Bug#7291 Stored procedures: wrong CURRENT_USER value)
#
connection con1root;
use test;
@@ -398,10 +403,10 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop user user1@localhost;
#
-# Bug #12318: Wrong error message when accessing an inaccessible stored
+# Bug#12318 Wrong error message when accessing an inaccessible stored
# procedure in another database when the current database is
# information_schema.
-#
+#
--disable_warnings
drop database if exists mysqltest_1;
@@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
#
-# BUG#12812 create view calling a function works without execute right
+# Bug#12812 create view calling a function works without execute right
# on function
delimiter |;
--disable_warnings
@@ -464,7 +469,7 @@ delimiter ;|
#
-# BUG#14834: Server denies to execute Stored Procedure
+# Bug#14834 Server denies to execute Stored Procedure
#
# The problem here was with '_' in the database name.
#
@@ -507,7 +512,7 @@ drop database db_bug14834;
#
-# BUG#14533: 'desc tbl' in stored procedure causes error
+# Bug#14533 'desc tbl' in stored procedure causes error
# ER_TABLEACCESS_DENIED_ERROR
#
create database db_bug14533;
@@ -546,20 +551,20 @@ drop database db_bug14533;
#
-# BUG#7787: Stored procedures: improper warning for "grant execute" statement
+# Bug#7787 Stored procedures: improper warning for "grant execute" statement
#
# Prepare.
CREATE DATABASE db_bug7787;
-use db_bug7787;
+USE db_bug7787;
# Test.
CREATE PROCEDURE p1()
- SHOW INNODB STATUS;
+ SHOW INNODB STATUS;
-GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
+GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
# Cleanup.
@@ -569,7 +574,7 @@ use test;
#
-# WL#2897: Complete definer support in the stored routines.
+# WL#2897 Complete definer support in the stored routines.
#
# The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines
@@ -614,7 +619,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
-use mysqltest;
+USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
@@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
-use mysqltest;
+USE mysqltest;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
@@ -652,7 +657,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
--echo ---> connection: con1root
--connection con1root
-use mysqltest;
+USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p3;
@@ -672,7 +677,7 @@ DROP DATABASE mysqltest;
#
-# BUG#13198: SP executes if definer does not exist
+# Bug#13198 SP executes if definer does not exist
#
# Prepare environment.
@@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
-use mysqltest;
+USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
@@ -720,7 +725,7 @@ SELECT bug13198_f1();
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
-use mysqltest;
+USE mysqltest;
CALL bug13198_p1();
@@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
-use mysqltest;
+USE mysqltest;
--error ER_NO_SUCH_USER
CALL bug13198_p1();
@@ -764,8 +769,8 @@ DROP DATABASE mysqltest;
#
-# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
-# it results in NULL p/w
+# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
+# it results in NULL p/w
#
# Can't test with embedded server that doesn't support grants
@@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
-use test;
+USE test;
DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC
@@ -814,8 +819,7 @@ DROP USER user19857@localhost;
#
-# BUG#18630: Arguments of suid routine calculated in wrong security
-# context
+# Bug#18630 Arguments of suid routine calculated in wrong security context
#
# Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole.
@@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
DROP TABLE t1;
--echo End of 5.0 tests.
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/sp-threads.test b/mysql-test/t/sp-threads.test
index d8a8ce5dae7..e1012e2b72d 100644
--- a/mysql-test/t/sp-threads.test
+++ b/mysql-test/t/sp-threads.test
@@ -5,6 +5,9 @@
# except security/privilege tests, they go to sp-security.test
#
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (con1root,localhost,root,,);
connect (con2root,localhost,root,,);
connect (con3root,localhost,root,,);
@@ -17,7 +20,7 @@ drop table if exists t1;
--enable_warnings
create table t1 (s1 int, s2 int, s3 int);
-delimiter //;
+delimiter //;
create procedure bug4934()
begin
insert into t1 values (1,0,1);
@@ -38,7 +41,7 @@ drop table t1;
create table t1 (s1 int, s2 int, s3 int);
drop procedure bug4934;
-delimiter //;
+delimiter //;
create procedure bug4934()
begin
end//
@@ -58,7 +61,7 @@ drop procedure bug4934;
#
-# BUG #9486 "Can't perform multi-update in stored procedure"
+# Bug#9486 Can't perform multi-update in stored procedure
#
--disable_warnings
drop procedure if exists bug9486;
@@ -87,8 +90,9 @@ reap;
drop procedure bug9486;
drop table t1, t2;
+
#
-# BUG#11158: Can't perform multi-delete in stored procedure
+# Bug#11158 Can't perform multi-delete in stored procedure
#
--disable_warnings
drop procedure if exists bug11158;
@@ -114,8 +118,9 @@ connection con1root;
drop procedure bug11158;
drop table t1, t2;
+
#
-# BUG#11554: Server crashes on statement indirectly using non-cached function
+# Bug#11554 Server crashes on statement indirectly using non-cached function
#
--disable_warnings
drop function if exists bug11554;
@@ -134,7 +139,7 @@ drop table t1;
drop view v1;
-# BUG#12228
+# Bug#12228 Crash happens during calling specific SP in multithread environment
--disable_warnings
drop procedure if exists p1;
drop procedure if exists p2;
@@ -168,18 +173,26 @@ connection con2root;
unlock tables;
connection con1root;
-# Crash will be here if we hit BUG#12228
+# Crash will be here if we hit Bug#12228
reap;
drop procedure p1;
drop procedure p2;
drop table t1;
+
#
-# BUG#NNNN: New bug synopsis
+# Bug#NNNN New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN;
#--enable_warnings
#create procedure bugNNNN...
+connection default;
+disconnect con1root;
+disconnect con2root;
+disconnect con3root;
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 4e18e69d3d2..0839709bdc8 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -1,14 +1,17 @@
# Can't test with embedded server
-- source include/not_embedded.inc
---sleep 2
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
delimiter |;
+
#
-# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
+# Bug#4902: Stored procedure with SHOW WARNINGS leads to packet error
#
# Added tests for show grants command
--disable_warnings
@@ -47,7 +50,7 @@ drop procedure bug4902_2|
#
-# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
+# Bug#5278: Stored procedure packets out of order if SET PASSWORD.
#
--disable_warnings
drop function if exists bug5278|
@@ -58,13 +61,16 @@ begin
return 'okay';
end|
---error 1133
+--error ER_PASSWORD_NO_MATCH
select bug5278()|
---error 1133
+--error ER_PASSWORD_NO_MATCH
select bug5278()|
drop function bug5278|
+#
+# Bug#3583: query cache doesn't work for stored procedures
+#
--disable_warnings
drop table if exists t1|
--enable_warnings
@@ -72,9 +78,6 @@ create table t1 (
id char(16) not null default '',
data int not null
)|
-#
-# BUG#3583: query cache doesn't work for stored procedures
-#
--disable_warnings
drop procedure if exists bug3583|
--enable_warnings
@@ -110,8 +113,9 @@ delete from t1|
drop procedure bug3583|
drop table t1|
+
#
-# BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
+# Bug#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
#
--disable_warnings
drop procedure if exists bug6807|
@@ -125,16 +129,16 @@ begin
select 'Not reached';
end|
---error 1317
+--error ER_QUERY_INTERRUPTED
call bug6807()|
---error 1317
+--error ER_QUERY_INTERRUPTED
call bug6807()|
drop procedure bug6807|
#
-# BUG#10100: function (and stored procedure?) recursivity problem
+# Bug#10100: function (and stored procedure?) recursivity problem
#
--disable_warnings
drop function if exists bug10100f|
@@ -233,11 +237,11 @@ begin
close c;
end|
-#end of the stack checking
+# end of the stack checking
set @@max_sp_recursion_depth=255|
set @var=1|
-#disable log because error about stack overrun contains numbers which
-#depend on a system
+# disable log because error about stack overrun contains numbers which
+# depend on a system
-- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)|
@@ -266,6 +270,7 @@ drop table t3|
delimiter ;|
+
#
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
#
@@ -282,6 +287,11 @@ call 15298_1();
call 15298_2();
connection default;
+disconnect con1;
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/ssl-big.test b/mysql-test/t/ssl-big.test
index 099c64df08f..91103f1d782 100644
--- a/mysql-test/t/ssl-big.test
+++ b/mysql-test/t/ssl-big.test
@@ -4,12 +4,15 @@
-- source include/have_ssl.inc
-- source include/big_test.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
#
-# Bug #29579 Clients using SSL can hang the server
+# Bug#29579 Clients using SSL can hang the server
#
connect (ssl_con,localhost,root,,,,,SSL);
@@ -18,7 +21,7 @@ create table t1 (a int);
disconnect ssl_con;
-
+
--disable_query_log
--disable_result_log
@@ -26,31 +29,36 @@ let $count= 2000;
while ($count)
{
connect (ssl_con,localhost,root,,,,,SSL);
-
+
eval insert into t1 values ($count);
dec $count;
-
- # This select causes the net buffer to fill as the server sends the results
+
+ # This select causes the net buffer to fill as the server sends the results
# but the client doesn't reap the results. The results are larger each time
# through the loop, so that eventually the buffer is completely full
# at the exact moment the server attempts to the close the connection with
# the lock held.
send select * from t1;
-
+
# now send the quit the command so the server will initiate the shutdown.
- send_quit ssl_con;
-
+ send_quit ssl_con;
+
# if the server is hung, this will hang too:
connect (ssl_con2,localhost,root,,,,,SSL);
-
+
# no hang if we get here, close and retry
disconnect ssl_con2;
disconnect ssl_con;
-}
+}
--enable_query_log
--enable_result_log
connect (ssl_con,localhost,root,,,,,SSL);
drop table t1;
+connection default;
+disconnect ssl_con;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test
index a15f0212fbd..936652eaa3d 100644
--- a/mysql-test/t/ssl.test
+++ b/mysql-test/t/ssl.test
@@ -3,6 +3,9 @@
-- source include/have_ssl.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
@@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
+connection default;
+disconnect ssl_con;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test
index 23051c0e367..b6e11621bf6 100644
--- a/mysql-test/t/ssl_compress.test
+++ b/mysql-test/t/ssl_compress.test
@@ -4,6 +4,9 @@
-- source include/have_ssl.inc
-- source include/have_compress.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
@@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
+
+connection default;
+disconnect ssl_compress_con;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index ee92d649f47..3e4d4eb7ffe 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -1,6 +1,9 @@
# embedded server causes different stat
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
# PS causes different statistics
--disable_ps_protocol
@@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
# End of 5.0 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index ea911e4912d..26bd7c9e8dd 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -78,9 +78,9 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
-select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt;
-explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
(select * from t2 where a>1) as tt;
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
@@ -367,7 +367,7 @@ let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
--source include/wait_condition.inc
select * from t1;
#
-#TODO: should be uncommented after bug 380 fix pushed
+#TODO: should be uncommented after Bug#380 fix pushed
#INSERT INTO t1 (x) SELECT (SELECT SUM(a)+b FROM t2) from t3;
#select * from t1;
drop table t1, t2, t3;
@@ -536,7 +536,7 @@ do (SELECT a from t1);
-- error ER_NO_SUCH_TABLE
set @a:=(SELECT a from t1);
-CREATE TABLE t1 (a int, KEY(a));
+CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
-- error ER_PARSE_ERROR
HANDLER t1 READ a=((SELECT 1));
@@ -678,7 +678,7 @@ CREATE TABLE t2 (
INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
-select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
+select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
drop table t1, t2;
@@ -732,9 +732,9 @@ drop table t1,t2;
#
# correct NULL in <CONSTANT> IN (SELECT ...)
#
-create table t1 (a int, unique index indexa (a));
-insert into t1 values (-1), (-4), (-2), (NULL);
-select -10 IN (select a from t1 FORCE INDEX (indexa));
+create table t1 (a int, unique index indexa (a));
+insert into t1 values (-1), (-4), (-2), (NULL);
+select -10 IN (select a from t1 FORCE INDEX (indexa));
drop table t1;
#
@@ -816,7 +816,7 @@ disable_query_log;
let $1 = 10000;
while ($1)
{
- eval insert into t1 values (rand()*100000+200,rand()*100000);
+ eval insert into t1 values (rand()*100000+200,rand()*100000);
dec $1;
}
enable_query_log;
@@ -842,7 +842,7 @@ create table t2 (a int, b int);
create table t3 (a int, b int);
insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
-insert into t3 values (3,3), (2,2), (1,1);
+insert into t3 values (3,3), (2,2), (1,1);
select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
drop table t1,t2,t3;
@@ -1010,7 +1010,7 @@ drop table t1, t2;
#
# unresolved field error
#
-create table t1 (s1 int);
+create table t1 (s1 int);
create table t2 (s1 int);
-- error ER_BAD_FIELD_ERROR
select * from t1 where (select count(*) from t2 where t1.s2) = 1;
@@ -1035,11 +1035,12 @@ INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
DROP TABLE t1;
+
#
-# Bug 2198
+# Bug#2198 SELECT INTO OUTFILE (with Sub-Select) Problem
#
-create table t1 (a int, b decimal(13, 3));
+create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123);
let $outfile = $MYSQLTEST_VARDIR/master-data/test/subselect.out.file.1;
--error 0,1
@@ -1051,8 +1052,9 @@ load data infile "subselect.out.file.1" into table t1;
select * from t1;
drop table t1;
+
#
-# Bug 2479
+# Bug#2479 dependant subquery with limit crash
#
CREATE TABLE `t1` (
@@ -1090,8 +1092,9 @@ select 2 in (select * from t1);
SET SQL_SELECT_LIMIT=default;
drop table t1;
+
#
-# Bug #3118: subselect + order by
+# Bug#3118 subselect + order by
#
CREATE TABLE t1 (a int, b int, INDEX (a));
@@ -1130,8 +1133,9 @@ insert into t1 values (1);
explain select benchmark(1000, (select a from t1 where a=sha(rand())));
drop table t1;
+
#
-# bug 3188
+# Bug#3188 Ambiguous Column in Subselect crashes server
#
create table t1(id int);
create table t2(id int);
@@ -1140,8 +1144,9 @@ create table t3(flag int);
select (select * from t3 where id not null) from t1, t2;
drop table t1,t2,t3;
+
#
-# aggregate functions (Bug #3505)
+# aggregate functions (Bug#3505 Wrong results on use of ORDER BY with subqueries)
#
CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT);
@@ -1332,8 +1337,9 @@ select * from t1 up where exists (select * from t1 where t1.a=up.a);
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
drop table t1;
+
#
-# Bug #4102: subselect in HAVING
+# Bug#4102 subselect in HAVING
#
CREATE TABLE t1 (t1_a int);
@@ -1344,8 +1350,10 @@ SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1
HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a);
DROP TABLE t1, t2;
+
#
-# Test problem with NULL and derived tables (Bug #4097)
+# Test problem with NULL and derived tables
+# (Bug#4097 JOIN with subquery causes entire column to report NULL)
#
CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL);
@@ -1355,18 +1363,19 @@ INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix');
SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id;
drop table t1,t2;
+
#
# outer fields resolving in INSERT/REPLACE and CRETE with SELECT
#
CREATE TABLE t1 ( a int, b int );
CREATE TABLE t2 ( c int, d int );
INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
-SELECT a AS abc, b FROM t1 outr WHERE b =
+SELECT a AS abc, b FROM t1 outr WHERE b =
(SELECT MIN(b) FROM t1 WHERE a=outr.a);
-INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
+INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
(SELECT MIN(b) FROM t1 WHERE a=outr.a);
select * from t2;
-CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
+CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
(SELECT MIN(b) FROM t1 WHERE a=outr.a);
select * from t3;
prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
@@ -1390,19 +1399,21 @@ insert into t2 values (1,2);
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
drop table t1,t2;
+
#
-# BUG#4769 - fulltext in subselect
+# Bug#4769 - fulltext in subselect
#
-create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
-insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
-create table t2 (a int);
-insert into t2 values (1),(3),(2),(7);
-select a,b from t1 where match(b) against ('Ball') > 0;
-select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
+create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
+insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
+create table t2 (a int);
+insert into t2 values (1),(3),(2),(7);
+select a,b from t1 where match(b) against ('Ball') > 0;
+select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
drop table t1,t2;
+
#
-# BUG#5003 - like in subselect
+# Bug#5003 - like in subselect
#
CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
@@ -1459,10 +1470,10 @@ SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.s
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
drop tables t1,t2;
+
#
-# Test for bug #6462. "Same request on same data returns different
-# results." a.k.a. "Proper cleanup of subqueries is missing for
-# SET and DO statements".
+# Test for Bug#6462 Same request on same data returns different results
+# a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements".
#
create table t1 (a int not null, b int not null, c int, primary key (a,b));
insert into t1 values (1,1,1), (2,2,2), (3,3,3);
@@ -1484,9 +1495,11 @@ drop table t1;
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
+connection default;
+disconnect root;
#
-# primary query with temporary table and subquery with groupping
+# primary query with temporary table and subquery with grouping
#
create table t1 (a int, b int);
create table t2 (a int, b int);
@@ -1547,14 +1560,15 @@ INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,680
INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
-SELECT DISTINCT Continent AS c FROM t1 outr WHERE
- Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
+SELECT DISTINCT Continent AS c FROM t1 outr WHERE
+ Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
Population < 200);
drop table t1;
+
#
-# Test for BUG#7885: Server crash when 'any' subselect compared to
-# non-existant field.
+# Test for Bug#7885 Server crash when 'any' subselect compared to
+# non-existant field.
#
create table t1 (a1 int);
create table t2 (b1 int);
@@ -1603,8 +1617,9 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
drop table t1;
+
#
-# Test for BUG#8218
+# Test for Bug#8218 Join does not pass string from right table
#
CREATE TABLE t1 (
categoryId int(11) NOT NULL,
@@ -1674,38 +1689,39 @@ select
count(distinct t2.userid) pass,
groupstuff.*,
count(t2.courseid) crse,
- t1.categoryid,
+ t1.categoryid,
t2.courseid,
date_format(date, '%b%y') as colhead
-from t2
-join t1 on t2.courseid=t1.courseid
+from t2
+join t1 on t2.courseid=t1.courseid
join
(
- select
- t5.userid,
- parentid,
- parentgroup,
- childid,
- groupname,
- grouptypeid
- from t5
- join
+ select
+ t5.userid,
+ parentid,
+ parentgroup,
+ childid,
+ groupname,
+ grouptypeid
+ from t5
+ join
(
- select t4.id as parentid,
- t4.name as parentgroup,
- t4.id as childid,
- t4.name as groupname,
- t4.grouptypeid
- from t4
- ) as gin on t5.groupid=gin.childid
-) as groupstuff on t2.userid = groupstuff.userid
-group by
+ select t4.id as parentid,
+ t4.name as parentgroup,
+ t4.id as childid,
+ t4.name as groupname,
+ t4.grouptypeid
+ from t4
+ ) as gin on t5.groupid=gin.childid
+) as groupstuff on t2.userid = groupstuff.userid
+group by
groupstuff.groupname, colhead , t2.courseid;
drop table t1, t2, t3, t4, t5;
+
#
-# Transformation in left expression of subquery (BUG#8888)
+# Transformation in left expression of subquery (Bug#8888)
#
create table t1 (a int);
insert into t1 values (1), (2), (3);
@@ -1750,8 +1766,9 @@ select (1,2,3) = (select * from t1);
select (select * from t1) = (1,2,3);
drop table t1;
+
#
-# Item_int_with_ref check (BUG#10020)
+# Item_int_with_ref check (Bug#10020)
#
CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment,
@@ -1774,15 +1791,16 @@ INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2;
-# BUG#11821 : Select from subselect using aggregate function on an enum
-# segfaults:
+
+# Bug#11821 Select from subselect using aggregate function on an enum segfaults
create table t1 (fld enum('0','1'));
insert into t1 values ('1');
select * from (select max(fld) from t1) as foo;
drop table t1;
+
#
-# Bug #11867: queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...)
+# Bug#11867 queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...)
#
CREATE TABLE t1 (one int, two int, flag char(1));
@@ -1812,8 +1830,9 @@ explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FR
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
DROP TABLE t1,t2;
+
#
-# Bug #12392: where cond with IN predicate for rows and NULL values in table
+# Bug#12392 where cond with IN predicate for rows and NULL values in table
#
CREATE TABLE t1 (a char(5), b char(5));
@@ -1823,8 +1842,9 @@ SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
DROP TABLE t1;
+
#
-# Bug #11479: subquery over left join with an empty inner table
+# Bug#11479 subquery over left join with an empty inner table
#
CREATE TABLE t1 (a int);
@@ -1841,9 +1861,10 @@ SELECT * FROM t1
DROP TABLE t1,t2,t3;
+
#
-# Bug#18503: Queries with a quantified subquery returning empty set may
-# return a wrong result.
+# Bug#18503 Queries with a quantified subquery returning empty set may
+# return a wrong result.
#
CREATE TABLE t1 (f1 INT);
CREATE TABLE t2 (f2 INT);
@@ -1855,8 +1876,9 @@ INSERT INTO t2 VALUES (2);
SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0);
DROP TABLE t1, t2;
+
#
-# Bug#16302: Quantified subquery without any tables gives wrong results
+# Bug#16302 Quantified subquery without any tables gives wrong results
#
select 1 from dual where 1 < any (select 2);
select 1 from dual where 1 < all (select 2);
@@ -1865,7 +1887,8 @@ select 1 from dual where 2 > all (select 1);
select 1 from dual where 1 < any (select 2 from dual);
select 1 from dual where 1 < all (select 2 from dual where 1!=1);
-# BUG#20975 Wrong query results for subqueries within NOT
+
+# Bug#20975 Wrong query results for subqueries within NOT
create table t1 (s1 char);
insert into t1 values (1),(2);
@@ -1882,8 +1905,9 @@ select * from t1 where (s1 = ALL (select s1/s1 from t1));
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
drop table t1;
+
#
-# Bug #16255: Subquery in where
+# Bug#16255 Subquery in where
#
create table t1 (
retailerID varchar(8) NOT NULL,
@@ -1899,15 +1923,16 @@ INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
-select * from t1 r1
- where (r1.retailerID,(r1.changed)) in
- (SELECT r2.retailerId,(max(changed)) from t1 r2
+select * from t1 r1
+ where (r1.retailerID,(r1.changed)) in
+ (SELECT r2.retailerId,(max(changed)) from t1 r2
group by r2.retailerId);
drop table t1;
+
#
-# Bug #21180: Subselect with index for both WHERE and ORDER BY
-# produces empty result
+# Bug#21180 Subselect with index for both WHERE and ORDER BY
+# produces empty result
#
create table t1(a int, primary key (a));
insert into t1 values (10);
@@ -1915,38 +1940,39 @@ insert into t1 values (10);
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
-explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
- ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
-SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
- ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
-explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
- ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
-SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
- ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
drop table t1,t2;
+
#
-# Bug #21853: assert failure for a grouping query with
-# an ALL/ANY quantified subquery in HAVING
+# Bug#21853 assert failure for a grouping query with
+# an ALL/ANY quantified subquery in HAVING
#
-CREATE TABLE t1 (
- field1 int NOT NULL,
- field2 int NOT NULL,
- field3 int NOT NULL,
- PRIMARY KEY (field1,field2,field3)
+CREATE TABLE t1 (
+ field1 int NOT NULL,
+ field2 int NOT NULL,
+ field3 int NOT NULL,
+ PRIMARY KEY (field1,field2,field3)
+);
+CREATE TABLE t2 (
+ fieldA int NOT NULL,
+ fieldB int NOT NULL,
+ PRIMARY KEY (fieldA,fieldB)
);
-CREATE TABLE t2 (
- fieldA int NOT NULL,
- fieldB int NOT NULL,
- PRIMARY KEY (fieldA,fieldB)
-);
INSERT INTO t1 VALUES
(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
@@ -1958,19 +1984,20 @@ SELECT field1, field2, COUNT(*)
SELECT field1, field2
FROM t1
GROUP BY field1, field2
- HAVING COUNT(*) >= ALL (SELECT fieldB
+ HAVING COUNT(*) >= ALL (SELECT fieldB
FROM t2 WHERE fieldA = field1);
SELECT field1, field2
FROM t1
GROUP BY field1, field2
- HAVING COUNT(*) < ANY (SELECT fieldB
+ HAVING COUNT(*) < ANY (SELECT fieldB
FROM t2 WHERE fieldA = field1);
DROP TABLE t1, t2;
+
#
-# Bug #23478: not top-level IN subquery returning a non-empty result set
-# with possible NULL values by index access from the outer query
+# Bug#23478 not top-level IN subquery returning a non-empty result set
+# with possible NULL values by index access from the outer query
#
CREATE TABLE t1(a int, INDEX (a));
@@ -1985,24 +2012,26 @@ SELECT a, a IN (SELECT a FROM t1) FROM t2;
DROP TABLE t1,t2;
+
#
-# Bug #11302: getObject() returns a String for a sub-query of type datetime
+# Bug#11302 getObject() returns a String for a sub-query of type datetime
#
CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
-CREATE TABLE t2 AS SELECT
- (SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
+CREATE TABLE t2 AS SELECT
+ (SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
FROM t1 WHERE a > '2000-01-01';
SHOW CREATE TABLE t2;
-CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
+CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
SHOW CREATE TABLE t3;
DROP TABLE t1,t2,t3;
+
#
-# Bug 24670: subquery witout tables but with a WHERE clause
+# Bug#24670 subquery witout tables but with a WHERE clause
#
CREATE TABLE t1 (a int);
@@ -2014,9 +2043,10 @@ EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
DROP TABLE t1;
+
#
-# Bug 24653: sorting by expressions containing subselects
-# that return more than one row
+# Bug#24653 sorting by expressions containing subselects
+# that return more than one row
#
CREATE TABLE t1 (a int);
@@ -2099,8 +2129,9 @@ select * from t1;
select min(a) from t1 group by grp;
drop table t1;
+
#
-# Test for bug #9338: lame substitution of c1 instead of c2
+# Test for Bug#9338 lame substitution of c1 instead of c2
#
CREATE table t1 ( c1 integer );
@@ -2120,15 +2151,16 @@ SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2
DROP TABLE t1,t2;
+
#
-# Test for bug #9516: wrong evaluation of not_null_tables attribute in SQ
+# Test for Bug#9516 wrong evaluation of not_null_tables attribute in SQ
#
CREATE TABLE t1 ( c1 integer );
INSERT INTO t1 VALUES ( 1 );
INSERT INTO t1 VALUES ( 2 );
INSERT INTO t1 VALUES ( 3 );
-INSERT INTO t1 VALUES ( 6 );
-
+INSERT INTO t1 VALUES ( 6 );
+
CREATE TABLE t2 ( c2 integer );
INSERT INTO t2 VALUES ( 1 );
INSERT INTO t2 VALUES ( 4 );
@@ -2139,13 +2171,14 @@ CREATE TABLE t3 ( c3 integer );
INSERT INTO t3 VALUES ( 7 );
INSERT INTO t3 VALUES ( 8 );
-SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
+SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
DROP TABLE t1,t2,t3;
+
#
-# Item_int_with_ref check (BUG#10020)
+# Item_int_with_ref check (Bug#10020)
#
CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment,
@@ -2168,9 +2201,10 @@ INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2;
+
#
# Correct building of equal fields list (do not include outer
-# fields) (BUG#6384)
+# fields) (Bug#6384)
#
CREATE TABLE t1 (EMPNUM CHAR(3));
CREATE TABLE t2 (EMPNUM CHAR(3) );
@@ -2184,44 +2218,46 @@ WHERE t1.EMPNUM NOT IN
select * from t1;
DROP TABLE t1,t2;
+
#
-# Test for bug #11487: range access in a subquery
+# Test for Bug#11487 range access in a subquery
#
CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
INSERT INTO t1 VALUES (1, 1);
-CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
+CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
PRIMARY KEY(select_id,values_id));
INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5);
-SELECT values_id FROM t1
+SELECT values_id FROM t1
WHERE values_id IN (SELECT values_id FROM t2
WHERE select_id IN (1, 0));
-SELECT values_id FROM t1
+SELECT values_id FROM t1
WHERE values_id IN (SELECT values_id FROM t2
WHERE select_id BETWEEN 0 AND 1);
-SELECT values_id FROM t1
+SELECT values_id FROM t1
WHERE values_id IN (SELECT values_id FROM t2
WHERE select_id = 0 OR select_id = 1);
DROP TABLE t1, t2;
-# BUG#11821 : Select from subselect using aggregate function on an enum
-# segfaults:
+
+# Bug#11821 Select from subselect using aggregate function on an enum segfaults
create table t1 (fld enum('0','1'));
insert into t1 values ('1');
select * from (select max(fld) from t1) as foo;
drop table t1;
+
#
-# Test for bug #11762: subquery with an aggregate function in HAVING
+# Test for Bug#11762 subquery with an aggregate function in HAVING
#
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (c int, d int);
CREATE TABLE t3 (e int);
-INSERT INTO t1 VALUES
+INSERT INTO t1 VALUES
(1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40);
INSERT INTO t2 VALUES
(2,10), (2,20), (4,10), (5,10), (3,20), (2,40);
@@ -2251,7 +2287,7 @@ SELECT a FROM t1 GROUP BY a
WHERE EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e < d));
SELECT a FROM t1 GROUP BY a
HAVING a IN (SELECT c FROM t2
- WHERE MIN(b) < d AND
+ WHERE MIN(b) < d AND
EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e <= d));
SELECT a, SUM(a) FROM t1 GROUP BY a;
@@ -2279,9 +2315,9 @@ SELECT t1.a FROM t1 GROUP BY t1.a
-- error ER_INVALID_GROUP_FUNC_USE
SELECT t1.a FROM t1 GROUP BY t1.a
HAVING t1.a > ALL(SELECT t2.c FROM t2
- WHERE EXISTS(SELECT t3.e FROM t3
+ WHERE EXISTS(SELECT t3.e FROM t3
WHERE SUM(t1.a+t2.c) < t3.e/4));
--- error ER_INVALID_GROUP_FUNC_USE
+-- error ER_INVALID_GROUP_FUNC_USE
SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20;
SELECT t1.a FROM t1 GROUP BY t1.a
@@ -2297,9 +2333,10 @@ SELECT t1.a, SUM(b) AS sum FROM t1 GROUP BY t1.a
DROP TABLE t1,t2,t3;
+
#
-# Test for bug #16603: GROUP BY in a row subquery with a quantifier
-# when an index is defined on the grouping field
+# Test for Bug#16603 GROUP BY in a row subquery with a quantifier
+# when an index is defined on the grouping field
CREATE TABLE t1 (a varchar(5), b varchar(10));
INSERT INTO t1 VALUES
@@ -2318,27 +2355,30 @@ SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
DROP TABLE t1;
+
#
-# Bug#17366: Unchecked Item_int results in server crash
+# Bug#17366 Unchecked Item_int results in server crash
#
create table t1( f1 int,f2 int);
insert into t1 values (1,1),(2,2);
select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
drop table t1;
+
#
-# Bug #18306: server crash on delete using subquery.
+# Bug#18306 server crash on delete using subquery.
#
-create table t1 (c int, key(c));
+create table t1 (c int, key(c));
insert into t1 values (1142477582), (1142455969);
create table t2 (a int, b int);
insert into t2 values (2, 1), (1, 0);
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2;
+
#
-# Bug #7549: Missing error message for invalid view selection with subquery
+# Bug#7549 Missing error message for invalid view selection with subquery
#
CREATE TABLE t1 (a INT);
@@ -2352,16 +2392,18 @@ SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
DROP TABLE t1;
+
#
-# Bug#19077: A nested materialized derived table is used before being populated.
+# Bug#19077 A nested materialized derived table is used before being populated.
#
create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2);
select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
drop table t1;
-#
-# Bug#19700: subselect returning BIGINT always returned it as SIGNED
+
+#
+# Bug#19700 subselect returning BIGINT always returned it as SIGNED
#
CREATE TABLE t1 (i BIGINT UNSIGNED);
INSERT INTO t1 VALUES (10000000000000000000); # > MAX SIGNED BIGINT 9323372036854775807
@@ -2383,8 +2425,9 @@ SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
DROP TABLE t1;
DROP TABLE t2;
-#
-# Bug#20519: subselect with LIMIT M, N
+
+#
+# Bug#20519 subselect with LIMIT M, N
#
CREATE TABLE t1 (
@@ -2401,7 +2444,7 @@ CREATE TABLE t2 (
date date NOT NULL,
PRIMARY KEY (id)
);
-INSERT INTO t2 VALUES
+INSERT INTO t2 VALUES
(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
@@ -2423,8 +2466,9 @@ SELECT *,
FROM t1;
DROP TABLE t1,t2;
+
#
-# Bug#20869: subselect with range access by DESC
+# Bug#20869 subselect with range access by DESC
#
CREATE TABLE t1 (
@@ -2433,7 +2477,7 @@ CREATE TABLE t1 (
t datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (i1,i2,t)
);
-INSERT INTO t1 VALUES
+INSERT INTO t1 VALUES
(24,1,'2005-03-03 16:31:31'),(24,1,'2005-05-27 12:40:07'),
(24,1,'2005-05-27 12:40:08'),(24,1,'2005-05-27 12:40:10'),
(24,1,'2005-05-27 12:40:25'),(24,1,'2005-05-27 12:40:30'),
@@ -2451,34 +2495,34 @@ INSERT INTO t2 VALUES (24,1,'2006-06-20 12:29:40');
EXPLAIN
SELECT * FROM t1,t2
- WHERE t1.t = (SELECT t1.t FROM t1
+ WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
SELECT * FROM t1,t2
- WHERE t1.t = (SELECT t1.t FROM t1
+ WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
DROP TABLE t1, t2;
+
#
-# Bug#14654 : Cannot select from the same table twice within a UNION
-# statement
+# Bug#14654 Cannot select from the same table twice within a UNION statement
#
CREATE TABLE t1 (i INT);
(SELECT i FROM t1) UNION (SELECT i FROM t1);
#TODO:not supported
--error ER_PARSE_ERROR
-SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
(
- (SELECT i FROM t1) UNION
+ (SELECT i FROM t1) UNION
(SELECT i FROM t1)
);
#TODO:not supported
--error ER_PARSE_ERROR
-SELECT * FROM t1
+SELECT * FROM t1
WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
#TODO:not supported
@@ -2488,14 +2532,15 @@ explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
#TODO:not supported
--error ER_PARSE_ERROR
-explain select * from t1 where not exists
+explain select * from t1 where not exists
((select t11.i from t1 t11) union (select t12.i from t1 t12));
DROP TABLE t1;
+
#
-# Bug#21798: memory leak during query execution with subquery in column
-# list using a function
+# Bug#21798 memory leak during query execution with subquery in column
+# list using a function
#
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
insert into t1 (a) values (FLOOR(rand() * 100));
@@ -2513,15 +2558,16 @@ insert into t1 (a) select FLOOR(rand() * 100) from t1;
insert into t1 (a) select FLOOR(rand() * 100) from t1;
insert into t1 (a) select FLOOR(rand() * 100) from t1;
-SELECT a,
- (SELECT REPEAT(' ',250) FROM t1 i1
- WHERE i1.b=t1.a ORDER BY RAND() LIMIT 1) AS a
+SELECT a,
+ (SELECT REPEAT(' ',250) FROM t1 i1
+ WHERE i1.b=t1.a ORDER BY RAND() LIMIT 1) AS a
FROM t1 ORDER BY a LIMIT 5;
DROP TABLE t1;
+
#
-# Bug #21540: Subqueries with no from and aggregate functions return
-# wrong results
+# Bug#21540 Subqueries with no from and aggregate functions return
+# wrong results
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT);
INSERT INTO t2 values (1);
@@ -2530,29 +2576,30 @@ SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
FROM t1 GROUP BY t1.a;
SELECT COUNT(DISTINCT t1.b), (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
-SELECT COUNT(DISTINCT t1.b),
+SELECT COUNT(DISTINCT t1.b),
(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
FROM t1 GROUP BY t1.a;
SELECT (
SELECT (
SELECT COUNT(DISTINCT t1.b)
)
-)
+)
FROM t1 GROUP BY t1.a;
SELECT (
SELECT (
SELECT (
SELECT COUNT(DISTINCT t1.b)
)
- )
- FROM t1 GROUP BY t1.a LIMIT 1)
+ )
+ FROM t1 GROUP BY t1.a LIMIT 1)
FROM t1 t2
GROUP BY t2.a;
-DROP TABLE t1,t2;
+DROP TABLE t1,t2;
+
#
-# Bug #21727: Correlated subquery that requires filesort:
-# slow with big sort_buffer_size
+# Bug#21727 Correlated subquery that requires filesort:
+# slow with big sort_buffer_size
#
CREATE TABLE t1 (a int, b int auto_increment, PRIMARY KEY (b));
@@ -2570,26 +2617,27 @@ while ($1)
{
eval INSERT INTO t2(y,z) VALUES(@id,RAND()*1000);
dec $2;
- }
+ }
dec $1;
}
enable_query_log;
SET SESSION sort_buffer_size = 32 * 1024;
-SELECT SQL_NO_CACHE COUNT(*)
+SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
SET SESSION sort_buffer_size = 8 * 1024 * 1024;
-SELECT SQL_NO_CACHE COUNT(*)
+SELECT SQL_NO_CACHE COUNT(*)
FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
FROM t1) t;
DROP TABLE t1,t2;
+
#
-# Bug #25219: EXIST subquery with UNION over a mix of
-# correlated and uncorrelated selects
+# Bug#25219 EXIST subquery with UNION over a mix of
+# correlated and uncorrelated selects
#
CREATE TABLE t1 (id char(4) PRIMARY KEY, c int);
@@ -2621,10 +2669,11 @@ SELECT * FROM t1
DROP TABLE t1,t2,t3;
-#
-# Bug#23800: Outer fields in correlated subqueries is used in a temporary
-# table created for sorting.
-#
+
+#
+# Bug#23800 Outer fields in correlated subqueries is used in a temporary
+# table created for sorting.
+#
CREATE TABLE t1(f1 int);
CREATE TABLE t2(f2 int, f21 int, f3 timestamp);
INSERT INTO t1 VALUES (1),(1),(2),(2);
@@ -2635,19 +2684,20 @@ PREPARE stmt1 FROM 'SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)
EXECUTE stmt1;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
-SELECT f2, AVG(f21),
+SELECT f2, AVG(f21),
(SELECT t.f3 FROM t2 AS t WHERE t2.f2=t.f2 AND t.f3=MAX(t2.f3)) AS test
FROM t2 GROUP BY f2;
-DROP TABLE t1,t2;
-CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL);
-INSERT INTO t1 VALUES
- (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
- (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'), (3,3,'j'),
- (3,2,'k'), (3,1,'l'), (1,9,'m');
-SELECT a, MAX(b),
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
- FROM t1 GROUP BY a;
-DROP TABLE t1;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL);
+INSERT INTO t1 VALUES
+ (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
+ (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'), (3,3,'j'),
+ (3,2,'k'), (3,1,'l'), (1,9,'m');
+SELECT a, MAX(b),
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
+ FROM t1 GROUP BY a;
+DROP TABLE t1;
+
#
# Bug#21904 (parser problem when using IN with a double "(())")
@@ -2748,21 +2798,23 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t1xt2;
+
+#
+# Bug#26728 derived table with concatanation of literals in select list
#
-# Bug #26728: derived table with concatanation of literals in select list
-#
CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (3), (1), (2);
+INSERT INTO t1 VALUES (3), (1), (2);
SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
DROP table t1;
+
+#
+# Bug#27257 COUNT(*) aggregated in outer query
#
-# Bug #27257: COUNT(*) aggregated in outer query
-#
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (m int, n int);
@@ -2777,15 +2829,16 @@ SELECT COUNT(*), a,
(SELECT MIN(m) FROM t2 WHERE m = count(*))
FROM t1 GROUP BY a;
-SELECT COUNT(*), a
+SELECT COUNT(*), a
FROM t1 GROUP BY a
HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
DROP TABLE t1,t2;
+
+#
+# Bug#27229 GROUP_CONCAT in subselect with COUNT() as an argument
#
-# Bug #27229: GROUP_CONCAT in subselect with COUNT() as an argument
-#
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (m int, n int);
@@ -2802,8 +2855,9 @@ SELECT COUNT(*) c, a,
DROP table t1,t2;
+
#
-# Bug#27321: Wrong subquery result in a grouping select
+# Bug#27321 Wrong subquery result in a grouping select
#
CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
@@ -2811,7 +2865,7 @@ INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
SELECT a, MAX(b),
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
FROM t1 GROUP BY a;
SELECT a x, MAX(b),
(SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
@@ -2822,25 +2876,27 @@ SELECT a, AVG(b),
SELECT tt.a,
(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
- LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+ LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
FROM t1 as tt;
SELECT tt.a,
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
LIMIT 1)
- FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+ FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
FROM t1 as tt GROUP BY tt.a;
SELECT tt.a, MAX(
(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
LIMIT 1)
- FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+ FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
FROM t1 as tt GROUP BY tt.a;
DROP TABLE t1;
+
+
+#
+# Bug#27348 SET FUNCTION used in a subquery from WHERE condition
#
-# Bug #27348: SET FUNCTION used in a subquery from WHERE condition
-#
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
@@ -2865,9 +2921,9 @@ SET @@sql_mode=default;
DROP TABLE t1;
+
#
-# Bug #27363: nested aggregates in outer, subquery / sum(select
-# count(outer))
+# Bug#27363 nested aggregates in outer, subquery / sum(select count(outer))
#
CREATE TABLE t1 (a INT); INSERT INTO t1 values (1),(1),(1),(1);
CREATE TABLE t2 (x INT); INSERT INTO t1 values (1000),(1001),(1002);
@@ -2882,28 +2938,30 @@ SELECT COUNT(1) FROM DUAL;
SELECT SUM( (SELECT AVG( (SELECT t1.a FROM t2) ) FROM DUAL) ) FROM t1;
--error ER_INVALID_GROUP_FUNC_USE
-SELECT
+SELECT
SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING t1.a < 12) ) FROM t2) )
FROM t1;
--error ER_INVALID_GROUP_FUNC_USE
-SELECT t1.a as XXA,
+SELECT t1.a as XXA,
SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING XXA < 12) ) FROM t2) )
FROM t1;
DROP TABLE t1,t2;
+
+#
+# Bug#27807 Server crash when executing subquery with EXPLAIN
#
-# Bug #27807: Server crash when executing subquery with EXPLAIN
-#
-CREATE TABLE t1 (a int, b int, KEY (a));
+CREATE TABLE t1 (a int, b int, KEY (a));
INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
DROP TABLE t1;
+
+#
+# Bug#28377 grouping query with a correlated subquery in WHERE condition
#
-# Bug #28377: grouping query with a correlated subquery in WHERE condition
-#
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
INSERT INTO t1 VALUES
@@ -2911,24 +2969,25 @@ INSERT INTO t1 VALUES
CREATE TABLE t2 (id int NOT NULL, INDEX idx(id));
INSERT INTO t2 VALUES (7), (5), (1), (3);
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
GROUP BY id;
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
-SELECT id, st FROM t1
+SELECT id, st FROM t1
WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
GROUP BY id;
DROP TABLE t1,t2;
+
+#
+# Bug#28728 crash with EXPLAIN EXTENDED for a query with a derived table
+# over a grouping subselect
#
-# Bug #28728: crash with EXPLAIN EXTENDED for a query with a derived table
-# over a grouping subselect
-#
CREATE TABLE t1 (a int);
@@ -2939,10 +2998,11 @@ SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res;
DROP TABLE t1;
+
#
-# Bug #28811: crash for query containing subquery with ORDER BY and LIMIT 1
+# Bug#28811 crash for query containing subquery with ORDER BY and LIMIT 1
#
-
+
CREATE TABLE t1 (
a varchar(255) default NULL,
b timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
@@ -2973,8 +3033,8 @@ DROP TABLE t1,t2;
#
-# Bug #27333: subquery grouped for aggregate of outer query / no aggregate
-# of subquery
+# Bug#27333 subquery grouped for aggregate of outer query / no aggregate
+# of subquery
#
CREATE TABLE t1 (a INTEGER, b INTEGER);
CREATE TABLE t2 (x INTEGER);
@@ -3013,8 +3073,9 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1;
DROP TABLE t1,t2;
+
#
-# Bug31048: Many nested subqueries may cause server crash.
+# Bug31048 Many nested subqueries may cause server crash.
#
create table t1(a int,b int,key(a),key(b));
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
@@ -3059,8 +3120,9 @@ while ($nesting)
--enable_query_log
drop table t1;
+
#
-# Bug #31884: Assertion + crash in subquery in the SELECT clause.
+# Bug#31884 Assertion + crash in subquery in the SELECT clause.
#
CREATE TABLE t1 (a1 INT, a2 INT);
@@ -3075,7 +3137,7 @@ SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
DROP TABLE t1, t2;
#
-# Bug #28076: inconsistent binary/varbinary comparison
+# Bug#28076 inconsistent binary/varbinary comparison
#
CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
@@ -3116,8 +3178,9 @@ SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3;
SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3);
DROP TABLE t1, t2, t3;
+
#
-# Bug #30788: Inconsistent retrieval of char/varchar
+# Bug#30788 Inconsistent retrieval of char/varchar
#
CREATE TABLE t1 (a CHAR(1), b VARCHAR(10));
@@ -3141,16 +3204,16 @@ SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
DROP TABLE t1,t2;
+
#
-# Bug #32400: Complex SELECT query returns correct result only on some
-# occasions
+# Bug#32400 Complex SELECT query returns correct result only on some occasions
#
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (1,1), (1,2), (2,3), (2,4);
--error ER_BAD_FIELD_ERROR
-EXPLAIN
+EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a;
@@ -3160,7 +3223,7 @@ SELECT a AS out_a, MIN(b) FROM t1
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
GROUP BY a;
-EXPLAIN
+EXPLAIN
SELECT a AS out_a, MIN(b) FROM t1 t1_outer
WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
GROUP BY a;
@@ -3171,8 +3234,9 @@ GROUP BY a;
DROP TABLE t1;
+
#
-# Bug #32036: EXISTS within a WHERE clause with a UNION crashes MySQL 5.122
+# Bug#32036 EXISTS within a WHERE clause with a UNION crashes MySQL 5.122
#
CREATE TABLE t1 (a INT);
@@ -3189,15 +3253,15 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
#TODO:not supported
--error ER_PARSE_ERROR
EXPLAIN EXTENDED
-SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
DROP TABLE t1,t2;
#
-# Bug#33675: Usage of an uninitialized memory by filesort in a subquery
-# caused server crash.
+# Bug#33675 Usage of an uninitialized memory by filesort in a subquery
+# caused server crash.
#
create table t1(f11 int, f12 int);
create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
@@ -3213,13 +3277,14 @@ while ($i)
--enable_warnings
--enable_query_log
set session sort_buffer_size= 33*1024;
-select count(*) from t1 where f12 =
+select count(*) from t1 where f12 =
(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
drop table t1,t2;
+
#
-# BUG#33794 "MySQL crashes executing specific query on specific dump"
+# Bug#33794 "MySQL crashes executing specific query on specific dump"
#
CREATE TABLE t4 (
f7 varchar(32) collate utf8_bin NOT NULL default '',
@@ -3261,32 +3326,34 @@ SELECT
FROM t2 VPC, t4 a2, t2 a3
WHERE
VPC.f4 = a2.f10 AND a3.f2 = a4
- LIMIT 1) IS NULL,
- 0,
+ LIMIT 1) IS NULL,
+ 0,
t3.f5
)
) AS a6
-FROM
+FROM
t2, t3, t1 JOIN t2 a1 ON t1.f9 = a1.f4
GROUP BY a4;
DROP TABLE t1, t2, t3, t4;
+
#
-# BUG#36139 "float, zerofill, crash with subquery"
+# Bug#36139 "float, zerofill, crash with subquery"
#
create table t1 (a float(5,4) zerofill);
create table t2 (a float(5,4),b float(2,0));
-select t1.a from t1 where
+select t1.a from t1 where
t1.a= (select b from t2 limit 1) and not
t1.a= (select a from t2 limit 1) ;
drop table t1, t2;
+
#
-# Bug #36011: Server crash with explain extended on query with dependent
-# subqueries
+# Bug#36011 Server crash with explain extended on query with dependent
+# subqueries
#
CREATE TABLE t1 (a INT);
@@ -3295,8 +3362,9 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
DROP TABLE t1;
+
#
-# Bug #38191: Server crash with subquery containing DISTINCT and ORDER BY
+# Bug#38191 Server crash with subquery containing DISTINCT and ORDER BY
#
CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
@@ -3307,14 +3375,16 @@ SELECT * FROM t1
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
DROP TABLE t1,t2;
+
#
# Bug#20835 (literal string with =any values)
#
-CREATE TABLE t1 (s1 char(1));
+CREATE TABLE t1 (s1 CHAR(1));
INSERT INTO t1 VALUES ('a');
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
DROP TABLE t1;
+
#
# Bug#40519 Subselect query using bigint fails
#
@@ -3325,6 +3395,7 @@ INSERT INTO t2 VALUES (2,1),(3,1);
SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
DROP TABLE t1, t2;
+
#
# Bug#37460 Assertion failed:
# !table->file || table->file->inited == handler::NONE
@@ -3338,22 +3409,22 @@ INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id) VALUES (1);
CREATE VIEW v1 AS
- SELECT t2.c AS c FROM t1, t2
- WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+SELECT t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
UPDATE v1 SET c=1;
CREATE VIEW v2 (a,b) AS
- SELECT t2.id, t2.c AS c FROM t1, t2
- WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+SELECT t2.id, t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
---error 1369
+--error ER_VIEW_CHECK_FAILED
INSERT INTO v2(a,b) VALUES (2,2);
INSERT INTO v2(a,b) VALUES (1,2);
SELECT * FROM v1;
CREATE VIEW v3 AS
- SELECT t2.c AS c FROM t2
- WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+SELECT t2.c AS c FROM t2
+WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
DELETE FROM v3;
diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test
index c7696195ee0..aef06245717 100644
--- a/mysql-test/t/synchronization.test
+++ b/mysql-test/t/synchronization.test
@@ -1,10 +1,13 @@
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
#
-# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination
-# table
+# Test for Bug#2385 CREATE TABLE LIKE lacks locking on source and destination
+# table
#
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1,t2;
--enable_warnings
connect (con1,localhost,root,,);
@@ -12,12 +15,12 @@ connect (con2,localhost,root,,);
# locking of source:
-CREATE TABLE t1 (x1 int);
+CREATE TABLE t1 (x1 INT);
let $1= 10;
while ($1)
{
connection con1;
- send ALTER TABLE t1 CHANGE x1 x2 int;
+ send ALTER TABLE t1 CHANGE x1 x2 INT;
connection con2;
CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
@@ -25,7 +28,7 @@ while ($1)
DROP TABLE t2;
connection con1;
reap;
- send ALTER TABLE t1 CHANGE x2 x1 int;
+ send ALTER TABLE t1 CHANGE x2 x1 INT;
connection con2;
CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
@@ -37,4 +40,11 @@ while ($1)
}
DROP TABLE t1;
+connection default;
+disconnect con1;
+disconnect con2;
+
# End of 4.1 tests
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test
index 450c1edc47e..8013f2b04ce 100644
--- a/mysql-test/t/timezone_grant.test
+++ b/mysql-test/t/timezone_grant.test
@@ -1,15 +1,18 @@
# Embedded server testing does not support grants
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
drop tables if exists t1, t2;
drop view if exists v1;
--enable_warnings
#
-# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
-# tables". We should allow implicit access to time zone description tables
-# even for unprivileged users.
+# Test for Bug#6116 SET time_zone := ... requires access to mysql.time_zone tables
+# We should allow implicit access to time zone description tables even for
+# unprivileged users.
#
# Let us prepare playground
@@ -33,18 +36,20 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
# But still these two statements should not work:
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from mysql.time_zone_name;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
+connection default;
+disconnect tzuser;
+
#
-# Test for bug #6765 "Implicit access to time zone description tables
-# requires privileges for them if some table or column level grants
-# present"
+# Bug#6765 Implicit access to time zone description tables requires privileges
+# for them if some table or column level grants present
#
connection default;
-# Let use some table-level grants instead of db-level
+# Let use some table-level grants instead of db-level
# to make life more interesting
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
@@ -61,14 +66,14 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
# Again these two statements should not work (but with different errors):
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from mysql.time_zone_name;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
#
-# Bug #9979: Use of CONVERT_TZ in multiple-table UPDATE causes bogus
-# privilege error
+# Bug#9979 Use of CONVERT_TZ in multiple-table UPDATE causes bogus
+# privilege error
#
drop table t1, t2;
create table t1 (a int, b datetime);
@@ -80,6 +85,7 @@ update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC
# Clean-up
connection default;
+disconnect tzuser2;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
@@ -89,10 +95,9 @@ drop table t1, t2;
# End of 4.1 tests
#
-# Additional test for bug #15153: CONVERT_TZ() is not allowed in all
-# places in views.
+# Additional test for Bug#15153 CONVERT_TZ() is not allowed in all places in views.
#
-# Let us check that usage of CONVERT_TZ() function in view does not
+# Let us check that usage of CONVERT_TZ() function in view does not
# require additional privileges.
# Let us rely on that previous tests done proper cleanups
@@ -109,7 +114,11 @@ drop view v1;
--error ER_TABLEACCESS_DENIED_ERROR
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
connection default;
+disconnect tzuser3;
drop table t1;
drop user mysqltest_1@localhost;
# End of 5.0 tests
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index f2e350cb161..db410ba2f18 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -50,9 +50,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
+CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
#
# Remove definers from TRG file.
@@ -61,8 +59,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+# Here we remove definers. This is somewhat complex than the original test
+# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
+# portable and we have to load the file into a table, exclude the definers line,
+# then load the data to an outfile to accomplish the same effect
+
+--disable_query_log
+--connection default
+CREATE TABLE patch (a blob);
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' INTO TABLE patch;
+# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
+--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
+ '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG'
+FROM patch;
+DROP TABLE patch;
+--connection wl2818_definer_con
+--enable_query_log
+
#
# Create a new trigger.
diff --git a/mysql-test/t/type_bit_innodb.test b/mysql-test/t/type_bit_innodb.test
index dbca69d67f0..e7e66da8927 100644
--- a/mysql-test/t/type_bit_innodb.test
+++ b/mysql-test/t/type_bit_innodb.test
@@ -40,7 +40,9 @@ drop table t1;
create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1;
---error 1062
+# It is not deterministic which duplicate will be seen first
+--replace_regex /(.*Duplicate entry )'.*'( for key.*)/\1''\2/
+--error ER_DUP_ENTRY
alter table t1 add unique (a);
drop table t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 53bcf44061d..3b7b30db6f8 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -267,4 +267,13 @@ select u from t1;
drop table t1;
+#
+# Bug #21205: Different number of digits for float/doble/real in --ps-protocol
+#
+
+CREATE TABLE t1 (f1 DOUBLE);
+INSERT INTO t1 VALUES(-1.79769313486231e+308);
+SELECT f1 FROM t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 44f21abda19..3c792f28d4f 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -933,17 +933,25 @@ SELECT a INTO @v FROM (
SELECT a FROM t1
) alias;
-SELECT a INTO OUTFILE 'union.out.file' FROM (
+--let $outfile = $MYSQLTEST_VARDIR/tmp/union.out.file
+--error 0,1
+--remove_file $outfile
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval SELECT a INTO OUTFILE '$outfile' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
+--remove_file $outfile
-SELECT a INTO DUMPFILE 'union.out.file2' FROM (
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval SELECT a INTO DUMPFILE '$outfile' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
+--remove_file $outfile
#
# INTO will not be allowed in subqueries in version 5.1 and above.
@@ -954,27 +962,42 @@ SELECT a FROM (
SELECT a INTO @v FROM t1
) alias;
-SELECT a FROM (
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval SELECT a FROM (
SELECT a FROM t1
UNION
- SELECT a INTO OUTFILE 'union.out.file3' FROM t1
+ SELECT a INTO OUTFILE '$outfile' FROM t1
) alias;
+--remove_file $outfile
-SELECT a FROM (
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval SELECT a FROM (
SELECT a FROM t1
UNION
- SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
+ SELECT a INTO DUMPFILE '$outfile' FROM t1
) alias;
+--remove_file $outfile
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
-SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
-SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval SELECT a FROM t1 UNION SELECT a INTO OUTFILE '$outfile' FROM t1;
+--remove_file $outfile
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '$outfile' FROM t1;
+--remove_file $outfile
+
--error ER_WRONG_USAGE
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE
-SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
+eval SELECT a INTO OUTFILE '$outfile' FROM t1 UNION SELECT a FROM t1;
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE
-SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
+eval SELECT a INTO DUMPFILE '$outfile' FROM t1 UNION SELECT a FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test
index af0f6545ac4..41af032b97e 100644
--- a/mysql-test/t/user_limits.test
+++ b/mysql-test/t/user_limits.test
@@ -3,9 +3,12 @@
#
# Requires privileges to be enabled
--- source include/not_embedded.inc
+--source include/not_embedded.inc
-# Prepare play-ground
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# Prepare play-ground
--disable_warnings
drop table if exists t1;
--enable_warnings
@@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
connection mqph;
select * from t1;
select * from t1;
---error 1226
+--error ER_USER_LIMIT_REACHED
select * from t1;
connect (mqph2, localhost, mysqltest_1,,);
connection mqph2;
---error 1226
+--error ER_USER_LIMIT_REACHED
select * from t1;
# cleanup
connection default;
@@ -50,12 +53,12 @@ select * from t1;
select * from t1;
delete from t1;
delete from t1;
---error 1226
+--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
connect (muph2, localhost, mysqltest_1,,);
connection muph2;
---error 1226
+--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
# Cleanup
@@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
connection mcph2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error 1226
+--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Old connection is still ok
select * from t1;
@@ -83,7 +86,7 @@ select * from t1;
disconnect mcph1;
disconnect mcph2;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error 1226
+--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Cleanup
connection default;
@@ -101,13 +104,13 @@ connect (muc2, localhost, mysqltest_1,,);
connection muc2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error 1226
+--error ER_USER_LIMIT_REACHED
connect (muc3, localhost, mysqltest_1,,);
# Closing of one of connections should help
disconnect muc1;
connect (muc3, localhost, mysqltest_1,,);
select * from t1;
-# Changing of limit should also help (and immediately)
+# Changing of limit should also help (and immediately)
connection default;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
flush user_resources;
@@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
connection muc4;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error 1226
+--error ER_USER_LIMIT_REACHED
connect (muc5, localhost, mysqltest_1,,);
# Clean up
connection default;
@@ -129,10 +132,10 @@ drop user mysqltest_1@localhost;
select @@session.max_user_connections, @@global.max_user_connections;
# Local max_user_connections variable can't be set directly
# since this limit is per-account
---error 1229
-set session max_user_connections= 2;
+--error ER_GLOBAL_VARIABLE
+set session max_user_connections= 2;
# But it is ok to set global max_user_connections
-set global max_user_connections= 2;
+set global max_user_connections= 2;
select @@session.max_user_connections, @@global.max_user_connections;
# Let us check that global limit works
grant usage on *.* to mysqltest_1@localhost;
@@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
connection muca2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error 1203
+--error ER_TOO_MANY_USER_CONNECTIONS
connect (muca3, localhost, mysqltest_1,,);
# Now we are testing that per-account limit prevails over gloabl limit
connection default;
@@ -154,16 +157,20 @@ connect (muca3, localhost, mysqltest_1,,);
connection muca3;
select @@session.max_user_connections, @@global.max_user_connections;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error 1226
+--error ER_USER_LIMIT_REACHED
connect (muca4, localhost, mysqltest_1,,);
# Cleanup
connection default;
disconnect muca1;
disconnect muca2;
disconnect muca3;
-set global max_user_connections= 0;
+set global max_user_connections= 0;
drop user mysqltest_1@localhost;
--enable_ps_protocol
# Final cleanup
drop table t1;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 60254ad9a1d..424776dfda4 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -150,18 +150,46 @@ select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5);
-show variables like '%alloc%';
-set @@range_alloc_block_size=1024*16;
+--echo
+--echo ==+ Testing %alloc% system variables +==
+--echo ==+ NOTE: These values *must* be a multiple of 1024 +==
+--echo ==+ Other values will be rounded down to nearest multiple +==
+--echo
+--echo ==+ Show initial values +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+--echo ==+ Manipulate variable values +=
+--echo Testing values that are multiples of 1024
+set @@range_alloc_block_size=1024*15+1024;
+set @@query_alloc_block_size=1024*15+1024*2;
+set @@query_prealloc_size=1024*18-1024;
+set @@transaction_alloc_block_size=1024*21-1024*1;
+set @@transaction_prealloc_size=1024*21-2048;
+--echo ==+ Check manipulated values ==+
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+--echo ==+ Manipulate variable values +==
+--echo Testing values that are not 1024 multiples
+set @@range_alloc_block_size=1024*16+1023;
set @@query_alloc_block_size=1024*17+2;
-set @@query_prealloc_size=1024*18;
+set @@query_prealloc_size=1024*18-1023;
set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
-show variables like '%alloc%';
+--echo ==+ Check manipulated values ==+
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
+--echo ==+ Set values back to the default values +==
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
-show variables like '%alloc%';
+--echo ==+ Check the values now that they are reset +==
+SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
+'query_alloc_block_size', 'query_prealloc_size',
+'transaction_alloc_block_size', 'transaction_prealloc_size');
#
# Bug #10904 Illegal mix of collations between
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 2892ee7dd69..6437e546697 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -10,12 +10,12 @@ use test;
#
# create view on nonexistent table
--- error 1146
+-- error ER_NO_SUCH_TABLE
create view v1 (c,d) as select a,b from t1;
create temporary table t1 (a int, b int);
# view on temporary table
--- error 1352
+-- error ER_VIEW_SELECT_TMPTABLE
create view v1 (c) as select b+1 from t1;
drop table t1;
@@ -42,18 +42,18 @@ select * from t1;
select c from v1;
show create table v1;
show create view v1;
--- error 1347
+-- error ER_WRONG_OBJECT
show create view t1;
drop table t1;
# try to use fields from underlying table
--- error 1054
+-- error ER_BAD_FIELD_ERROR
select a from v1;
--- error 1054
+-- error ER_BAD_FIELD_ERROR
select v1.a from v1;
--- error 1054
+-- error ER_BAD_FIELD_ERROR
select b from v1;
--- error 1054
+-- error ER_BAD_FIELD_ERROR
select v1.b from v1;
# view with different algorithms (explain output differs)
@@ -64,9 +64,9 @@ select c from v2;
explain extended select c from v2;
# try to use underlying table fields in VIEW creation process
--- error 1054
+-- error ER_BAD_FIELD_ERROR
create view v3 (c) as select a+1 from v1;
--- error 1054
+-- error ER_BAD_FIELD_ERROR
create view v3 (c) as select b+1 from v1;
@@ -104,7 +104,7 @@ select * from v1;
select * from v2;
# try to create VIEW with name of existing VIEW
--- error 1050
+-- error ER_TABLE_EXISTS_ERROR
create view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a = all (select a from t1) from t1;
# 'or replace' should work in this case
@@ -112,7 +112,7 @@ create or replace view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a
# try to ALTER unexisting VIEW
drop view v2;
--- error 1146
+-- error ER_NO_SUCH_TABLE
alter view v2 as select c, d from v1;
# 'or replace' on unexisting view
@@ -126,15 +126,15 @@ select * from v1;
select * from v2;
# try to drop nonexistent VIEW
--- error 1051
+-- error ER_BAD_TABLE_ERROR
drop view v100;
# try to drop table with DROP VIEW
--- error 1347
+-- error ER_WRONG_OBJECT
drop view t1;
# try to drop VIEW with DROP TABLE
--- error 1051
+-- error ER_BAD_TABLE_ERROR
drop table v1;
# try to drop table with DROP VIEW
@@ -175,7 +175,7 @@ drop table t1;
# syntax compatibility
#
create table t1 (a int);
--- error 1368
+-- error ER_VIEW_NONUPD_CHECK
create view v1 as select distinct a from t1 WITH CHECK OPTION;
create view v1 as select a from t1 WITH CHECK OPTION;
create view v2 as select a from t1 WITH CASCADED CHECK OPTION;
@@ -232,10 +232,10 @@ create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
select is_updatable from information_schema.views where table_name='v2';
select is_updatable from information_schema.views where table_name='v1';
# try to update expression
--- error 1348
+-- error ER_NONUPDATEABLE_COLUMN
update v1 set c=a+c;
# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
update v2 set a=a+c;
# updatable field of updateable view
update v1 set a=a+c;
@@ -254,10 +254,10 @@ insert into t2 values (10), (20);
create view v1 (a,c) as select a, b+1 from t1;
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
# try to update expression
--- error 1348
+-- error ER_NONUPDATEABLE_COLUMN
update t2,v1 set v1.c=v1.a+v1.c where t2.x=v1.a;
# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
update t2,v2 set v2.a=v2.v2.a+c where t2.x=v2.a;
# updatable field of updateable view
update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.a;
@@ -292,7 +292,7 @@ insert into t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
create view v1 (a,c) as select a, b+1 from t1;
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
delete from v2 where c < 4;
# updatable field of updateable view
delete from v1 where c < 4;
@@ -311,7 +311,7 @@ insert into t2 values (1), (2), (3), (4);
create view v1 (a,c) as select a, b+1 from t1;
create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
delete v2 from t2,v2 where t2.x=v2.a;
# updatable field of updateable view
delete v1 from t2,v1 where t2.x=v1.a;
@@ -331,7 +331,7 @@ set updatable_views_with_limit=NO;
update v1 set x=x+1;
update v2 set x=x+1;
update v1 set x=x+1 limit 1;
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
update v2 set x=x+1 limit 1;
set updatable_views_with_limit=YES;
update v1 set x=x+1 limit 1;
@@ -353,13 +353,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
create view v4 (x,y,z) as select c+1, b, a from t1;
create algorithm=temptable view v5 (x,y,z) as select c, b, a from t1;
# try insert to VIEW with fields duplicate
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v3 values (-60,4,30);
# try insert to VIEW with expression in SELECT list
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v4 values (-60,4,30);
# try insert to VIEW using temporary table algorithm
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v5 values (-60,4,30);
insert into v1 values (-60,4,30);
insert into v1 (z,y,x) values (50,6,-100);
@@ -381,13 +381,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
create view v4 (x,y,z) as select c+1, b, a from t1;
create algorithm=temptable view v5 (x,y,z) as select c, b, a from t1;
# try insert to VIEW with fields duplicate
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v3 select c, b, a from t2;
# try insert to VIEW with expression in SELECT list
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v4 select c, b, a from t2;
# try insert to VIEW using temporary table algorithm
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v5 select c, b, a from t2;
insert into v1 select c, b, a from t2;
insert into v1 (z,y,x) select a+20,b+2,-100 from t2;
@@ -424,7 +424,7 @@ create table t1 (a int, primary key(a));
insert into t1 values (1), (2), (3), (200);
create ALGORITHM=TEMPTABLE view v1 (x) as select a from t1;
create view v2 (y) as select x from v1;
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
update v2 set y=10 where y=2;
drop table t1;
drop view v1,v2;
@@ -479,17 +479,17 @@ create table t1 (col1 char(5),col2 char(5));
create view v1 as select * from t1;
drop table t1;
create table t1 (col1 char(5),newcol2 char(5));
--- error 1356
+-- error ER_VIEW_INVALID
insert into v1 values('a','aa');
drop table t1;
--- error 1356
+-- error ER_VIEW_INVALID
select * from v1;
drop view v1;
#
# check of duplication of column names
#
--- error 1060
+-- error ER_DUP_FIELDNAME
create view v1 (a,a) as select 'a','a';
#
@@ -559,7 +559,7 @@ drop table t1;
#
# error on preparation
#
--- error 1096
+-- error ER_NO_TABLES_USED
CREATE VIEW v02 AS SELECT * FROM DUAL;
SHOW TABLES;
@@ -575,7 +575,7 @@ drop view v1;
#
create table t1 (col1 int,col2 char(22));
create view v1 as select * from t1;
--- error 1347
+-- error ER_WRONG_OBJECT
create index i1 on v1 (col1);
drop view v1;
drop table t1;
@@ -735,7 +735,7 @@ create function x1 () returns int return 5;
create table t1 (s1 int);
create view v1 as select x1() from t1;
drop function x1;
--- error 1356
+-- error ER_VIEW_INVALID
select * from v1;
--replace_column 8 # 12 # 13 #
show table status;
@@ -786,10 +786,10 @@ create table t1 (a int);
create view v1 as select a from t1;
create view v3 as select a from t1;
create database mysqltest;
--- error 1450
+-- error ER_FORBID_SCHEMA_CHANGE
rename table v1 to mysqltest.v1;
rename table v1 to v2;
---error 1050
+--error ER_TABLE_EXISTS_ERROR
rename table v3 to v1, v2 to t1;
drop table t1;
drop view v2,v3;
@@ -802,19 +802,19 @@ create view v1 as select 'a',1;
create view v2 as select * from v1 union all select * from v1;
create view v3 as select * from v2 where 1 = (select `1` from v2);
create view v4 as select * from v3;
--- error 1242
+-- error ER_SUBQUERY_NO_1_ROW
select * from v4;
drop view v4, v3, v2, v1;
#
# VIEW over SELECT with prohibited clauses
#
--- error 1350
+-- error ER_VIEW_SELECT_CLAUSE
create view v1 as select 5 into @w;
--- error 1350
+-- error ER_VIEW_SELECT_CLAUSE
create view v1 as select 5 into outfile 'ttt';
create table t1 (a int);
--- error 1350
+-- error ER_VIEW_SELECT_CLAUSE
create view v1 as select a from t1 procedure analyse();
-- error ER_VIEW_SELECT_DERIVED
create view v1 as select 1 from (select 1) as d1;
@@ -839,109 +839,109 @@ create table t2 (col1 int);
create view v1 as select * from t1;
create view v2 as select * from v1;
create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v2 set col1 = (select max(col1) from v1);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v2 set col1 = (select max(col1) from t1);
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update v2 set col1 = (select max(col1) from v2);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v2,t2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t1,t2 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update v1,t2 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t2,v2 set v2.col1 = (select max(col1) from v1) where v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t2,t1 set t1.col1 = (select max(col1) from v1) where t1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t2,v1 set v1.col1 = (select max(col1) from v1) where v1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v2,t2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v1,t2 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update t2,v2 set v2.col1 = (select max(col1) from t1) where v2.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update t2,t1 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update t2,v1 set v1.col1 = (select max(col1) from t1) where v1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update v2,t2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t1,t2 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v1,t2 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t2,v2 set v2.col1 = (select max(col1) from v2) where v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t2,t1 set t1.col1 = (select max(col1) from v2) where t1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t2,v1 set v1.col1 = (select max(col1) from v2) where v1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v3 set v3.col1 = (select max(col1) from v1);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v3 set v3.col1 = (select max(col1) from t1);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update v3 set v3.col1 = (select max(col1) from v2);
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update v3 set v3.col1 = (select max(col1) from v3);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete from v2 where col1 = (select max(col1) from v1);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete from v2 where col1 = (select max(col1) from t1);
--- error 1093
+-- error ER_UPDATE_TABLE_USED
delete from v2 where col1 = (select max(col1) from v2);
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete v2 from v2,t2 where (select max(col1) from v1) > 0 and v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete t1 from t1,t2 where (select max(col1) from v1) > 0 and t1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
delete v1 from v1,t2 where (select max(col1) from v1) > 0 and v1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete v2 from v2,t2 where (select max(col1) from t1) > 0 and v2.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
delete t1 from t1,t2 where (select max(col1) from t1) > 0 and t1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete v1 from v1,t2 where (select max(col1) from t1) > 0 and v1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
delete v2 from v2,t2 where (select max(col1) from v2) > 0 and v2.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete t1 from t1,t2 where (select max(col1) from v2) > 0 and t1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
delete v1 from v1,t2 where (select max(col1) from v2) > 0 and v1.col1 = t2.col1;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from v1));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into t1 values ((select max(col1) from v1));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from v1));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from t1));
--- error 1093
+-- error ER_UPDATE_TABLE_USED
insert into t1 values ((select max(col1) from t1));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from t1));
--- error 1093
+-- error ER_UPDATE_TABLE_USED
insert into v2 values ((select max(col1) from v2));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into t1 values ((select max(col1) from v2));
--- error 1093
+-- error ER_UPDATE_TABLE_USED
insert into v2 values ((select max(col1) from v2));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select max(col1) from v1));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select max(col1) from t1));
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select max(col1) from v2));
-#check with TZ tables in list
--- error 1443
+# check with TZ tables in list
+-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
--- error 1048
+-- error ER_BAD_NULL_ERROR
insert into mysql.time_zone values ('', (select CONVERT_TZ('20050101000000','UTC','MET') from t2));
# temporary table algorithm view should be equal to subquery in the from clause
create algorithm=temptable view v4 as select * from t1;
@@ -957,7 +957,7 @@ drop table t1,t2;
#
create table t1 (s1 int);
create view v1 as select * from t1;
--- error 1347
+-- error ER_WRONG_OBJECT
handler v1 open as xx;
drop view v1;
drop table t1;
@@ -1005,7 +1005,7 @@ create table t2 (a int);
create view v1 as select * from t1;
lock tables t1 read, v1 read;
select * from v1;
--- error 1100
+-- error ER_TABLE_NOT_LOCKED
select * from t2;
drop view v1;
drop table t1, t2;
@@ -1017,7 +1017,7 @@ create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option;
# simple insert
insert into v1 values(1);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v1 values(3);
# simple insert with ignore
insert ignore into v1 values (2),(3),(0);
@@ -1026,7 +1026,7 @@ select * from t1;
delete from t1;
# INSERT SELECT test
insert into v1 SELECT 1;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v1 SELECT 3;
# prepare data for next check
create table t2 (a int);
@@ -1034,9 +1034,9 @@ insert into t2 values (2),(3),(0);
# INSERT SELECT with ignore test
insert ignore into v1 SELECT a from t2;
select * from t1;
-#simple UPDATE test
+# simple UPDATE test
update v1 set a=-1 where a=0;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
update v1 set a=2 where a=1;
select * from t1;
# prepare data for next check
@@ -1063,12 +1063,12 @@ create view v2 as select * from v1 where a > 0 with local check option;
create view v3 as select * from v1 where a > 0 with cascaded check option;
insert into v2 values (1);
insert into v3 values (1);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v2 values (0);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v3 values (0);
insert into v2 values (2);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v3 values (2);
select * from t1;
drop view v3,v2,v1;
@@ -1080,7 +1080,7 @@ drop table t1;
create table t1 (a int, primary key (a));
create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values (1) on duplicate key update a=2;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v1 values (1) on duplicate key update a=2;
insert ignore into v1 values (1) on duplicate key update a=2;
select * from t1;
@@ -1093,13 +1093,13 @@ drop table t1;
create table t1 (s1 int);
create view v1 as select * from t1;
create view v2 as select * from v1;
--- error 1146
+-- error ER_NO_SUCH_TABLE
alter view v1 as select * from v2;
--- error 1146
+-- error ER_NO_SUCH_TABLE
alter view v1 as select * from v1;
--- error 1146
+-- error ER_NO_SUCH_TABLE
create or replace view v1 as select * from v2;
--- error 1146
+-- error ER_NO_SUCH_TABLE
create or replace view v1 as select * from v1;
drop view v2,v1;
drop table t1;
@@ -1134,7 +1134,7 @@ select * from t2;
# check it with check option
alter view v2 as select * from t2 where s1 in (select s1 from t1) with check option;
insert into v2 values (5);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
update v2 set s1 = 1;
insert into t1 values (1);
update v2 set s1 = 1;
@@ -1166,7 +1166,7 @@ drop table t1;
create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0 with local check option;
create view v2 as select * from v1 with cascaded check option;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v2 values (0);
drop view v2, v1;
drop table t1;
@@ -1177,7 +1177,7 @@ drop table t1;
create table t1 (s1 int);
create view v1 as select * from t1 where s1 < 5 with check option;
#single value
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert ignore into v1 values (6);
#several values
insert ignore into v1 values (6),(3);
@@ -1191,7 +1191,7 @@ drop table t1;
create table t1 (s1 tinyint);
create trigger t1_bi before insert on t1 for each row set new.s1 = 500;
create view v1 as select * from t1 where s1 <> 127 with check option;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v1 values (0);
select * from v1;
select * from t1;
@@ -1205,7 +1205,7 @@ drop table t1;
create table t1 (s1 tinyint);
create view v1 as select * from t1 where s1 <> 0;
create view v2 as select * from v1 where s1 <> 1 with cascaded check option;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
insert into v2 values (0);
select * from v2;
select * from t1;
@@ -1218,7 +1218,7 @@ drop table t1;
# fixed length fields
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
load data infile '../std_data_ln/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1;
select * from v1;
@@ -1231,7 +1231,7 @@ drop table t1;
# variable length fields
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
load data infile '../std_data_ln/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
select concat('|',a,'|'), concat('|',b,'|') from v1;
@@ -1247,14 +1247,14 @@ drop table t1;
#
create table t1 (s1 smallint);
create view v1 as select * from t1 where 20 < (select (s1) from t1);
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v1 values (30);
create view v2 as select * from t1;
create view v3 as select * from t1 where 20 < (select (s1) from v2);
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v3 values (30);
create view v4 as select * from v2 where 20 < (select (s1) from t1);
--- error 1471
+-- error ER_NON_INSERTABLE_TABLE
insert into v4 values (30);
drop view v4, v3, v2, v1;
drop table t1;
@@ -1312,7 +1312,7 @@ select * from t2;
# view without primary key
create view v2 (a,b) as select t1.b as a, t2.a as b from t1, t2;
set updatable_views_with_limit=NO;
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
update v2 set a= 10 where a=200 limit 1;
set updatable_views_with_limit=DEFAULT;
# just view selects
@@ -1340,14 +1340,14 @@ create table t2 (a int, primary key (a), b int);
insert into t2 values (1000, 2000);
create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
# inserting into join view without field list
--- error 1394
+-- error ER_VIEW_NO_INSERT_FIELD_LIST
insert into v3 values (1,2);
--- error 1394
+-- error ER_VIEW_NO_INSERT_FIELD_LIST
insert into v3 select * from t2;
# inserting in several tables of join view
--- error 1393
+-- error ER_VIEW_MULTIUPDATE
insert into v3(a,b) values (1,2);
--- error 1393
+-- error ER_VIEW_MULTIUPDATE
insert into v3(a,b) select * from t2;
# correct inserts into join view
insert into v3(a) values (1);
@@ -1358,11 +1358,11 @@ insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a);
select * from t1;
select * from t2;
# try delete from join view
--- error 1395
+-- error ER_VIEW_DELETE_MERGE_VIEW
delete from v3;
--- error 1395
+-- error ER_VIEW_DELETE_MERGE_VIEW
delete v3,t1 from v3,t1;
--- error 1395
+-- error ER_VIEW_DELETE_MERGE_VIEW
delete t1,v3 from t1,v3;
# delete from t1 just to reduce result set size
delete from t1;
@@ -1385,7 +1385,7 @@ drop view v3;
drop tables t1,t2;
#
-# View field names should be case insensitive
+# View field names should be case insensitive
#
create table t1(f1 int);
create view v1 as select f1 from t1;
@@ -1394,7 +1394,7 @@ drop view v1;
drop table t1;
#
-# Resolving view fields in subqueries in VIEW (Bug #6394)
+# Resolving view fields in subqueries in VIEW (Bug#6394)
#
create table t1(c1 int);
create table t2(c2 int);
@@ -1411,7 +1411,7 @@ drop view v2, v1;
drop table t1, t2;
#
-# view over other view setup (BUG#7433)
+# view over other view setup (Bug#7433)
#
CREATE TABLE t1 (C1 INT, C2 INT);
CREATE TABLE t2 (C2 INT);
@@ -1422,10 +1422,10 @@ drop view v2, v1;
drop table t1, t2;
#
-# view and group_concat() (BUG#7116)
+# view and group_concat() (Bug#7116)
#
-create table t1 (col1 char(5),col2 int,col3 int);
-insert into t1 values ('one',10,25), ('two',10,50), ('two',10,50), ('one',20,25), ('one',30,25);
+create table t1 (col1 char(5),col2 int,col3 int);
+insert into t1 values ('one',10,25), ('two',10,50), ('two',10,50), ('one',20,25), ('one',30,25);
create view v1 as select * from t1;
select col1,group_concat(col2,col3) from t1 group by col1;
select col1,group_concat(col2,col3) from v1 group by col1;
@@ -1433,18 +1433,18 @@ drop view v1;
drop table t1;
#
-# Item_ref resolved as view field (BUG#6894)
+# Item_ref resolved as view field (Bug#6894)
#
create table t1 (s1 int, s2 char);
create view v1 as select s1, s2 from t1;
--- error 1054
+-- error ER_BAD_FIELD_ERROR
select s2 from v1 vq1 where 2 = (select count(*) from v1 vq2 having vq1.s2 = vq2.s2);
select s2 from v1 vq1 where 2 = (select count(*) aa from v1 vq2 having vq1.s2 = aa);
drop view v1;
drop table t1;
#
-# Test case for bug #9398 CREATE TABLE with SELECT from a multi-table view
+# Test case for Bug#9398 CREATE TABLE with SELECT from a multi-table view
#
CREATE TABLE t1 (a1 int);
CREATE TABLE t2 (a2 int);
@@ -1460,7 +1460,7 @@ DROP VIEW v1;
DROP TABLE t1,t2,t3;
#
-# Test for BUG#8703 "insert into table select from view crashes"
+# Test for Bug#8703 insert into table select from view crashes
#
create table t1 (a int);
create table t2 like t1;
@@ -1472,84 +1472,84 @@ drop view v1;
drop table t1,t2,t3;
#
-# Test for BUG #6106: query over a view using subquery for the underlying table
-#
-
-CREATE TABLE t1 (col1 int PRIMARY KEY, col2 varchar(10));
-INSERT INTO t1 VALUES(1,'trudy');
-INSERT INTO t1 VALUES(2,'peter');
-INSERT INTO t1 VALUES(3,'sanja');
-INSERT INTO t1 VALUES(4,'monty');
-INSERT INTO t1 VALUES(5,'david');
-INSERT INTO t1 VALUES(6,'kent');
-INSERT INTO t1 VALUES(7,'carsten');
-INSERT INTO t1 VALUES(8,'ranger');
-INSERT INTO t1 VALUES(10,'matt');
-CREATE TABLE t2 (col1 int, col2 int, col3 char(1));
-INSERT INTO t2 VALUES (1,1,'y');
-INSERT INTO t2 VALUES (1,2,'y');
-INSERT INTO t2 VALUES (2,1,'n');
-INSERT INTO t2 VALUES (3,1,'n');
-INSERT INTO t2 VALUES (4,1,'y');
-INSERT INTO t2 VALUES (4,2,'n');
-INSERT INTO t2 VALUES (4,3,'n');
-INSERT INTO t2 VALUES (6,1,'n');
+# Test for Bug#6106 query over a view using subquery for the underlying table
+#
+
+CREATE TABLE t1 (col1 int PRIMARY KEY, col2 varchar(10));
+INSERT INTO t1 VALUES(1,'trudy');
+INSERT INTO t1 VALUES(2,'peter');
+INSERT INTO t1 VALUES(3,'sanja');
+INSERT INTO t1 VALUES(4,'monty');
+INSERT INTO t1 VALUES(5,'david');
+INSERT INTO t1 VALUES(6,'kent');
+INSERT INTO t1 VALUES(7,'carsten');
+INSERT INTO t1 VALUES(8,'ranger');
+INSERT INTO t1 VALUES(10,'matt');
+CREATE TABLE t2 (col1 int, col2 int, col3 char(1));
+INSERT INTO t2 VALUES (1,1,'y');
+INSERT INTO t2 VALUES (1,2,'y');
+INSERT INTO t2 VALUES (2,1,'n');
+INSERT INTO t2 VALUES (3,1,'n');
+INSERT INTO t2 VALUES (4,1,'y');
+INSERT INTO t2 VALUES (4,2,'n');
+INSERT INTO t2 VALUES (4,3,'n');
+INSERT INTO t2 VALUES (6,1,'n');
INSERT INTO t2 VALUES (8,1,'y');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT a.col1,a.col2,b.col2,b.col3
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT a.col1,a.col2,b.col2,b.col3
FROM t1 a LEFT JOIN t2 b ON a.col1=b.col1
- WHERE b.col2 IS NULL OR
+ WHERE b.col2 IS NULL OR
b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
-SELECT a.col1,a.col2,b.col2,b.col3
+SELECT a.col1,a.col2,b.col2,b.col3
FROM v1 a LEFT JOIN t2 b ON a.col1=b.col1
- WHERE b.col2 IS NULL OR
+ WHERE b.col2 IS NULL OR
b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
-CREATE VIEW v2 AS SELECT * FROM t2;
+CREATE VIEW v2 AS SELECT * FROM t2;
SELECT a.col1,a.col2,b.col2,b.col3
FROM v2 b RIGHT JOIN v1 a ON a.col1=b.col1
WHERE b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1);
+ b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1);
-# Tests from the report for bug #6107
+# Tests from the report for Bug#6107
SELECT a.col1,a.col2,b.col2,b.col3
FROM v2 b RIGHT JOIN v1 a ON a.col1=b.col1
WHERE a.col1 IN (1,5,9) AND
(b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1));
+ b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1));
CREATE VIEW v3 AS SELECT * FROM t1 WHERE col1 IN (1,5,9);
SELECT a.col1,a.col2,b.col2,b.col3
FROM v2 b RIGHT JOIN v3 a ON a.col1=b.col1
WHERE b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1);
-
+ b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1);
+
DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
#
-# BUG#8490 Select from views containing subqueries causes server to hang
-# forever.
+# Bug#8490 Select from views containing subqueries causes server to hang
+# forever.
#
create table t1 as select 1 A union select 2 union select 3;
create table t2 as select * from t1;
create view v1 as select * from t1 where a in (select * from t2);
select * from v1 A, v1 B where A.a = B.a;
create table t3 as select a a,a b from t2;
-create view v2 as select * from t3 where
+create view v2 as select * from t3 where
a in (select * from t1) or b in (select * from t2);
select * from v2 A, v2 B where A.a = B.b;
drop view v1, v2;
drop table t1, t2, t3;
#
-# Test case for bug #8528: select from view over multi-table view
+# Test case for Bug#8528 select from view over multi-table view
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
@@ -1565,7 +1565,7 @@ DROP VIEW v2,v1;
DROP TABLE t1, t2;
#
-# Correct restoring view name in SP table locking BUG#9758
+# Correct restoring view name in SP table locking Bug#9758
#
create table t1 (a int);
create view v1 as select sum(a) from t1 group by a;
@@ -1594,7 +1594,7 @@ SELECT d, c FROM v1 ORDER BY d,c;
DROP VIEW v1;
DROP TABLE t1, t2;
#
-# using sum(distinct ) & avg(distinct ) in views (BUG#7015)
+# using sum(distinct ) & avg(distinct ) in views (Bug#7015)
#
create table t1 (s1 int);
create view v1 as select sum(distinct s1) from t1;
@@ -1606,14 +1606,14 @@ drop view v1;
drop table t1;
#
-# using cast(... as decimal) in views (BUG#11387);
+# using cast(... as decimal) in views (Bug#11387);
#
create view v1 as select cast(1 as decimal);
select * from v1;
drop view v1;
#
-# Bug#11298 insert into select from VIEW produces incorrect result when
+# Bug#11298 insert into select from VIEW produces incorrect result when
# using ORDER BY
create table t1(f1 int);
create table t2(f2 int);
@@ -1627,7 +1627,7 @@ drop view v1;
drop table t1,t2,t3;
#
-# Generation unique names for columns, and correct names check (BUG#7448)
+# Generation unique names for columns, and correct names check (Bug#7448)
#
# names with ' and \
create view v1 as select '\\','\\shazam';
@@ -1670,24 +1670,24 @@ create view v1 as select 's1', 's1', s1 from t1;
select * from v1;
drop view v1;
# underlying field name conflict with set name
--- error 1060
+-- error ER_DUP_FIELDNAME
create view v1 as select 1 as s1, 's1', s1 from t1;
--- error 1060
+-- error ER_DUP_FIELDNAME
create view v1 as select 's1', s1, 1 as s1 from t1;
drop table t1;
# set names differ by case only
--- error 1060
+-- error ER_DUP_FIELDNAME
create view v1(k, K) as select 1,2;
#
-# using time_format in view (BUG#7521)
+# using time_format in view (Bug#7521)
#
create view v1 as SELECT TIME_FORMAT(SEC_TO_TIME(3600),'%H:%i') as t;
select * from v1;
drop view v1;
#
-# evaluation constant functions in WHERE (BUG#4663)
+# evaluation constant functions in WHERE (Bug#4663)
#
create table t1 (a timestamp default now());
create table t2 (b timestamp default now());
@@ -1708,7 +1708,7 @@ DROP VIEW v1;
DROP TABLE t1;
#
-# checking views after some view with error (BUG#11337)
+# checking views after some view with error (Bug#11337)
#
CREATE TABLE t1 (col1 time);
CREATE TABLE t2 (col1 time);
@@ -1749,7 +1749,7 @@ drop view v1, v2, v3, v4, v5, v6;
drop table t2,t3;
#
-# bug #11325 Wrong date comparison in views
+# Bug#11325 Wrong date comparison in views
#
create table t1 (f1 date);
insert into t1 values ('2005-01-01'),('2005-02-02');
@@ -1760,7 +1760,7 @@ drop view v1;
drop table t1;
#
-# using encrypt & substring_index in view (BUG#7024)
+# using encrypt & substring_index in view (Bug#7024)
#
CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd");
disable_result_log;
@@ -1772,21 +1772,21 @@ SELECT * FROM v1;
drop view v1;
#
-# hide underlying tables names in case of imposibility to update (BUG#10773)
+# hide underlying tables names in case of imposibility to update (Bug#10773)
#
create table t1 (f59 int, f60 int, f61 int);
insert into t1 values (19,41,32);
-create view v1 as select f59, f60 from t1 where f59 in
+create view v1 as select f59, f60 from t1 where f59 in
(select f59 from t1);
--- error 1288
+-- error ER_NON_UPDATABLE_TABLE
update v1 set f60=2345;
--- error 1443
+-- error ER_VIEW_PREVENT_UPDATE
update t1 set f60=(select max(f60) from v1);
drop view v1;
drop table t1;
#
-# Using var_samp with view (BUG#10651)
+# Using var_samp with view (Bug#10651)
#
create table t1 (s1 int);
create view v1 as select var_samp(s1) from t1;
@@ -1794,24 +1794,26 @@ show create view v1;
drop view v1;
drop table t1;
+
#
# Correct inserting data check (absence of default value) for view
-# underlying tables (BUG#6443)
+# underlying tables (Bug#6443)
#
set sql_mode='strict_all_tables';
CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL);
CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1;
CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2;
--- error 1364
+-- error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (col1) VALUES(12);
--- error 1423
+-- error ER_NO_DEFAULT_FOR_VIEW_FIELD
INSERT INTO v1 (vcol1) VALUES(12);
--- error 1423
+-- error ER_NO_DEFAULT_FOR_VIEW_FIELD
INSERT INTO v2 (vcol1) VALUES(12);
set sql_mode=default;
drop view v2,v1;
drop table t1;
+
#
# Bug#11399 Use an alias in a select statement on a view
#
@@ -1822,8 +1824,9 @@ select f1 as alias from v1;
drop view v1;
drop table t1;
+
#
-# Test for bug #6120: SP cache to be invalidated when altering a view
+# Test for Bug#6120 SP cache to be invalidated when altering a view
#
CREATE TABLE t1 (s1 int, s2 int);
@@ -1842,8 +1845,9 @@ DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Test for bug #11709 View was ordered by wrong column
+# Test for Bug#11709 View was ordered by wrong column
#
create table t1 (f1 int, f2 int);
create view v1 as select f1 as f3, f2 as f1 from t1;
@@ -1852,8 +1856,9 @@ select * from v1 order by f1;
drop view v1;
drop table t1;
+
#
-# Test for bug #11771: wrong query_id in SELECT * FROM <view>
+# Test for Bug#11771 wrong query_id in SELECT * FROM <view>
#
CREATE TABLE t1 (f1 char);
INSERT INTO t1 VALUES ('A');
@@ -1866,8 +1871,9 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# opening table in correct locking mode (BUG#9597)
+# opening table in correct locking mode (Bug#9597)
#
CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL);
CREATE OR REPLACE VIEW v1 AS SELECT * from t1;
@@ -1884,8 +1890,9 @@ DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #11335 View redefines column types
+# Bug#11335 View redefines column types
#
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
@@ -1893,8 +1900,9 @@ desc v1;
drop view v1;
drop table t1;
+
#
-# Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned
+# Bug#11760 Typo in Item_func_add_time::print() results in NULLs returned
# subtime() in view
create table t1(f1 datetime);
insert into t1 values('2005.01.01 12:0:0');
@@ -1903,8 +1911,9 @@ select * from v1;
drop view v1;
drop table t1;
+
#
-# Test for bug #11412: query over a multitable view with GROUP_CONCAT
+# Test for Bug#11412 query over a multitable view with GROUP_CONCAT
#
CREATE TABLE t1 (
aid int PRIMARY KEY,
@@ -1920,15 +1929,16 @@ INSERT INTO t2 values (1,1), (2,1), (2,2);
CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid;
-SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
+SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
WHERE t1.aid = t2.aid GROUP BY pid;
SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
DROP VIEW v1;
DROP TABLE t1,t2;
+
#
-# Test for bug #12382: SELECT * FROM view after INSERT command
+# Test for Bug#12382 SELECT * FROM view after INSERT command
#
CREATE TABLE t1 (id int PRIMARY KEY, f varchar(255));
@@ -1942,9 +1952,10 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Test for bug #12470: crash for a simple select from a view defined
-# as a join over 5 tables
+# Test for Bug#12470 crash for a simple select from a view defined
+# as a join over 5 tables
CREATE TABLE t1 (pk int PRIMARY KEY, b int);
CREATE TABLE t2 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
@@ -1961,27 +1972,29 @@ SELECT a FROM v1;
DROP VIEW v1;
DROP TABLE t1,t2,t3,t4,t5;
+
#
-# Bug #12298 Typo in function name results in erroneous view being created.
+# Bug#12298 Typo in function name results in erroneous view being created.
#
create view v1 as select timestampdiff(day,'1997-01-01 00:00:00','1997-01-02 00:00:00') as f1;
select * from v1;
drop view v1;
#
-# repeatable CREATE VIEW statement BUG#12468
+# repeatable CREATE VIEW statement Bug#12468
#
create table t1(a int);
create procedure p1() create view v1 as select * from t1;
drop table t1;
--- error 1146
+-- error ER_NO_SUCH_TABLE
call p1();
--- error 1146
+-- error ER_NO_SUCH_TABLE
call p1();
drop procedure p1;
+
#
-# Bug #10624 Views with multiple UNION and UNION ALL produce incorrect results
+# Bug#10624 Views with multiple UNION and UNION ALL produce incorrect results
#
create table t1 (f1 int);
create table t2 (f1 int);
@@ -1991,20 +2004,23 @@ create view v1 as select * from t1 union select * from t2 union all select * fro
select * from v1;
drop view v1;
drop table t1,t2;
+
+
+#
+# Test for Bug#10970 view referring a temporary table indirectly
#
-# Test for bug #10970: view referring a temporary table indirectly
-#
CREATE TEMPORARY TABLE t1 (a int);
CREATE FUNCTION f1 () RETURNS int RETURN (SELECT COUNT(*) FROM t1);
--- error 1352
+-- error ER_VIEW_SELECT_TMPTABLE
CREATE VIEW v1 AS SELECT f1();
DROP FUNCTION f1;
DROP TABLE t1;
+
#
-# BUG #12533 (crash on DESCRIBE <view> after renaming base table column)
+# Bug#12533 (crash on DESCRIBE <view> after renaming base table column)
#
--disable_warnings
DROP TABLE IF EXISTS t1;
@@ -2016,13 +2032,14 @@ CREATE VIEW v1 AS SELECT * FROM t1;
DESCRIBE v1;
ALTER TABLE t1 CHANGE COLUMN f4 f4x CHAR(5);
---error 1356
+--error ER_VIEW_INVALID
DESCRIBE v1;
DROP TABLE t1;
DROP VIEW v1;
-#
-# Bug #12489 wrongly printed strcmp() function results in creation of broken
+
+#
+# Bug#12489 wrongly printed strcmp() function results in creation of broken
# view
create table t1 (f1 char);
create view v1 as select strcmp(f1,'a') from t1;
@@ -2030,8 +2047,9 @@ select * from v1;
drop view v1;
drop table t1;
+
#
-# Bug #12922 if(sum(),...) with group from view returns wrong results
+# Bug#12922 if(sum(),...) with group from view returns wrong results
#
create table t1 (f1 int, f2 int,f3 int);
insert into t1 values (1,10,20),(2,0,0);
@@ -2039,7 +2057,9 @@ create view v1 as select * from t1;
select if(sum(f1)>1,f2,f3) from v1 group by f1;
drop view v1;
drop table t1;
-# BUG#12941
+
+
+# Bug#12941
#
--disable_warnings
create table t1 (
@@ -2049,7 +2069,7 @@ create table t1 (
create table t2 (
r_object_id char(16) NOT NULL,
- i_position int(11) NOT NULL,
+ i_position int(11) NOT NULL,
users_names varchar(32) default NULL
) Engine = InnoDB;
--enable_warnings
@@ -2067,22 +2087,24 @@ insert into t2 values('120001a080000542',-1, 'guser01');
insert into t2 values('120001a080000542',-2, 'guser02');
select v1.r_object_id, v2.users_names from v1, v2
-where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
+where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
order by users_names;
drop view v1, v2;
drop table t1, t2;
-# Bug #6808 - Views: CREATE VIEW v ... FROM t AS v fails
+
+# Bug#6808 Views: CREATE VIEW v ... FROM t AS v fails
#
-create table t1 (s1 int);
+create table t1 (s1 int);
create view abc as select * from t1 as abc;
drop table t1;
drop view abc;
+
#
-# Bug #12993 View column rename broken in subselect
+# Bug#12993 View column rename broken in subselect
#
create table t1(f1 char(1));
create view v1 as select * from t1;
@@ -2090,15 +2112,17 @@ select * from (select f1 as f2 from v1) v where v.f2='a';
drop view v1;
drop table t1;
+
#
-# Bug #11416 Server crash if using a view that uses function convert_tz
+# Bug#11416 Server crash if using a view that uses function convert_tz
#
create view v1 as SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
select * from v1;
drop view v1;
+
#
-# Bugs #12963, #13000: wrong creation of VIEW with DAYNAME, DAYOFWEEK, and WEEKDAY
+# Bugs#12963, #13000 wrong creation of VIEW with DAYNAME, DAYOFWEEK, and WEEKDAY
#
CREATE TABLE t1 (date DATE NOT NULL);
@@ -2128,8 +2152,9 @@ SELECT * FROM v3;
DROP TABLE t1;
DROP VIEW v1, v2, v3;
+
#
-# Bug #13411: crash when using non-qualified view column in HAVING clause
+# Bug#13411 crash when using non-qualified view column in HAVING clause
#
CREATE TABLE t1 ( a int, b int );
@@ -2141,8 +2166,9 @@ SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #13410: failed name resolution for qualified view column in HAVING
+# Bug#13410 failed name resolution for qualified view column in HAVING
#
CREATE TABLE t1 ( a int, b int );
@@ -2156,8 +2182,9 @@ SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3);
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #13327 view wasn't using index for const condition
+# Bug#13327 view wasn't using index for const condition
#
CREATE TABLE t1 (a INT, b INT, INDEX(a,b));
@@ -2174,8 +2201,9 @@ EXPLAIN SELECT * FROM v2 WHERE a=1;
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3;
+
#
-# Bug #13622 Wrong view .frm created if some field's alias contain \n
+# Bug#13622 Wrong view .frm created if some field's alias contain \n
#
create table t1 (f1 int);
create view v1 as select t1.f1 as '123
@@ -2184,7 +2212,8 @@ select * from v1;
drop view v1;
drop table t1;
-# Bug #14466 lost sort order in GROUP_CONCAT() in a view
+
+# Bug#14466 lost sort order in GROUP_CONCAT() in a view
#
create table t1 (f1 int, f2 int);
insert into t1 values(1,1),(1,2),(1,3);
@@ -2195,8 +2224,9 @@ select * from v2;
drop view v1,v2;
drop table t1;
+
#
-# BUG#14026 Crash on second PS execution when using views
+# Bug#14026 Crash on second PS execution when using views
#
create table t1 (x int, y int);
create table t2 (x int, y int, z int);
@@ -2206,8 +2236,8 @@ create table t4 (x int, y int, z int);
create view v1 as
select t1.x
from (
- (t1 join t2 on ((t1.y = t2.y)))
- join
+ (t1 join t2 on ((t1.y = t2.y)))
+ join
(t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
);
@@ -2219,8 +2249,9 @@ execute stmt1 using @parm1;
drop view v1;
drop table t1,t2,t3,t4;
+
#
-# Bug #14540: OPTIMIZE, ANALYZE, REPAIR applied to not a view
+# Bug#14540 OPTIMIZE, ANALYZE, REPAIR applied to not a view
#
CREATE TABLE t1(id INT);
@@ -2239,7 +2270,7 @@ DROP VIEW v1;
#
-# BUG#14719: Views DEFINER grammar is incorrect
+# Bug#14719 Views DEFINER grammar is incorrect
#
create definer = current_user() sql security invoker view v1 as select 1;
@@ -2250,8 +2281,9 @@ create definer = current_user sql security invoker view v1 as select 1;
show create view v1;
drop view v1;
+
#
-# Bug #14816 test_if_order_by_key() expected only Item_fields.
+# Bug#14816 test_if_order_by_key() expected only Item_fields.
#
create table t1 (id INT, primary key(id));
insert into t1 values (1),(2);
@@ -2260,8 +2292,9 @@ explain select id from v1 order by id;
drop view v1;
drop table t1;
+
#
-# Bug #14850 Item_ref's values wasn't updated
+# Bug#14850 Item_ref's values wasn't updated
#
create table t1(f1 int, f2 int);
insert into t1 values (null, 10), (null,2);
@@ -2271,8 +2304,9 @@ select f1, sum(f2) from v1 group by f1;
drop view v1;
drop table t1;
+
#
-# BUG#14885: incorrect SOURCE in view created in a procedure
+# Bug#14885 incorrect SOURCE in view created in a procedure
# TODO: here SOURCE string must be shown when it will be possible
#
--disable_warnings
@@ -2290,8 +2324,9 @@ show create view v1;
drop view v1;
drop procedure p1;
+
#
-# BUG#15096: using function with view for view creation
+# Bug#15096 using function with view for view creation
#
CREATE VIEW v1 AS SELECT 42 AS Meaning;
--disable_warnings
@@ -2311,8 +2346,9 @@ select * from v2;
drop view v2,v1;
drop function f1;
+
#
-# Bug#14861: aliased column names are not preserved.
+# Bug#14861 aliased column names are not preserved.
#
create table t1 (id numeric, warehouse_id numeric);
create view v1 as select id from t1;
@@ -2330,8 +2366,9 @@ order by v2.receipt_id;
drop view v2, v1;
drop table t1;
+
#
-# Bug#16016: MIN/MAX optimization for views
+# Bug#16016 MIN/MAX optimization for views
#
CREATE TABLE t1 (a int PRIMARY KEY, b int);
@@ -2354,9 +2391,10 @@ EXPLAIN SELECT MIN(a) FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug#16382: grouping name is resolved against a view column name
-# which coincides with a select column name
+# Bug#16382 grouping name is resolved against a view column name
+# which coincides with a select column name
CREATE TABLE t1 (x varchar(10));
INSERT INTO t1 VALUES (null), ('foo'), ('bar'), (null);
@@ -2371,21 +2409,23 @@ SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# BUG#15943: mysql_next_result hangs on invalid SHOW CREATE VIEW
+# Bug#15943 mysql_next_result hangs on invalid SHOW CREATE VIEW
#
delimiter //;
-drop table if exists t1;
-drop view if exists v1;
-create table t1 (id int);
-create view v1 as select * from t1;
-drop table t1;
-show create view v1;
+drop table if exists t1;
+drop view if exists v1;
+create table t1 (id int);
+create view v1 as select * from t1;
+drop table t1;
+show create view v1;
drop view v1;
//
delimiter ;//
+
#
# Bug#17726 Not checked empty list caused endless loop
#
@@ -2400,9 +2440,10 @@ select * from v2;
drop view v2, v1;
drop table t1;
+
#
-# Bug #18386: select from view over a table with ORDER BY view_col clause
-# given view_col is not an image of any column from the base table
+# Bug#18386 select from view over a table with ORDER BY view_col clause
+# given view_col is not an image of any column from the base table
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1), (2);
@@ -2414,9 +2455,10 @@ SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
DROP VIEW v1;
DROP TABLE t1;
+
+#
+# Bug#18237 invalid count optimization applied to an outer join with a view
#
-# Bug #18237: invalid count optimization applied to an outer join with a view
-#
CREATE TABLE t1 (id int PRIMARY KEY);
CREATE TABLE t2 (id int PRIMARY KEY);
@@ -2435,14 +2477,15 @@ DROP VIEW v2;
DROP TABLE t1, t2;
+
#
-# Bug #16069: VIEW does return the same results as underlying SELECT
-# with WHERE condition containing BETWEEN over dates
+# Bug#16069 VIEW does return the same results as underlying SELECT
+# with WHERE condition containing BETWEEN over dates
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
td date DEFAULT NULL, KEY idx(td));
-INSERT INTO t1 VALUES
+INSERT INTO t1 VALUES
(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
@@ -2455,8 +2498,9 @@ SELECT * FROM v1 WHERE td BETWEEN CAST('2005.01.02' AS DATE) AND CAST('2005.01.0
DROP VIEW v1;
DROP TABLE t1;
+
#
-# BUG#14308: Recursive view definitions
+# Bug#14308 Recursive view definitions
#
# using view only
create table t1 (a int);
@@ -2486,8 +2530,9 @@ select * from v1;
drop function f1;
drop view t1, v1;
+
#
-# Bug #15153: CONVERT_TZ() is not allowed in all places in VIEWs
+# Bug#15153 CONVERT_TZ() is not allowed in all places in VIEWs
#
# Error was reported when one tried to use CONVERT_TZ() function
# select list of view which was processed using MERGE algorithm.
@@ -2498,7 +2543,7 @@ insert into t1 values (20040101000000), (20050101000000), (20060101000000);
create view v1 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from t1;
select * from v1;
drop view v1;
-# And in its where part
+# And in its where part
create view v1 as select * from t1 where convert_tz(dt, 'UTC', 'Europe/Moscow') >= 20050101000000;
select * from v1;
# Other interesting case - a view which uses convert_tz() function
@@ -2513,9 +2558,10 @@ select * from v2;
drop view v1, v2;
drop table t1;
+
#
-# Bug #19490: usage of view specified by a query with GROUP BY
-# an expression containing non-constant interval
+# Bug#19490 usage of view specified by a query with GROUP BY
+# an expression containing non-constant interval
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, d datetime);
@@ -2529,8 +2575,9 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug#19077: A nested materialized view is used before being populated.
+# Bug#19077 A nested materialized view is used before being populated.
#
CREATE TABLE t1 (i INT, j BIGINT);
INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
@@ -2540,9 +2587,10 @@ SELECT * FROM v2;
DROP VIEW v2, v1;
DROP TABLE t1;
+
+#
+# Bug#19573 VIEW with HAVING that refers an alias name
#
-# Bug #19573: VIEW with HAVING that refers an alias name
-#
CREATE TABLE t1(
fName varchar(25) NOT NULL,
@@ -2550,7 +2598,7 @@ CREATE TABLE t1(
DOB date NOT NULL,
test_date date NOT NULL,
uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
-
+
INSERT INTO t1(fName, lName, DOB, test_date) VALUES
('Hank', 'Hill', '1964-09-29', '2007-01-01'),
('Tom', 'Adams', '1908-02-14', '2007-01-01'),
@@ -2558,8 +2606,8 @@ INSERT INTO t1(fName, lName, DOB, test_date) VALUES
CREATE VIEW v1 AS
SELECT (year(test_date)-year(DOB)) AS Age
- FROM t1 HAVING Age < 75;
-SHOW CREATE VIEW v1;
+ FROM t1 HAVING Age < 75;
+SHOW CREATE VIEW v1;
SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
SELECT * FROM v1;
@@ -2567,8 +2615,9 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #19089: wrong inherited dafault values in temp table views
+# Bug#19089 wrong inherited dafault values in temp table views
#
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
@@ -2600,7 +2649,7 @@ DROP TABLE t1,t2;
#
-# Bug#16110: insert permitted into view col w/o default value
+# Bug#16110 insert permitted into view col w/o default value
#
CREATE TABLE t1 (a INT NOT NULL, b INT NULL DEFAULT NULL);
CREATE VIEW v1 AS SELECT a, b FROM t1;
@@ -2608,7 +2657,7 @@ CREATE VIEW v1 AS SELECT a, b FROM t1;
INSERT INTO v1 (b) VALUES (2);
SET SQL_MODE = STRICT_ALL_TABLES;
---error 1423
+--error ER_NO_DEFAULT_FOR_VIEW_FIELD
INSERT INTO v1 (b) VALUES (4);
SET SQL_MODE = '';
@@ -2617,8 +2666,9 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #18243: expression over a view column that with the REVERSE function
+# Bug#18243 expression over a view column that with the REVERSE function
#
CREATE TABLE t1 (firstname text, surname text);
@@ -2633,21 +2683,23 @@ SELECT CONCAT(LEFT(name,LENGTH(name)-INSTR(REVERSE(name)," ")),
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #19714: wrong type of a view column specified by an expressions over ints
+# Bug#19714 wrong type of a view column specified by an expressions over ints
#
CREATE TABLE t1 (i int, j int);
CREATE VIEW v1 AS SELECT COALESCE(i,j) FROM t1;
DESCRIBE v1;
-CREATE TABLE t2 SELECT COALESCE(i,j) FROM t1;
+CREATE TABLE t2 SELECT COALESCE(i,j) FROM t1;
DESCRIBE t2;
DROP VIEW v1;
DROP TABLE t1,t2;
+
#
-# Bug #17526: views with TRIM functions
+# Bug#17526 views with TRIM functions
#
CREATE TABLE t1 (s varchar(10));
@@ -2658,20 +2710,21 @@ CREATE VIEW v1 AS SELECT TRIM(BOTH 'y' FROM s) FROM t1;
SELECT * FROM v1;
DROP VIEW v1;
-SELECT TRIM(LEADING 'y' FROM s) FROM t1;
+SELECT TRIM(LEADING 'y' FROM s) FROM t1;
CREATE VIEW v1 AS SELECT TRIM(LEADING 'y' FROM s) FROM t1;
SELECT * FROM v1;
DROP VIEW v1;
-SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
+SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
CREATE VIEW v1 AS SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-#Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
+# Bug#21080 ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
#
CREATE TABLE t1 (x INT, y INT);
CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
@@ -2682,8 +2735,10 @@ SHOW CREATE VIEW v1;
DROP VIEW v1;
DROP TABLE t1;
-# Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE
-# clause is called
+
+
+# Bug#21086 server crashes when VIEW defined with a SELECT with COLLATE
+# clause is called
#
CREATE TABLE t1 (s1 char);
INSERT INTO t1 VALUES ('Z');
@@ -2700,19 +2755,20 @@ SELECT s1 FROM t1;
DROP VIEW v1, v2;
DROP TABLE t1;
+
#
-# Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
+# Bug#11551 Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
#
CREATE TABLE t1 (id INT);
CREATE VIEW v1 AS SELECT id FROM t1;
SHOW TABLES;
---error 1051
+--error ER_BAD_TABLE_ERROR
DROP VIEW v2,v1;
SHOW TABLES;
CREATE VIEW v1 AS SELECT id FROM t1;
---error 1347
+--error ER_WRONG_OBJECT
DROP VIEW t1,v1;
SHOW TABLES;
@@ -2721,13 +2777,14 @@ DROP TABLE t1;
DROP VIEW IF EXISTS v1;
--enable_warnings
+
#
-# Bug #21261: Wrong access rights was required for an insert to a view
+# Bug#21261 Wrong access rights was required for an insert to a view
#
CREATE DATABASE bug21261DB;
USE bug21261DB;
-CONNECT (root,localhost,root,,bug21261DB);
-CONNECTION root;
+connect (root,localhost,root,,bug21261DB);
+connection root;
CREATE TABLE t1 (x INT);
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
@@ -2736,34 +2793,41 @@ GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE TABLE t2 (y INT);
GRANT SELECT ON t2 TO 'user21261'@'localhost';
-CONNECT (user21261, localhost, user21261,, bug21261DB);
-CONNECTION user21261;
+connect (user21261, localhost, user21261,, bug21261DB);
+connection user21261;
INSERT INTO v1 (x) VALUES (5);
UPDATE v1 SET x=1;
-CONNECTION root;
+connection root;
GRANT SELECT ON v1 TO 'user21261'@'localhost';
GRANT SELECT ON t1 TO 'user21261'@'localhost';
-CONNECTION user21261;
+connection user21261;
UPDATE v1,t2 SET x=1 WHERE x=y;
-CONNECTION root;
+connection root;
SELECT * FROM t1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
DROP USER 'user21261'@'localhost';
DROP VIEW v1;
DROP TABLE t1;
DROP DATABASE bug21261DB;
+
+connection default;
USE test;
+disconnect root;
+disconnect user21261;
+
#
-# Bug #15950: NOW() optimized away in VIEWs
+# Bug#15950 NOW() optimized away in VIEWs
#
create table t1 (f1 datetime);
create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
show create view v1;
drop view v1;
drop table t1;
+
+
#
-# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
+# Test for Bug#16899 Possible buffer overflow in handling of DEFINER-clause.
#
# Prepare.
@@ -2790,8 +2854,7 @@ DROP TABLE t1;
#
-# BUG#17591: Updatable view not possible with trigger or stored
-# function
+# Bug#17591 Updatable view not possible with trigger or stored function
#
# During prelocking phase we didn't update lock type of view tables,
# hence READ lock was always requested.
@@ -2835,11 +2898,12 @@ DROP FUNCTION f2;
DROP VIEW v1, v2;
DROP TABLE t1;
+
#
-# Bug #5500: wrong select_type in EXPLAIN output for queries over views
+# Bug#5500 wrong select_type in EXPLAIN output for queries over views
#
-CREATE TABLE t1 (s1 int);
+CREATE TABLE t1 (s1 int);
CREATE VIEW v1 AS SELECT * FROM t1;
EXPLAIN SELECT * FROM t1;
@@ -2847,34 +2911,36 @@ EXPLAIN SELECT * FROM v1;
INSERT INTO t1 VALUES (1), (3), (2);
-EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
-EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
+EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
+EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #5505: Wrong error message on INSERT into a view
+# Bug#5505 Wrong error message on INSERT into a view
#
create table t1 (s1 int);
create view v1 as select s1 as a, s1 as b from t1;
---error 1471
-insert into v1 values (1,1);
+--error ER_NON_INSERTABLE_TABLE
+insert into v1 values (1,1);
update v1 set a = 5;
drop view v1;
drop table t1;
+
#
-# Bug #21646: view qith a subquery in ON expression
+# Bug#21646 view qith a subquery in ON expression
#
-CREATE TABLE t1(pk int PRIMARY KEY);
+CREATE TABLE t1(pk int PRIMARY KEY);
CREATE TABLE t2(pk int PRIMARY KEY, fk int, ver int, org int);
-CREATE ALGORITHM=MERGE VIEW v1 AS
+CREATE ALGORITHM=MERGE VIEW v1 AS
SELECT t1.*
- FROM t1 JOIN t2
- ON t2.fk = t1.pk AND
+ FROM t1 JOIN t2
+ ON t2.fk = t1.pk AND
t2.ver = (SELECT MAX(t.ver) FROM t2 t WHERE t.org = t2.org);
SHOW WARNINGS;
SHOW CREATE VIEW v1;
@@ -2884,8 +2950,7 @@ DROP TABLE t1, t2;
#
-# Bug#19111: TRIGGERs selecting from a VIEW on the firing base table
-# fail
+# Bug#19111 TRIGGERs selecting from a VIEW on the firing base table fail
#
# Allow to select from a view on a table being modified in a trigger
# and stored function, since plain select is allowed there.
@@ -2916,23 +2981,24 @@ DROP FUNCTION f1;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #16813 (WITH CHECK OPTION doesn't work with UPDATE)
+# Bug#16813 (WITH CHECK OPTION doesn't work with UPDATE)
#
CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
INSERT INTO v1 (val) VALUES (2);
INSERT INTO v1 (val) VALUES (4);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
INSERT INTO v1 (val) VALUES (6);
--- error 1369
+-- error ER_VIEW_CHECK_FAILED
UPDATE v1 SET val=6 WHERE id=2;
DROP VIEW v1;
DROP TABLE t1;
#
-# BUG#22584: last_insert_id not updated after inserting a record
+# Bug#22584 last_insert_id not updated after inserting a record
# through a updatable view
#
# We still do not update LAST_INSERT_ID if AUTO_INCREMENT column is
@@ -2968,8 +3034,9 @@ SELECT * FROM t1;
DROP VIEW v1, v2;
DROP TABLE t1;
+
#
-# Bug #25580: !0 as an operand in a select expression of a view
+# Bug#25580 !0 as an operand in a select expression of a view
#
CREATE VIEW v AS SELECT !0 * 5 AS x FROM DUAL;
@@ -2980,8 +3047,9 @@ SELECT * FROM v;
DROP VIEW v;
+
#
-# BUG#24293: '\Z' token is not handled correctly in views
+# Bug#24293 '\Z' token is not handled correctly in views
#
--disable_warnings
@@ -2995,8 +3063,9 @@ SHOW CREATE VIEW v1;
DROP VIEW v1;
+
#
-# Bug #26124: BETWEEN over a view column of the DATETIME type
+# Bug#26124 BETWEEN over a view column of the DATETIME type
#
CREATE TABLE t1 (mydate DATETIME);
@@ -3011,8 +3080,9 @@ SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #25931: update of a multi-table view with check option
+# Bug#25931 update of a multi-table view with check option
#
CREATE TABLE t1 (a int);
@@ -3024,7 +3094,7 @@ CREATE VIEW v1 AS
SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
SELECT * FROM v1;
---error 1369
+--error ER_VIEW_CHECK_FAILED
UPDATE v1 SET b=3;
SELECT * FROM v1;
SELECT * FROM t1;
@@ -3033,8 +3103,9 @@ SELECT * FROM t2;
DROP VIEW v1;
DROP TABLE t1,t2;
+
#
-# Bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm.
+# Bug#12122 Views with ORDER BY can't be resolved using MERGE algorithm.
#
create table t1(f1 int, f2 int);
insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
@@ -3048,7 +3119,7 @@ drop view v1;
drop table t1;
#
-# Bug#26209: queries with GROUP BY and ORDER BY using views
+# Bug#26209 queries with GROUP BY and ORDER BY using views
#
CREATE TABLE t1 (
@@ -3067,9 +3138,9 @@ SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
DROP VIEW v1;
DROP TABLE t1;
+
#
-# BUG#25897: Some queries are no longer possible after a CREATE VIEW
-# fails
+# Bug#25897 Some queries are no longer possible after a CREATE VIEW fails
#
--disable_warnings
DROP VIEW IF EXISTS v1;
@@ -3083,9 +3154,9 @@ eval CREATE VIEW v1 AS $query;
--echo # Previously the following would fail.
eval $query;
+
#
-# Bug#24532: The return data type of IS TRUE is different from similar
-# operations
+# Bug#24532 The return data type of IS TRUE is different from similar operations
#
--disable_warnings
@@ -3170,8 +3241,9 @@ drop view view_24532_a;
drop view view_24532_b;
drop table table_24532;
+
#
-# Bug#26560: view using subquery with a reference to an outer alias
+# Bug#26560 view using subquery with a reference to an outer alias
#
CREATE TABLE t1 (
@@ -3182,7 +3254,7 @@ INSERT INTO t1 (lid, name) VALUES
(1, 'YES'), (2, 'NO');
CREATE TABLE t2 (
- id int NOT NULL PRIMARY KEY,
+ id int NOT NULL PRIMARY KEY,
gid int NOT NULL,
lid int NOT NULL,
dt date
@@ -3210,8 +3282,9 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP table t1,t2;
+
#
-# Bug#27786: Inconsistent Operation Performing UNION On View With ORDER BY
+# Bug#27786 Inconsistent Operation Performing UNION On View With ORDER BY
#
CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3);
CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
@@ -3226,8 +3299,9 @@ EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #27921 View ignores precision for CAST()
+# Bug#27921 View ignores precision for CAST()
#
CREATE VIEW v1 AS SELECT CAST( 1.23456789 AS DECIMAL( 7,5 ) ) AS col;
SELECT * FROM v1;
@@ -3238,9 +3312,10 @@ CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
SHOW CREATE VIEW v1;
DROP VIEW v1;
+
#
-# Bug #28716: CHECK OPTION expression is evaluated over expired record buffers
-# when VIEW is updated via temporary tables
+# Bug#28716 CHECK OPTION expression is evaluated over expired record buffers
+# when VIEW is updated via temporary tables
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT, c INT DEFAULT 0);
@@ -3254,9 +3329,10 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1,t2;
+
#
-# Bug #28561: update on multi-table view with CHECK OPTION and
-# a subquery in WHERE condition
+# Bug#28561 update on multi-table view with CHECK OPTION and a subquery
+# in WHERE condition
#
CREATE TABLE t1 (id int);
@@ -3264,8 +3340,8 @@ CREATE TABLE t2 (id int, c int DEFAULT 0);
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id) VALUES (1);
-CREATE VIEW v1 AS
- SELECT t2.c FROM t1, t2
+CREATE VIEW v1 AS
+ SELECT t2.c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
UPDATE v1 SET c=1;
@@ -3273,9 +3349,10 @@ UPDATE v1 SET c=1;
DROP VIEW v1;
DROP TABLE t1,t2;
+
#
-# Bug #27827: CHECK OPTION ignores ON conditions when updating
-# a multi-table view with CHECK OPTION.
+# Bug#27827 CHECK OPTION ignores ON conditions when updating
+# a multi-table view with CHECK OPTION.
#
CREATE TABLE t1 (a1 INT, c INT DEFAULT 0);
@@ -3291,14 +3368,14 @@ CREATE VIEW v1 AS
SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3
WITH CHECK OPTION;
SELECT * FROM v1;
---error 1369
+--error ER_VIEW_CHECK_FAILED
UPDATE v1 SET c=3;
PREPARE t FROM 'UPDATE v1 SET c=3';
---error 1369
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error 1369
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error 1369
+--error ER_VIEW_CHECK_FAILED
INSERT INTO v1(a1, c) VALUES (3, 3);
UPDATE v1 SET c=1 WHERE a1=1;
SELECT * FROM v1;
@@ -3309,14 +3386,14 @@ CREATE VIEW v2 AS SELECT t1.a1, t1.c
JOIN (t3 JOIN t4 ON t3.a3=t4.a4)
ON t2.a2=t3.a3 WITH CHECK OPTION;
SELECT * FROM v2;
---error 1369
+--error ER_VIEW_CHECK_FAILED
UPDATE v2 SET c=3;
PREPARE t FROM 'UPDATE v2 SET c=3';
---error 1369
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error 1369
+--error ER_VIEW_CHECK_FAILED
EXECUTE t;
---error 1369
+--error ER_VIEW_CHECK_FAILED
INSERT INTO v2(a1, c) VALUES (3, 3);
UPDATE v2 SET c=2 WHERE a1=1;
SELECT * FROM v2;
@@ -3325,10 +3402,11 @@ SELECT * FROM t1;
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
+
#
-# Bug #29104: assertion abort for a query with a view column reference
-# in the GROUP BY list and a condition requiring the value
-# of another view column to be equal to a constant
+# Bug#29104 assertion abort for a query with a view column reference
+# in the GROUP BY list and a condition requiring the value
+# of another view column to be equal to a constant
#
CREATE TABLE t1 (a int, b int);
@@ -3349,9 +3427,10 @@ EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
DROP VIEW v1;
DROP TABLE t1;
+
#
-# Bug #29392: SELECT over a multi-table view with ORDER BY
-# selecting the same view column with two different aliases
+# Bug#29392 SELECT over a multi-table view with ORDER BY
+# selecting the same view column with two different aliases
#
CREATE TABLE t1 (
@@ -3375,7 +3454,7 @@ CREATE TABLE t3 (
INDEX idx_app_name(app_name)
);
-CREATE VIEW v1 AS
+CREATE VIEW v1 AS
SELECT profile.person_id AS person_id
FROM t1 profile, t2 userrole, t3 role
WHERE userrole.person_id = profile.person_id AND
@@ -3390,35 +3469,37 @@ INSERT INTO t1 VALUES
INSERT INTO t2 VALUES
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
-INSERT INTO t3 VALUES
+INSERT INTO t3 VALUES
(1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'),
(3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'),
(5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'),
(7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'),
(9,'RTOS_DCFSPOS_SUPERVISOR','RTOS');
-
+
EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
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.
+# 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
+select table_name, is_updatable from information_schema.views
where table_name = 'v1';
drop view v1;
drop table t1;
+
#
-# Bug #28701: SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
-# invalid statements
+# Bug#28701 SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
+# invalid statements
#
CREATE TABLE t1 (a INT);
@@ -3436,7 +3517,7 @@ DROP TABLE t1;
#
-# Bug #28702: VIEWs defined with USE/FORCE KEY ignore that request
+# Bug#28702 VIEWs defined with USE/FORCE KEY ignore that request
#
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
PRIMARY KEY(a), KEY (b));
@@ -3456,9 +3537,10 @@ DROP VIEW v2;
DROP VIEW v3;
DROP TABLE t1;
+
--echo #
---echo # Bug#29477: Not all fields of the target table were checked to have
---echo # a default value when inserting into a view.
+--echo # Bug#29477 Not all fields of the target table were checked to have
+--echo # a default value when inserting into a view.
--echo #
create table t1(f1 int, f2 int not null);
create view v1 as select f1 from t1;
@@ -3471,29 +3553,31 @@ set @@sql_mode=@old_mode;
drop view v1;
drop table t1;
+
#
-# Bug #33389: Selecting from a view into a table from within SP or trigger
-# crashes server
+# Bug#33389 Selecting from a view into a table from within SP or trigger
+# crashes server
#
create table t1 (a int, key(a));
create table t2 (c int);
-
+
create view v1 as select a b from t1;
-create view v2 as select 1 a from t2, v1 where c in
+create view v2 as select 1 a from t2, v1 where c in
(select 1 from t1 where b = a);
-
+
insert into t1 values (1), (1);
insert into t2 values (1), (1);
-
+
prepare stmt from "select * from v2 where a = 1";
-execute stmt;
+execute stmt;
drop view v1, v2;
drop table t1, t2;
+
#
-# Bug #33049: Assert while running test-as3ap test(mysql-bench suite)
+# Bug#33049 Assert while running test-as3ap test(mysql-bench suite)
#
CREATE TABLE t1 (a INT);
@@ -3508,7 +3592,7 @@ DROP TABLE t1;
###########################################################################
--echo # -----------------------------------------------------------------
---echo # -- Bug#34337: Server crash when Altering a view using a table name.
+--echo # -- Bug#34337 Server crash when Altering a view using a table name.
--echo # -----------------------------------------------------------------
--echo
@@ -3538,8 +3622,8 @@ DROP TABLE t1;
###########################################################################
--echo # -----------------------------------------------------------------
---echo # -- Bug#35193: VIEW query is rewritten without "FROM DUAL",
---echo # -- causing syntax error
+--echo # -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
+--echo # -- causing syntax error
--echo # -----------------------------------------------------------------
--echo
@@ -3561,15 +3645,16 @@ DROP VIEW v1;
###########################################################################
#
-# Bug#39040: valgrind errors/crash when creating views with binlog logging
-# enabled
+# Bug#39040 valgrind errors/crash when creating views with binlog logging
+# enabled
#
# Bug is visible only when running in valgrind with binary logging.
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
+
#
-# Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws an error
+# Bug#33461 SELECT ... FROM <view> USE INDEX (...) throws an error
#
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index be9daacec4f..ff17cde5184 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -1,6 +1,9 @@
# Can't test with embedded server
-- source include/not_embedded.inc
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
# simple test of grants
grant create view on test.* to test@localhost;
show grants for test@localhost;
@@ -26,19 +29,19 @@ grant create view,select on test.* to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
create definer=root@localhost view v1 as select * from mysqltest.t1;
create view v1 as select * from mysqltest.t1;
# try to modify view without DROP privilege on it
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
alter view v1 as select * from mysqltest.t1;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
create or replace view v1 as select * from mysqltest.t1;
# no CRETE VIEW privilege
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v2 as select * from mysqltest.t1;
# no SELECT privilege
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
create view v2 as select * from mysqltest.t2;
connection root;
@@ -48,7 +51,7 @@ show create view v1;
grant create view,drop,select on test.* to mysqltest_1@localhost;
connection user1;
-# following 'use' command is workaround of bug #9582 and should be removed
+# following 'use' command is workaround of Bug#9582 and should be removed
# when that bug will be fixed
use test;
alter view v1 as select * from mysqltest.t1;
@@ -76,7 +79,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
select c from mysqltest.v1;
# there are no privileges on column 'd'
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1;
connection root;
@@ -96,7 +99,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
select c from mysqltest.v1;
# there are no privileges on column 'd'
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1;
connection root;
@@ -111,7 +114,7 @@ connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
-#prepare views and tables
+# prepare views and tables
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
@@ -133,21 +136,21 @@ select c from mysqltest.v4;
show columns from mysqltest.v1;
show columns from mysqltest.v2;
# but explain/show do not
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v1;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v2;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4;
# allow to see one of underlying table
@@ -156,19 +159,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
connection user1;
# EXPLAIN of view on above table works
explain select c from mysqltest.v1;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1;
explain select c from mysqltest.v2;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2;
# but other EXPLAINs do not
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4;
# allow to see any view in mysqltest database
@@ -222,14 +225,14 @@ select * from t1;
update v2 set a=a+c;
select * from t1;
# no rights on column
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
update v2 set c=a+c;
# no rights for view
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
update v3 set a=a+c;
use test;
@@ -263,9 +266,9 @@ select * from t1;
delete v1 from t2,v1 where t2.x=v1.c;
select * from t1;
# no rights for view
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
delete v2 from t2,v2 where t2.x=v2.c;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
delete from v2 where c < 4;
use test;
@@ -299,9 +302,9 @@ select * from t1;
insert into v1 select x,y from t2;
select * from t1;
# no rights for view
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
insert into v2 values (5,6);
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
insert into v2 select x,y from t2;
use test;
@@ -329,10 +332,10 @@ connection user1;
create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2;
# There are not rights on mysqltest.v1
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v1 as select * from mysqltest.t1;
# There are not any rights on mysqltest.t2.a
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
create view v3 as select a from mysqltest.t2;
# give CREATE VIEW privileges (without any privileges for result column)
@@ -352,13 +355,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2;
connection root;
grant create view,update,select on test.* to mysqltest_1@localhost;
connection user1;
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2;
connection root;
@@ -411,7 +414,7 @@ connection root;
# check view definer information
show create view v1;
revoke select on mysqltest.t1 from mysqltest_1@localhost;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v1;
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
@@ -420,7 +423,7 @@ drop view v1;
drop database mysqltest;
#
-# rights on execution of view underlying functiond (BUG#9505)
+# rights on execution of view underlying functiond (Bug#9505)
#
connection root;
--disable_warnings
@@ -453,11 +456,11 @@ connection user1;
use mysqltest;
select * from v1;
select * from v2;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v3;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v5;
use test;
@@ -505,13 +508,13 @@ use test;
connection root;
create view v5 as select * from v1;
revoke execute on function f2 from mysqltest_1@localhost;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v1;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v2;
select * from v3;
select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v5;
drop view v1, v2, v3, v4, v5;
@@ -549,13 +552,13 @@ use test;
connection root;
revoke select on t1 from mysqltest_1@localhost;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v1;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v2;
select * from v3;
select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v5;
#drop view v1, v2, v3, v4, v5;
@@ -588,11 +591,11 @@ connection user1;
use mysqltest;
select * from v1;
select * from v2;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v3;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
select * from v5;
use test;
@@ -604,7 +607,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
#
-# BUG#14256: definer in view definition is not fully qualified
+# Bug#14256 definer in view definition is not fully qualified
#
--disable_warnings
drop view if exists v1;
@@ -641,6 +644,7 @@ drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2;
connection root;
+disconnect test14256;
drop user test14256;
# Restore the anonymous users.
@@ -650,8 +654,8 @@ flush privileges;
drop table t1;
#
-# BUG#14726: freeing stack variable in case of an error of opening
-# a view when we have locked tables with LOCK TABLES statement.
+# Bug#14726 freeing stack variable in case of an error of opening a view when
+# we have locked tables with LOCK TABLES statement.
#
connection root;
--disable_warnings
@@ -668,7 +672,7 @@ connection user1;
use mysqltest;
LOCK TABLES v1 READ;
--- error ER_TABLEACCESS_DENIED_ERROR
+--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE v1;
UNLOCK TABLES;
use test;
@@ -679,7 +683,7 @@ drop user mysqltest_1@localhost;
drop database mysqltest;
#
-# switch to default connaction
+# switch to default connection
#
disconnect user1;
disconnect root;
@@ -696,7 +700,7 @@ drop view v1;
drop view v2;
#
-# Bug#18681: View privileges are broken
+# Bug#18681 View privileges are broken
#
CREATE DATABASE mysqltest1;
CREATE USER readonly@localhost;
@@ -717,54 +721,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
-CONNECT (n1,localhost,readonly,,);
-CONNECTION n1;
+connect (n1,localhost,readonly,,);
+connection n1;
---error 1356
+--error ER_VIEW_INVALID
SELECT * FROM mysqltest1.v_t1;
---error 1356
+--error ER_VIEW_INVALID
INSERT INTO mysqltest1.v_t1 VALUES(4);
---error 1356
+--error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1 WHERE x = 1;
---error 1356
+--error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
---error 1356
+--error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3;
---error 1356
+--error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1;
---error 1356
+--error ER_VIEW_INVALID
SELECT 1 FROM mysqltest1.v_t1;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.v_ts;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ti;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
INSERT INTO mysqltest1.v_ts VALUES (100);
INSERT INTO mysqltest1.v_ti VALUES (100);
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200;
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tu SET x= 200;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts WHERE x= 200;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts;
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_td WHERE x= 200;
DELETE FROM mysqltest1.v_tds WHERE x= 200;
DELETE FROM mysqltest1.v_td;
-CONNECTION default;
+connection default;
+disconnect n1;
DROP VIEW mysqltest1.v_tds;
DROP VIEW mysqltest1.v_td;
DROP VIEW mysqltest1.v_tus;
@@ -777,21 +782,21 @@ DROP USER readonly@localhost;
DROP DATABASE mysqltest1;
#
-# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
+# Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
#
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
-#--warning 1448
+#--warning ER_VIEW_OTHER_USER
SHOW CREATE VIEW v;
---error 1449
+--error ER_NO_SUCH_USER
SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
USE test;
#
-# Bug#20363: Create view on just created view is now denied
+# Bug#20363 Create view on just created view is now denied
#
eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
@@ -822,6 +827,7 @@ SELECT * FROM view2;
SELECT * from view3;
connection default;
+disconnect session1;
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
@@ -829,8 +835,8 @@ DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
#
-# BUG#20482: failure on Create join view with sources views/tables
-# in different schemas
+# Bug#20482 failure on Create join view with sources views/tables
+# in different schemas
#
--disable_warnings
CREATE DATABASE test1;
@@ -840,7 +846,7 @@ CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
-CREATE OR REPLACE VIEW test.v1 AS
+CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
@@ -851,8 +857,8 @@ DROP DATABASE test1;
#
-# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER
-# returns invoker name
+# Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
+# invoker name
#
--disable_warnings
DROP VIEW IF EXISTS v1;
@@ -911,7 +917,7 @@ DROP USER mysqltest_u1@localhost;
#
-# Bug#17254: Error for DEFINER security on VIEW provides too much info
+# Bug#17254 Error for DEFINER security on VIEW provides too much info
#
connect (root,localhost,root,,);
connection root;
@@ -935,12 +941,12 @@ DROP USER def_17254@localhost;
connect (inv,localhost,inv_17254,,db17254);
connection inv;
--echo for a user
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM v1;
connection root;
--echo for a superuser
---error 1449
+--error ER_NO_SUCH_USER
SELECT * FROM v1;
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
@@ -949,7 +955,7 @@ disconnect inv;
#
-# BUG#24404: strange bug with view+permission+prepared statement
+# Bug#24404 strange bug with view+permission+prepared statement
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest_db1;
@@ -1017,8 +1023,8 @@ DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
#
-# Bug#26813: The SUPER privilege is wrongly required to alter a view created
-# by another user.
+# Bug#26813 The SUPER privilege is wrongly required to alter a view created
+# by another user.
#
connection root;
CREATE DATABASE db26813;
@@ -1050,7 +1056,7 @@ DROP DATABASE db26813;
disconnect u1;
--echo #
---echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
+--echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
--echo #
connection root;
CREATE DATABASE mysqltest_29908;
@@ -1095,7 +1101,7 @@ disconnect u2;
--echo #######################################################################
#
-# BUG#24040: Create View don't succed with "all privileges" on a database.
+# Bug#24040 Create View don't succed with "all privileges" on a database.
#
# Prepare.
@@ -1179,10 +1185,54 @@ SELECT * FROM mysqltest1.t4;
# Cleanup.
--- disconnect bug24040_con
+disconnect bug24040_con;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_u1@localhost;
+
+#
+# Bug#41354 Access control is bypassed when all columns of a view are
+# selected by * wildcard
+
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1(f1 INT, f2 INT);
+CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
+
+GRANT SELECT (f1) ON t1 TO foo;
+GRANT SELECT (f1) ON v1 TO foo;
+
+connect (addconfoo, localhost, foo,,);
+connection addconfoo;
+USE db1;
+
+SELECT f1 FROM t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+SELECT f2 FROM t1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM t1;
+
+SELECT f1 FROM v1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+SELECT f2 FROM v1;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM v1;
+
+connection default;
+disconnect root;
+disconnect addconfoo;
+USE test;
+REVOKE SELECT (f1) ON db1.t1 FROM foo;
+REVOKE SELECT (f1) ON db1.v1 FROM foo;
+DROP USER foo;
+DROP VIEW db1.v1;
+DROP TABLE db1.t1;
+DROP DATABASE db1;
+
+connection default;
--echo End of 5.0 tests.
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test
index 9b9813f9655..093f69f0143 100644
--- a/mysql-test/t/wait_timeout.test
+++ b/mysql-test/t/wait_timeout.test
@@ -2,7 +2,7 @@
-- source include/not_embedded.inc
#
-# Bug #8731: wait_timeout does not work on Mac OS X
+# Bug#8731 wait_timeout does not work on Mac OS X
#
@@ -87,6 +87,7 @@ while (!`select @aborted_clients`)
}
}
--enable_query_log
+disconnect wait_con;
connection con1;
# When the connection is closed in this way, the error code should
@@ -97,3 +98,5 @@ select 2;
--enable_reconnect
select 3;
disconnect con1;
+# The last connect is to keep tools checking the current test happy.
+connect (default,localhost,root,,test,,);
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index 6e6a7ec93a3..adaf8d3ea17 100755
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
@@ -35,4 +35,35 @@ CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
DROP TABLE t1;
+#
+# Bug #33813: Schema names are case-sensitive in DROP FUNCTION
+#
+
+CREATE DATABASE `TESTDB`;
+
+USE `TESTDB`;
+DELIMITER //;
+
+CREATE FUNCTION test_fn() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+
+CREATE FUNCTION test_fn2() RETURNS INTEGER
+BEGIN
+DECLARE rId bigint;
+RETURN rId;
+END
+//
+
+DELIMITER ;//
+
+DROP FUNCTION `TESTDB`.`test_fn`;
+DROP FUNCTION `testdb`.`test_fn2`;
+
+USE test;
+DROP DATABASE `TESTDB`;
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
index 591d7ac2c4d..04ecf518577 100644
--- a/mysql-test/t/xa.test
+++ b/mysql-test/t/xa.test
@@ -2,6 +2,10 @@
# WL#1756
#
-- source include/have_innodb.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@@ -14,10 +18,10 @@ xa rollback 'test1';
select * from t1;
xa start 'test2';
---error 1399
+--error ER_XAER_RMFAIL
xa start 'test-bad';
insert t1 values (20);
---error 1399
+--error ER_XAER_RMFAIL
xa prepare 'test2';
xa end 'test2';
xa prepare 'test2';
@@ -27,22 +31,22 @@ select * from t1;
xa start 'testa','testb';
insert t1 values (30);
---error 1399
+--error ER_XAER_RMFAIL
commit;
xa end 'testa','testb';
---error 1399
+--error ER_XAER_RMFAIL
begin;
---error 1399
+--error ER_XAER_RMFAIL
create table t2 (a int);
connect (con1,localhost,root,,);
connection con1;
---error 1440
+--error ER_XAER_DUPID
xa start 'testa','testb';
---error 1440
+--error ER_XAER_DUPID
xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ]
@@ -51,7 +55,7 @@ insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
---error 1399
+--error ER_XAER_RMFAIL
start transaction;
xa recover;
@@ -64,11 +68,11 @@ xa prepare 'testa','testb';
xa recover;
---error 1397
+--error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb';
---error 1064
+--error ER_PARSE_ERROR
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select * from t1;
@@ -119,3 +123,7 @@ xa start 'a','c';
drop table t1;
--echo End of 5.0 tests
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
+
diff --git a/mysys/base64.c b/mysys/base64.c
index 47b93942784..a471e846b97 100644
--- a/mysys/base64.c
+++ b/mysys/base64.c
@@ -193,7 +193,7 @@ base64_decode(const char *src, size_t size, void *dst)
{
return -1;
}
- return d - dst_base;
+ return (int) (d - dst_base);
}
diff --git a/mysys/default.c b/mysys/default.c
index b709b33e2f8..362aa0d4605 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -182,7 +182,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
/* Handle --defaults-group-suffix= */
uint i;
const char **extra_groups;
- const uint instance_len= strlen(my_defaults_group_suffix);
+ const size_t instance_len= strlen(my_defaults_group_suffix);
struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx;
char *ptr;
TYPELIB *group= ctx->group;
@@ -194,11 +194,11 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
for (i= 0; i < group->count; i++)
{
- uint len;
+ size_t len;
extra_groups[i]= group->type_names[i]; /** copy group */
len= strlen(extra_groups[i]);
- if (!(ptr= alloc_root(ctx->alloc, len+instance_len+1)))
+ if (!(ptr= alloc_root(ctx->alloc, (uint) (len+instance_len+1))))
goto err;
extra_groups[i+group->count]= ptr;
@@ -1083,7 +1083,7 @@ static const char **init_default_directories(MEM_ROOT *alloc)
if ((env= getenv("ETC")))
errors += add_directory(alloc, env, dirs);
#elif defined(DEFAULT_SYSCONFDIR)
- if (DEFAULT_SYSCONFDIR != "")
+ if (DEFAULT_SYSCONFDIR[0])
errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
#endif /* __EMX__ || __OS2__ */
diff --git a/mysys/errors.c b/mysys/errors.c
index 1c13255a616..92eb2be6708 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -39,7 +39,7 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't change dir to '%s' (Errcode: %d)",
"Warning: '%s' had %d links",
"%d files and %d streams is left open\n",
- "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... Retry in %d secs",
+ "Disk is full writing '%s' (Errcode: %d). Waiting for someone to free space... (Expect up to %d secs delay for server to continue after freeing disk space)",
"Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file",
"Out of resources when opening file '%s' (Errcode: %d)",
@@ -90,3 +90,17 @@ void init_glob_errs()
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
}
#endif
+
+void wait_for_free_space(const char *filename, int errors)
+{
+ if (errors == 0)
+ my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
+ filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
+ if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
+ my_printf_error(EE_DISK_FULL,
+ "Retry in %d secs. Message reprinted in %d secs",
+ MYF(ME_BELL | ME_NOREFRESH),
+ MY_WAIT_FOR_USER_TO_FIX_PANIC,
+ MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
+ VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+}
diff --git a/mysys/md5.c b/mysys/md5.c
index 0945f9ce5f4..2388cebedc4 100644
--- a/mysys/md5.c
+++ b/mysys/md5.c
@@ -13,356 +13,313 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
+/*
+ * This code implements the MD5 message-digest algorithm.
+ * The algorithm is due to Ron Rivest. This code was
+ * written by Colin Plumb in 1993, no copyright is claimed.
+ * This code is in the public domain; do with it what you wish.
+ *
+ * Equivalent code is available from RSA Data Security, Inc.
+ * This code has been tested against that, and is equivalent,
+ * except that you don't need to include two pages of legalese
+ * with every copy.
+ *
+ * To compute the message digest of a chunk of bytes, declare an
+ * MD5Context structure, pass it to MD5Init, call MD5Update as
+ * needed on buffers full of bytes, and then call MD5Final, which
+ * will fill a supplied 16-byte array with the digest.
*/
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
-*/
-
-/*
- Changes by Monty:
- Replace of MD5_memset and MD5_memcpy with memset & memcpy
-*/
+/* This code was modified in 1997 by Jim Kingdon of Cyclic Software to
+ not require an integer type which is exactly 32 bits. This work
+ draws on the changes for the same purpose by Tatu Ylonen
+ <ylo@cs.hut.fi> as part of SSH, but since I didn't actually use
+ that code, there is no copyright issue. I hereby disclaim
+ copyright in any changes I have made; this code remains in the
+ public domain. */
#include <my_global.h>
#include <m_string.h>
#include "my_md5.h"
-/* Constants for MD5Transform routine. */
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-
-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, unsigned char *, unsigned int));
-#ifdef OLD_CODE
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
-#else
-#define MD5_memcpy(A,B,C) memcpy((char*) (A),(char*) (B), (C))
-#define MD5_memset(A,B,C) memset((char*) (A),(B), (C))
-#endif
+#include <string.h> /* for memcpy() and memset() */
-static unsigned char PADDING[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
+static void
+my_MD5Transform (cvs_uint32 buf[4], const unsigned char in[64]);
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+/* Little-endian byte-swapping routines. Note that these do not
+ depend on the size of datatypes such as uint32, nor do they require
+ us to detect the endianness of the machine we are running on. It
+ is possible they should be macros for speed, but I would be
+ surprised if they were a performance bottleneck for MD5. */
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void my_MD5Init (my_MD5_CTX *context) /* context */
+static uint32 getu32 (const unsigned char *addr)
{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
-*/
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
+ return (((((unsigned long)addr[3] << 8) | addr[2]) << 8)
+ | addr[1]) << 8 | addr[0];
}
-/* MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-
-void my_MD5Update (
-my_MD5_CTX *context, /* context */
-unsigned char *input, /* input block */
-unsigned int inputLen) /* length of input block */
+static void
+putu32 (uint32 data, unsigned char *addr)
{
- unsigned int i, idx, partLen;
-
- /* Compute number of bytes mod 64 */
- idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
+ addr[0] = (unsigned char)data;
+ addr[1] = (unsigned char)(data >> 8);
+ addr[2] = (unsigned char)(data >> 16);
+ addr[3] = (unsigned char)(data >> 24);
+}
- /* Update number of bits */
- if ((context->count[0] += ((UINT4)inputLen << 3))
- < ((UINT4)inputLen << 3))
- context->count[1]++;
- context->count[1] += ((UINT4)inputLen >> 29);
+/*
+ Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
+ initialization constants.
+*/
+void
+my_MD5Init (my_MD5Context *ctx)
+{
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
- partLen = 64 - idx;
+ ctx->bits[0] = 0;
+ ctx->bits[1] = 0;
+}
- /* Transform as many times as possible.
+/*
+ Update context to reflect the concatenation of another buffer full
+ of bytes.
*/
- if (inputLen >= partLen) {
- MD5_memcpy((POINTER)&context->buffer[idx], (POINTER)input, partLen);
- MD5Transform(context->state, context->buffer);
+void
+my_MD5Update (my_MD5Context *ctx, unsigned char const *buf, unsigned len)
+{
+ uint32 t;
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform (context->state, &input[i]);
+ /* Update bitcount */
- idx = 0;
- }
- else
- i = 0;
+ t = ctx->bits[0];
+ if ((ctx->bits[0] = (t + ((uint32)len << 3)) & 0xffffffff) < t)
+ ctx->bits[1]++; /* Carry from low to high */
+ ctx->bits[1] += len >> 29;
- /* Buffer remaining input */
- MD5_memcpy((POINTER)&context->buffer[idx], (POINTER)&input[i],
- inputLen-i);
-}
+ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
+ /* Handle any leading odd-sized chunks */
-void my_MD5Final (
-unsigned char digest[16], /* message digest */
-my_MD5_CTX *context) /* context */
-{
- unsigned char bits[8];
- unsigned int idx, padLen;
+ if ( t ) {
+ unsigned char *p = ctx->in + t;
- /* Save number of bits */
- Encode (bits, context->count, 8);
+ t = 64-t;
+ if (len < t) {
+ memcpy(p, buf, len);
+ return;
+ }
+ memcpy(p, buf, t);
+ my_MD5Transform (ctx->buf, ctx->in);
+ buf += t;
+ len -= t;
+ }
- /* Pad out to 56 mod 64.
-*/
- idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
- padLen = (idx < 56) ? (56 - idx) : (120 - idx);
- my_MD5Update (context, PADDING, padLen);
+ /* Process data in 64-byte chunks */
- /* Append length (before padding) */
- my_MD5Update (context, bits, 8);
+ while (len >= 64) {
+ memcpy(ctx->in, buf, 64);
+ my_MD5Transform (ctx->buf, ctx->in);
+ buf += 64;
+ len -= 64;
+ }
- /* Store state in digest */
- Encode (digest, context->state, 16);
+ /* Handle any remaining bytes of data. */
- /* Zeroize sensitive information.
-*/
- MD5_memset ((POINTER)context, 0, sizeof (*context));
+ memcpy(ctx->in, buf, len);
}
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform (
-UINT4 state[4],
-unsigned char block[64])
-{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode (x, block, 64);
-
- /* Round 1 */
- FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
- FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
- FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
- FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
- FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
- FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
- FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
- FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
- FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
- FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
- FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
- GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
- GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
- GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
- GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
- GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
- GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
- GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
- GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
- GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
- GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
- HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
- HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
- HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
- HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
- HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
- HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
- HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
- HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
- HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
- II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
- II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
- II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
- II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
- II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
- II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
- II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
- II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
- II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information.
+/*
+ Final wrapup - pad to 64-byte boundary with the bit pattern
+ 1 0* (64-bit count of bits processed, MSB-first)
*/
- MD5_memset ((POINTER)x, 0, sizeof (x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode (
-unsigned char *output,
-UINT4 *input,
-unsigned int len)
+void
+my_MD5Final (unsigned char digest[16], my_MD5Context *ctx)
{
- unsigned int i, j;
+ unsigned count;
+ unsigned char *p;
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char)(input[i] & 0xff);
- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
+ /* Compute number of bytes mod 64 */
+ count = (ctx->bits[0] >> 3) & 0x3F;
+
+ /* Set the first char of padding to 0x80. This is safe since there is
+ always at least one byte free */
+ p = ctx->in + count;
+ *p++ = 0x80;
+
+ /* Bytes of padding needed to make 64 bytes */
+ count = 64 - 1 - count;
+
+ /* Pad out to 56 mod 64 */
+ if (count < 8) {
+ /* Two lots of padding: Pad the first block to 64 bytes */
+ memset(p, 0, count);
+ my_MD5Transform (ctx->buf, ctx->in);
+
+ /* Now fill the next block with 56 bytes */
+ memset(ctx->in, 0, 56);
+ } else {
+ /* Pad block to 56 bytes */
+ memset(p, 0, count-8);
}
+
+ /* Append length in bits and transform */
+ putu32(ctx->bits[0], ctx->in + 56);
+ putu32(ctx->bits[1], ctx->in + 60);
+
+ my_MD5Transform (ctx->buf, ctx->in);
+ putu32(ctx->buf[0], digest);
+ putu32(ctx->buf[1], digest + 4);
+ putu32(ctx->buf[2], digest + 8);
+ putu32(ctx->buf[3], digest + 12);
+ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
+#ifndef ASM_MD5
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
- */
-static void Decode (
-UINT4 *output,
-unsigned char *input,
-unsigned int len)
-{
- unsigned int i, j;
+/* The four core functions - F1 is optimized somewhat */
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
- (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
+/* #define F1(x, y, z) (x & y | ~x & z) */
+#define F1(x, y, z) (z ^ (x & (y ^ z)))
+#define F2(x, y, z) F1(z, x, y)
+#define F3(x, y, z) (x ^ y ^ z)
+#define F4(x, y, z) (y ^ (x | ~z))
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
+/* This is the central step in the MD5 algorithm. */
+#define MD5STEP(f, w, x, y, z, data, s) \
+ ( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )
-#ifndef MD5_memcpy
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
+/*
+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
+ * reflect the addition of 16 longwords of new data. MD5Update blocks
+ * the data and converts bytes into longwords for this routine.
+ */
+static void
+my_MD5Transform (uint32 buf[4], const unsigned char inraw[64])
{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- output[i] = input[i];
+ register uint32 a, b, c, d;
+ uint32 in[16];
+ int i;
+
+ for (i = 0; i < 16; ++i)
+ in[i] = getu32 (inraw + 4 * i);
+
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
+ MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
+ MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
+ MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
+ MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
+ MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
+ MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
+ MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
+ MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
+ MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
+ MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
+ MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
+ MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
+ MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
+ MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
+ MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
+
+ MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
+ MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
+ MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
+ MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
+ MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
+ MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
+ MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
+ MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
+ MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
+ MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
+ MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
+ MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
+ MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
+ MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
+ MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
+ MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
+
+ MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
+ MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
+ MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
+ MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
+ MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
+ MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
+ MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
+ MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
+ MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
+ MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
+ MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
+ MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
+ MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
+ MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
+ MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
+ MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
+
+ MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
+ MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
+ MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
+ MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
+ MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
+ MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
+ MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
+ MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
+ MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
+ MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
+ MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
+ MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
+ MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
+ MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
+ MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
+ MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
}
#endif
-/* Note: Replace "for loop" with standard memset if possible.
- */
+#ifdef TEST
+/*
+ Simple test program. Can use it to manually run the tests from
+ RFC1321 for example.
+*/
+#include <stdio.h>
-#ifndef MD5_memset
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
+int
+main (int argc, char **argv)
{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
+ my_MD5Context context;
+ unsigned char checksum[16];
+ int i;
+ int j;
+
+ if (argc < 2)
+ {
+ fprintf (stderr, "usage: %s string-to-hash\n", argv[0]);
+ exit (1);
+ }
+ for (j = 1; j < argc; ++j)
+ {
+ printf ("MD5 (\"%s\") = ", argv[j]);
+ my_MD5Init (&context);
+ my_MD5Update (&context, argv[j], strlen (argv[j]));
+ my_MD5Final (checksum, &context);
+ for (i = 0; i < 16; i++)
+ {
+ printf ("%02x", (unsigned int) checksum[i]);
+ }
+ printf ("\n");
+ }
+ return 0;
}
-#endif
+#endif /* TEST */
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index 30e9f19a189..214e7716683 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -368,9 +368,9 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
else
{
/* %% or unknown code */
- if (my_b_write(info, backtrack, fmt-backtrack))
+ if (my_b_write(info, backtrack, (uint) (fmt - backtrack)))
goto err;
- out_length+= fmt-backtrack;
+ out_length+= (uint) (fmt - backtrack);
}
}
return out_length;
diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c
index ea30509ca8c..38b27bce100 100644
--- a/mysys/my_fstream.c
+++ b/mysys/my_fstream.c
@@ -116,10 +116,8 @@ uint my_fwrite(FILE *stream, const byte *Buffer, uint Count, myf MyFlags)
if ((errno == ENOSPC || errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL))
{
- if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
- "[stream]",my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+ wait_for_free_space("[stream]", errors);
+ errors++;
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
continue;
}
diff --git a/mysys/my_new.cc b/mysys/my_new.cc
index babfe04d695..7da54ffac87 100644
--- a/mysys/my_new.cc
+++ b/mysys/my_new.cc
@@ -46,8 +46,9 @@ void operator delete[] (void *ptr) throw ()
C_MODE_START
-int __cxa_pure_virtual() {
- assert("Pure virtual method called." == "Aborted");
+int __cxa_pure_virtual()
+{
+ assert(! "Aborted: pure virtual method called.");
return 0;
}
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index 2d42a6ebbc4..d5bb29ff6a4 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -121,10 +121,8 @@ uint my_pwrite(int Filedes, const byte *Buffer, uint Count, my_off_t offset,
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL))
{
- if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
- my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+ wait_for_free_space(my_filename(Filedes), errors);
+ errors++;
continue;
}
if ((writenbytes > 0 && (uint) writenbytes != (uint) -1) ||
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 77dbffb911e..1858d830f41 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -74,8 +74,8 @@ uint sf_malloc_prehunc=0, /* If you have problem with core- */
sf_malloc_endhunc=0, /* dump when malloc-message.... */
/* set theese to 64 or 128 */
sf_malloc_quick=0; /* set if no calls to sanity */
-ulong sf_malloc_cur_memory= 0L; /* Current memory usage */
-ulong sf_malloc_max_memory= 0L; /* Maximum memory usage */
+size_t sf_malloc_cur_memory= 0L; /* Current memory usage */
+size_t sf_malloc_max_memory= 0L; /* Maximum memory usage */
uint sf_malloc_count= 0; /* Number of times NEW() was called */
byte *sf_min_adress= (byte*) ~(unsigned long) 0L,
*sf_max_adress= (byte*) 0L;
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 9ff7babab31..4df7e75b953 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -54,10 +54,8 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
if ((my_errno == ENOSPC || my_errno == EDQUOT) &&
(MyFlags & MY_WAIT_IF_FULL))
{
- if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
- my_filename(Filedes),my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
- VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
+ wait_for_free_space(my_filename(Filedes), errors);
+ errors++;
continue;
}
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 1cdbd1ecbf2..8c611a8556b 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -173,7 +173,7 @@ gptr _mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
data[size + 3]= MAGICEND3;
irem->filename= (my_string) filename;
irem->linenum= lineno;
- irem->datasize= size;
+ irem->datasize= (uint32) size;
irem->prev= NULL;
/* Add this remember structure to the linked list */
diff --git a/mysys/string.c b/mysys/string.c
index df78f2b98b5..6dcb034531e 100644
--- a/mysys/string.c
+++ b/mysys/string.c
@@ -150,12 +150,12 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...)
/* Search for quote in each string and replace with escaped quote */
while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0')
{
- ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos);
+ ret&= dynstr_append_mem(str, cur_pos, (uint) (next_pos - cur_pos));
ret&= dynstr_append_mem(str ,"\\", 1);
ret&= dynstr_append_mem(str, quote_str, quote_len);
cur_pos= next_pos + 1;
}
- ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos);
+ ret&= dynstr_append_mem(str, cur_pos, (uint) (next_pos - cur_pos));
append= va_arg(dirty_text, char *);
}
va_end(dirty_text);
diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
index f05761bb837..009745fd896 100644
--- a/scripts/mysqldumpslow.sh
+++ b/scripts/mysqldumpslow.sh
@@ -17,9 +17,9 @@ my %opt = (
);
GetOptions(\%opt,
- 'verbose|v+',# verbose
+ 'v|verbose+',# verbose
'help+', # write usage info
- 'debug|d+', # debug
+ 'd|debug+', # debug
's=s', # what to sort by (t, at, l, al, r, ar etc)
'r!', # reverse the sort order (largest last instead of first)
't=i', # just show the top n queries
diff --git a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc
index a782c2ae33e..57dd1c72f23 100644
--- a/server-tools/instance-manager/buffer.cc
+++ b/server-tools/instance-manager/buffer.cc
@@ -100,7 +100,7 @@ err:
int Buffer::get_size()
{
- return buffer_size;
+ return (uint) buffer_size;
}
diff --git a/server-tools/instance-manager/commands.cc b/server-tools/instance-manager/commands.cc
index 01afa703a47..bb3763ce8c5 100644
--- a/server-tools/instance-manager/commands.cc
+++ b/server-tools/instance-manager/commands.cc
@@ -52,11 +52,11 @@
static inline int put_to_buff(Buffer *buff, const char *str, uint *position)
{
- uint len= strlen(str);
- if (buff->append(*position, str, len))
+ size_t len= strlen(str);
+ if (buff->append(*position, str, (uint) len))
return 1;
- *position+= len;
+ *position+= (uint) len;
return 0;
}
@@ -201,7 +201,7 @@ int Show_instance_status::execute(struct st_net *net,
Instance *instance;
store_to_protocol_packet(&send_buff, (char*) instance_name, &position);
- if (!(instance= instance_map->find(instance_name, strlen(instance_name))))
+ if (!(instance= instance_map->find(instance_name, (uint) strlen(instance_name))))
goto err;
if (instance->is_running())
store_to_protocol_packet(&send_buff, (char*) "online", &position);
@@ -272,7 +272,7 @@ int Show_instance_options::execute(struct st_net *net, ulong connection_id)
{
Instance *instance;
- if (!(instance= instance_map->find(instance_name, strlen(instance_name))))
+ if (!(instance= instance_map->find(instance_name, (uint) strlen(instance_name))))
goto err;
store_to_protocol_packet(&send_buff, (char*) "instance_name", &position);
store_to_protocol_packet(&send_buff, (char*) instance_name, &position);
@@ -452,7 +452,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
File fd;
if ((instance= instance_map->find(instance_name,
- strlen(instance_name))) == NULL)
+ (uint) strlen(instance_name))) == NULL)
goto err;
logpath= instance->options.logs[log_type];
@@ -479,13 +479,13 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
buff_size= (size - offset);
- read_buff.reserve(0, buff_size);
+ read_buff.reserve(0, (uint) buff_size);
/* read in one chunk */
read_len= (int)my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
if ((read_len= my_read(fd, (byte*) read_buff.buffer,
- buff_size, MYF(0))) < 0)
+ (uint) buff_size, MYF(0))) < 0)
return ER_READ_FILE;
store_to_protocol_packet(&send_buff, read_buff.buffer,
&position, read_len);
@@ -569,7 +569,7 @@ int Show_instance_log_files::execute(struct st_net *net, ulong connection_id)
Instance *instance;
if ((instance= instance_map->
- find(instance_name, strlen(instance_name))) == NULL)
+ find(instance_name, (uint) strlen(instance_name))) == NULL)
goto err;
{
diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc
index 58fe7569db7..e08bf2f66df 100644
--- a/server-tools/instance-manager/instance.cc
+++ b/server-tools/instance-manager/instance.cc
@@ -173,7 +173,7 @@ static int start_process(Instance_options *instance_options,
int cmdlen= 0;
for (int i= 0; instance_options->argv[i] != 0; i++)
- cmdlen+= strlen(instance_options->argv[i]) + 3;
+ cmdlen+= (uint) strlen(instance_options->argv[i]) + 3;
cmdlen++; /* make room for the null */
char *cmdline= new char[cmdlen];
diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc
index 39fd20cbc2d..571826edd7b 100644
--- a/server-tools/instance-manager/instance_map.cc
+++ b/server-tools/instance-manager/instance_map.cc
@@ -112,7 +112,7 @@ int Instance_map::process_one_option(const char *group, const char *option)
|| group[sizeof(prefix)] == '\0'))
{
if (!(instance= (Instance *) hash_search(&hash, (byte *) group,
- strlen(group))))
+ (uint) strlen(group))))
{
if (!(instance= new Instance))
goto err;
diff --git a/server-tools/instance-manager/instance_options.cc b/server-tools/instance-manager/instance_options.cc
index d4ca2ad570f..9d88bb0e669 100644
--- a/server-tools/instance-manager/instance_options.cc
+++ b/server-tools/instance-manager/instance_options.cc
@@ -257,7 +257,7 @@ int Instance_options::fill_log_options()
strmov(hostname, "mysql");
hostname[MAX_LOG_OPTION_LENGTH - 1]= 0; /* Safety */
- hostname_length= strlen(hostname);
+ hostname_length= (uint) strlen(hostname);
for (log_files= logs_st; log_files->name; log_files++)
@@ -392,7 +392,7 @@ int Instance_options::complete_initialization(const char *default_path,
if (!mysqld_path)
{
// Need one extra byte, as convert_dirname() adds a slash at the end.
- if (!(mysqld_path= alloc_root(&alloc, strlen(default_path) + 2)))
+ if (!(mysqld_path= alloc_root(&alloc, (uint) strlen(default_path) + 2)))
goto err;
strcpy((char *)mysqld_path, default_path);
}
@@ -401,7 +401,7 @@ int Instance_options::complete_initialization(const char *default_path,
end= convert_dirname((char*)mysqld_path, mysqld_path, NullS);
end[-1]= 0;
- mysqld_path_len= strlen(mysqld_path);
+ mysqld_path_len= (uint) strlen(mysqld_path);
if (mysqld_port)
mysqld_port_val= atoi(strchr(mysqld_port, '=') + 1);
@@ -572,7 +572,7 @@ void Instance_options::print_argv()
int Instance_options::init(const char *instance_name_arg)
{
- instance_name_len= strlen(instance_name_arg);
+ instance_name_len= (uint) strlen(instance_name_arg);
init_alloc_root(&alloc, MEM_ROOT_BLOCK_SIZE, 0);
diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc
index a950ecf4ed3..36f0cbe85e1 100644
--- a/server-tools/instance-manager/listener.cc
+++ b/server-tools/instance-manager/listener.cc
@@ -35,23 +35,28 @@
#include "portability.h"
+#ifndef __WIN__
static void set_non_blocking(int socket)
{
-#ifndef __WIN__
int flags= fcntl(socket, F_GETFL, 0);
fcntl(socket, F_SETFL, flags | O_NONBLOCK);
#else
+static void set_non_blocking(SOCKET socket)
+{
u_long arg= 1;
ioctlsocket(socket, FIONBIO, &arg);
#endif
}
+#ifndef __WIN__
static void set_no_inherit(int socket)
{
-#ifndef __WIN__
int flags= fcntl(socket, F_GETFD, 0);
fcntl(socket, F_SETFD, flags | FD_CLOEXEC);
+#else
+static void set_no_inherit(SOCKET socket)
+{
#endif
}
@@ -71,7 +76,11 @@ private:
ulong total_connection_count;
Thread_info thread_info;
+#ifdef __WIN__
+ SOCKET sockets[2];
+#else
int sockets[2];
+#endif
int num_sockets;
fd_set read_fds;
private:
@@ -110,9 +119,10 @@ Listener_thread::~Listener_thread()
void Listener_thread::run()
{
- int i, n= 0;
+ int i= 0;
#ifndef __WIN__
+ int n= 0;
/* we use this var to check whether we are running on LinuxThreads */
pid_t thread_pid;
@@ -121,6 +131,8 @@ void Listener_thread::run()
struct sockaddr_un unix_socket_address;
/* set global variable */
linuxthreads= (thread_pid != manager_pid);
+#else
+ SOCKET n= 0;
#endif
thread_registry.register_thread(&thread_info);
@@ -159,7 +171,11 @@ void Listener_thread::run()
signal during shutdown. This results in failing assert
(Thread_registry::~Thread_registry). Valgrind 2.2 works fine.
*/
+#ifdef __WIN__
+ int rc= select(0, &read_fds_arg, 0, 0, &tv);
+#else
int rc= select(n, &read_fds_arg, 0, 0, &tv);
+#endif
if (rc == 0 || rc == -1)
{
@@ -175,11 +191,18 @@ void Listener_thread::run()
/* Assuming that rc > 0 as we asked to wait forever */
if (FD_ISSET(sockets[socket_index], &read_fds_arg))
{
+#ifdef __WIN__
+ SOCKET client_fd= accept(sockets[socket_index], 0, 0);
+ /* accept may return INVALID_SOCKET on failure */
+ if (client_fd != INVALID_SOCKET)
+ {
+#else
int client_fd= accept(sockets[socket_index], 0, 0);
/* accept may return -1 (failure or spurious wakeup) */
if (client_fd >= 0) // connection established
{
set_no_inherit(client_fd);
+#endif
Vio *vio= vio_new(client_fd, socket_index == 0 ?
VIO_TYPE_SOCKET : VIO_TYPE_TCPIP,
@@ -230,7 +253,11 @@ int Listener_thread::create_tcp_socket()
/* value to be set by setsockopt */
int arg= 1;
+#ifdef __WIN__
+ SOCKET ip_socket= socket(AF_INET, SOCK_STREAM, 0);
+#else
int ip_socket= socket(AF_INET, SOCK_STREAM, 0);
+#endif
if (ip_socket == INVALID_SOCKET)
{
log_error("Listener_thead::run(): socket(AF_INET) failed, %s",
diff --git a/server-tools/instance-manager/mysql_connection.cc b/server-tools/instance-manager/mysql_connection.cc
index 2b377d60ad0..1803108c39d 100644
--- a/server-tools/instance-manager/mysql_connection.cc
+++ b/server-tools/instance-manager/mysql_connection.cc
@@ -241,7 +241,7 @@ int Mysql_connection_thread::check_connection()
/* write connection message and read reply */
enum { MIN_HANDSHAKE_SIZE= 2 };
- if (net_write_command(&net, protocol_version, "", 0, buff, pos - buff) ||
+ if (net_write_command(&net, protocol_version, "", 0, buff, (uint) (pos - buff)) ||
(pkt_len= my_net_read(&net)) == packet_error ||
pkt_len < MIN_HANDSHAKE_SIZE)
{
@@ -275,7 +275,7 @@ int Mysql_connection_thread::check_connection()
net_send_error(&net, ER_ACCESS_DENIED_ERROR);
return 1;
}
- if (user_map.authenticate(user, password-user-2, password, scramble))
+ if (user_map.authenticate(user, (uint) (password - user - 2), password, scramble))
{
net_send_error(&net, ER_ACCESS_DENIED_ERROR);
return 1;
diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc
index f7eab075952..9eb148c4e3b 100644
--- a/server-tools/instance-manager/options.cc
+++ b/server-tools/instance-manager/options.cc
@@ -59,7 +59,7 @@ char **Options::saved_argv= NULL;
bool Options::is_forced_default_file= 0;
static const char * const ANGEL_PID_FILE_SUFFIX= ".angel.pid";
-static const int ANGEL_PID_FILE_SUFFIX_LEN= strlen(ANGEL_PID_FILE_SUFFIX);
+static const int ANGEL_PID_FILE_SUFFIX_LEN= (uint) strlen(ANGEL_PID_FILE_SUFFIX);
/*
List of options, accepted by the instance manager.
diff --git a/server-tools/instance-manager/parse.cc b/server-tools/instance-manager/parse.cc
index 71f69b596c1..bbbadf3e91a 100644
--- a/server-tools/instance-manager/parse.cc
+++ b/server-tools/instance-manager/parse.cc
@@ -177,7 +177,7 @@ Command *parse_command(Instance_map *map, const char *text)
get_word(&text, &option_len, NONSPACE);
option= text;
if ((tmp= strchr(text, '=')) != NULL)
- option_len= tmp - text;
+ option_len= (uint) (tmp - text);
text+= option_len;
get_word(&text, &word_len);
diff --git a/server-tools/instance-manager/parse.h b/server-tools/instance-manager/parse.h
index 5e9f33beb11..9f7f7d7933c 100644
--- a/server-tools/instance-manager/parse.h
+++ b/server-tools/instance-manager/parse.h
@@ -58,7 +58,7 @@ inline void get_word(const char **text, uint *word_len,
(*word_end != '\0'))
++word_end;
- *word_len= word_end - *text;
+ *word_len= (uint) (word_end - *text);
}
#endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_PARSE_H */
diff --git a/server-tools/instance-manager/parse_output.cc b/server-tools/instance-manager/parse_output.cc
index f8ddf5a2d08..377671b4401 100644
--- a/server-tools/instance-manager/parse_output.cc
+++ b/server-tools/instance-manager/parse_output.cc
@@ -30,11 +30,11 @@ void trim_space(const char **text, uint *word_len)
start++;
*text= start;
- int len= strlen(start);
+ size_t len= strlen(start);
const char *end= start + len - 1;
while (end > start && my_isspace(&my_charset_latin1, *end))
end--;
- *word_len= (end - start)+1;
+ *word_len= (uint) (end - start)+1;
}
/*
@@ -65,7 +65,7 @@ int parse_output_and_get_value(const char *command, const char *word,
uint flag)
{
FILE *output;
- uint wordlen;
+ size_t wordlen;
/* should be enough to store the string from the output */
enum { MAX_LINE_LEN= 512 };
char linebuf[MAX_LINE_LEN];
@@ -111,7 +111,7 @@ int parse_output_and_get_value(const char *command, const char *word,
strmake(result, linep, found_word_len);
}
else /* currently there are only two options */
- strmake(result, linep, input_buffer_len - 1);
+ strmake(result, linep, (uint) (input_buffer_len - 1));
rc= 0;
break;
}
diff --git a/server-tools/instance-manager/protocol.cc b/server-tools/instance-manager/protocol.cc
index 6c7a7f0ecfa..faeee4e95e9 100644
--- a/server-tools/instance-manager/protocol.cc
+++ b/server-tools/instance-manager/protocol.cc
@@ -53,11 +53,11 @@ int net_send_ok(struct st_net *net, unsigned long connection_id,
int2store(pos, 0);
pos+= 2;
- uint position= pos - buff.buffer; /* we might need it for message */
+ uint position= (uint) (pos - buff.buffer); /* we might need it for message */
if (message != NULL)
{
- buff.reserve(position, 9 + strlen(message));
+ buff.reserve(position, 9 + (uint) strlen(message));
store_to_protocol_packet(&buff, message, &position);
}
@@ -82,7 +82,7 @@ int net_send_error(struct st_net *net, uint sql_errno)
memcpy(pos, errno_to_sqlstate(sql_errno), SQLSTATE_LENGTH);
pos+= SQLSTATE_LENGTH;
pos= strmake(pos, err, MYSQL_ERRMSG_SIZE - 1) + 1;
- return my_net_write(net, buff, pos - buff) || net_flush(net);
+ return my_net_write(net, buff, (uint) (pos - buff)) || net_flush(net);
}
@@ -98,7 +98,7 @@ int net_send_error_323(struct st_net *net, uint sql_errno)
int2store(pos, sql_errno);
pos+= 2;
pos= strmake(pos, err, MYSQL_ERRMSG_SIZE - 1) + 1;
- return my_net_write(net, buff, pos - buff) || net_flush(net);
+ return my_net_write(net, buff, (uint) (pos - buff)) || net_flush(net);
}
char *net_store_length(char *pkg, uint length)
@@ -123,7 +123,7 @@ int store_to_protocol_packet(Buffer *buf, const char *string, uint *position,
/* reserve max amount of bytes needed to store length */
if (buf->reserve(*position, 9))
goto err;
- currpos= (net_store_length(buf->buffer + *position,
+ currpos= (uint) (net_store_length(buf->buffer + *position,
(ulonglong) string_len) - buf->buffer);
if (buf->append(currpos, string, string_len))
goto err;
@@ -139,7 +139,7 @@ int store_to_protocol_packet(Buffer *buf, const char *string, uint *position)
{
uint string_len;
- string_len= strlen(string);
+ string_len= (uint) strlen(string);
return store_to_protocol_packet(buf, string, position, string_len);
}
diff --git a/server-tools/instance-manager/user_map.cc b/server-tools/instance-manager/user_map.cc
index 2f77d2f59c1..7871cad7814 100644
--- a/server-tools/instance-manager/user_map.cc
+++ b/server-tools/instance-manager/user_map.cc
@@ -55,7 +55,7 @@ int User::init(const char *line)
goto err;
password= name_end + 1;
}
- user_length= name_end - name_begin;
+ user_length= (uint) (name_end - name_begin);
if (user_length > USERNAME_LENGTH)
goto err;
diff --git a/sql-bench/TODO b/sql-bench/TODO
deleted file mode 100644
index 8a103e89199..00000000000
--- a/sql-bench/TODO
+++ /dev/null
@@ -1,21 +0,0 @@
-When comparing with ms-sql:
-
-Check how to get MySQL faster mysql ms-sql
-
-count_distinct (2000) | 89.00| 39.00|
-count_distinct_big (120) | 324.00| 121.00|
-count_distinct_group (1000) | 158.00| 107.00|
-count_distinct_group_on_key (1000) | 49.00| 17.00|
-count_distinct_group_on_key_parts (1| 157.00| 108.00|
-order_by_big (10) | 197.00| 89.00|
-order_by_big_key (10) | 170.00| 82.00|
-order_by_big_key2 (10) | 163.00| 73.00|
-order_by_big_key_desc (10) | 172.00| 84.00|
-order_by_big_key_diff (10) | 193.00| 89.00|
-order_by_big_key_prefix (10) | 165.00| 72.00|
-
-
-Why is the following slow on NT:
- NT Linux
-update_of_primary_key_many_keys (256| 560.00| 65.00|
-
diff --git a/sql-common/client.c b/sql-common/client.c
index 519deac2bc5..27cc110401c 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -3145,7 +3145,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name)
if (mysql_get_server_version(mysql) < 40100)
return 0;
sprintf(buff, "SET NAMES %s", cs_name);
- if (!mysql_real_query(mysql, buff, strlen(buff)))
+ if (!mysql_real_query(mysql, buff, (uint) strlen(buff)))
{
mysql->charset= cs;
}
diff --git a/sql-common/my_user.c b/sql-common/my_user.c
index fa5b80413bf..8d54275b2fd 100644
--- a/sql-common/my_user.c
+++ b/sql-common/my_user.c
@@ -44,8 +44,8 @@ void parse_user(const char *user_id_str, uint user_id_len,
}
else
{
- *user_name_len= p - user_id_str;
- *host_name_len= user_id_len - *user_name_len - 1;
+ *user_name_len= (uint) (p - user_id_str);
+ *host_name_len= (uint) (user_id_len - *user_name_len - 1);
memcpy(user_name_str, user_id_str, *user_name_len);
memcpy(host_name_str, p + 1, *host_name_len);
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 2d78999017a..ef671ac7f9d 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -199,7 +199,7 @@ void insert_symbols()
for (cur= symbols; i<array_elements(symbols); cur++, i++){
hash_lex_struct *root=
get_hash_struct_by_len(&root_by_len,cur->length,&max_len);
- insert_into_hash(root,cur->name,0,i,0);
+ insert_into_hash(root,cur->name,0,(uint) i,0);
}
}
@@ -511,7 +511,7 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
res= symbols+ires;\n\
else\n\
res= sql_functions-ires-1;\n\
- register uint count= cur_str-s;\n\
+ register uint count= (uint) (cur_str - s);\n\
return lex_casecmp(cur_str,res->name+count,len-count) ? 0 : res;\n\
}\n\
\n\
@@ -540,7 +540,7 @@ static inline SYMBOL *get_hash_symbol(const char *s,\n\
register int16 ires= (int16)(cur_struct>>16);\n\
if (ires==array_elements(symbols)) return 0;\n\
register SYMBOL *res= symbols+ires;\n\
- register uint count= cur_str-s;\n\
+ register uint count= (uint) (cur_str - s);\n\
return lex_casecmp(cur_str,res->name+count,len-count)!=0 ? 0 : res;\n\
}\n\
\n\
diff --git a/sql/ha_archive.cc b/sql/ha_archive.cc
index 0c558bf2515..04dbe678d4d 100644
--- a/sql/ha_archive.cc
+++ b/sql/ha_archive.cc
@@ -851,7 +851,7 @@ int ha_archive::get_row(gzFile file_to_read, byte *buf)
total_blob_length += ((Field_blob*) table->field[*ptr])->get_length();
/* Adjust our row buffer if we need be */
- buffer.alloc(total_blob_length);
+ buffer.alloc((uint) total_blob_length);
last= (char *)buffer.ptr();
/* Loop through our blobs and read them */
@@ -862,10 +862,10 @@ int ha_archive::get_row(gzFile file_to_read, byte *buf)
size_t size= ((Field_blob*) table->field[*ptr])->get_length();
if (size)
{
- read= gzread(file_to_read, last, size);
+ read= gzread(file_to_read, last, (uint) size);
if ((size_t) read != size)
DBUG_RETURN(HA_ERR_END_OF_FILE);
- ((Field_blob*) table->field[*ptr])->set_ptr(size, last);
+ ((Field_blob*) table->field[*ptr])->set_ptr((uint) size, last);
last += size;
}
}
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index d4144a41a2a..6944dc5a030 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -640,7 +640,7 @@ static int parse_url(FEDERATED_SHARE *share, TABLE *table,
share->database[share->table_name - share->database]= '\0';
share->table_name++;
- share->table_name_length= strlen(share->table_name);
+ share->table_name_length= (uint) strlen(share->table_name);
/* make sure there's not an extra / */
if ((strchr(share->table_name, '/')))
@@ -726,7 +726,7 @@ uint ha_federated::convert_row_to_internal_format(byte *record,
index variable to move us through the row at the
same iterative step as the field
*/
- int x= field - table->field;
+ size_t x= (field - table->field);
my_ptrdiff_t old_ptr;
old_ptr= (my_ptrdiff_t) (record - table->record[0]);
(*field)->move_field(old_ptr);
@@ -750,7 +750,7 @@ static bool emit_key_part_name(String *to, KEY_PART_INFO *part)
{
DBUG_ENTER("emit_key_part_name");
if (append_ident(to, part->field->field_name,
- strlen(part->field->field_name), ident_quote_char))
+ (uint) strlen(part->field->field_name), ident_quote_char))
DBUG_RETURN(1); // Out of memory
DBUG_RETURN(0);
}
@@ -1290,13 +1290,13 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
for (field= table->field; *field; field++)
{
append_ident(&query, (*field)->field_name,
- strlen((*field)->field_name), ident_quote_char);
+ (uint) strlen((*field)->field_name), ident_quote_char);
query.append(FEDERATED_COMMA);
}
- query.length(query.length()- strlen(FEDERATED_COMMA));
+ query.length(query.length() - (uint) strlen(FEDERATED_COMMA));
query.append(FEDERATED_FROM);
- tmp_share.table_name_length= strlen(tmp_share.table_name);
+ tmp_share.table_name_length= (uint) strlen(tmp_share.table_name);
append_ident(&query, tmp_share.table_name,
tmp_share.table_name_length, ident_quote_char);
@@ -1528,7 +1528,7 @@ bool ha_federated::append_stmt_insert(String *query)
append_ident(&insert_string, share->table_name, share->table_name_length,
ident_quote_char);
insert_string.append(FEDERATED_OPENPAREN);
- tmp_length= insert_string.length() - strlen(FEDERATED_COMMA);
+ tmp_length= insert_string.length() - (uint) strlen(FEDERATED_COMMA);
/*
loop through the field pointer array, add any fields to both the values
@@ -1538,7 +1538,7 @@ bool ha_federated::append_stmt_insert(String *query)
{
/* append the field name */
append_ident(&insert_string, (*field)->field_name,
- strlen((*field)->field_name), ident_quote_char);
+ (uint) strlen((*field)->field_name), ident_quote_char);
/* append commas between both fields and fieldnames */
/*
@@ -1554,7 +1554,7 @@ bool ha_federated::append_stmt_insert(String *query)
/*
remove trailing comma
*/
- insert_string.length(insert_string.length() - strlen(FEDERATED_COMMA));
+ insert_string.length(insert_string.length() - (uint) strlen(FEDERATED_COMMA));
/*
if there were no fields, we don't want to add a closing paren
@@ -1667,7 +1667,7 @@ int ha_federated::write_row(byte *buf)
if (values_string.length() > tmp_length)
{
/* chops off leading commas */
- values_string.length(values_string.length() - strlen(FEDERATED_COMMA));
+ values_string.length(values_string.length() - (uint) strlen(FEDERATED_COMMA));
}
/* we always want to append this, even if there aren't any fields */
values_string.append(FEDERATED_CLOSEPAREN);
@@ -1950,10 +1950,10 @@ int ha_federated::update_row(const byte *old_data, byte *new_data)
for (Field **field= table->field; *field; field++)
{
- uint field_name_length= strlen((*field)->field_name);
- append_ident(&where_string, (*field)->field_name, field_name_length,
+ size_t field_name_length= strlen((*field)->field_name);
+ append_ident(&where_string, (*field)->field_name, (uint) field_name_length,
ident_quote_char);
- append_ident(&update_string, (*field)->field_name, field_name_length,
+ append_ident(&update_string, (*field)->field_name, (uint) field_name_length,
ident_quote_char);
update_string.append(FEDERATED_EQ);
@@ -2044,7 +2044,7 @@ int ha_federated::delete_row(const byte *buf)
Field *cur_field= *field;
data_string.length(0);
append_ident(&delete_string, (*field)->field_name,
- strlen((*field)->field_name), ident_quote_char);
+ (uint) strlen((*field)->field_name), ident_quote_char);
if (cur_field->is_null())
{
@@ -2359,7 +2359,7 @@ int ha_federated::rnd_init(bool scan)
stored_result= 0;
}
- if (real_query(share->select_query, strlen(share->select_query)))
+ if (real_query(share->select_query, (uint) strlen(share->select_query)))
goto error;
stored_result= mysql_store_result(mysql);
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 83e2d025f18..f71e891e88d 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -524,6 +524,20 @@ convert_error_code_to_mysql(
mark_transaction_to_rollback(thd, TRUE);
return(HA_ERR_LOCK_TABLE_FULL);
+ } else if (error == DB_TOO_MANY_CONCURRENT_TRXS) {
+
+ /* Once MySQL add the appropriate code to errmsg.txt then
+ we can get rid of this #ifdef. NOTE: The code checked by
+ the #ifdef is the suggested name for the error condition
+ and the actual error code name could very well be different.
+ This will require some monitoring, ie. the status
+ of this request on our part.*/
+#ifdef ER_TOO_MANY_CONCURRENT_TRXS
+ return(ER_TOO_MANY_CONCURRENT_TRXS);
+#else
+ return(HA_ERR_RECORD_FILE_FULL);
+#endif
+
} else if (error == DB_UNSUPPORTED) {
return(HA_ERR_UNSUPPORTED);
@@ -3731,7 +3745,6 @@ convert_search_mode_to_innobase(
case HA_READ_MBR_WITHIN:
case HA_READ_MBR_DISJOINT:
case HA_READ_MBR_EQUAL:
- my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0));
return(PAGE_CUR_UNSUPP);
/* do not use "default:" in order to produce a gcc warning:
enumeration value '...' not handled in switch
@@ -5212,7 +5225,7 @@ ha_innobase::records_in_range(
mode2);
} else {
- n_rows = 0;
+ n_rows = HA_POS_ERROR;
}
dtuple_free_for_mysql(heap1);
@@ -7012,7 +7025,7 @@ ha_innobase::get_error_message(int error, String *buf)
{
trx_t* trx = check_trx_exists(current_thd);
- buf->copy(trx->detailed_error, strlen(trx->detailed_error),
+ buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error),
system_charset_info);
return FALSE;
diff --git a/sql/handler.cc b/sql/handler.cc
index 71d184ad84b..d069d56caae 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -188,7 +188,8 @@ retest:
{
if (!my_strnncoll(&my_charset_latin1,
(const uchar *)name, namelen,
- (const uchar *)(*types)->name, strlen((*types)->name)))
+ (const uchar *)(*types)->name,
+ (uint) strlen((*types)->name)))
return (enum db_type) (*types)->db_type;
}
@@ -200,10 +201,10 @@ retest:
if (!my_strnncoll(&my_charset_latin1,
(const uchar *)name, namelen,
(const uchar *)table_alias->alias,
- strlen(table_alias->alias)))
+ (uint) strlen(table_alias->alias)))
{
name= table_alias->type;
- namelen= strlen(name);
+ namelen= (uint) strlen(name);
goto retest;
}
}
diff --git a/sql/item.cc b/sql/item.cc
index bc1ae683e93..6ae52d8be59 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1498,7 +1498,8 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
else
{
// Cannot apply conversion
- set(0, DERIVATION_NONE, 0);
+ set(&my_charset_bin, DERIVATION_NONE,
+ (dt.repertoire|repertoire));
return 1;
}
}
@@ -1581,15 +1582,31 @@ bool agg_item_collations(DTCollation &c, const char *fname,
{
uint i;
Item **arg;
+ bool unknown_cs= 0;
+
c.set(av[0]->collation);
for (i= 1, arg= &av[item_sep]; i < count; i++, arg++)
{
if (c.aggregate((*arg)->collation, flags))
{
+ if (c.derivation == DERIVATION_NONE &&
+ c.collation == &my_charset_bin)
+ {
+ unknown_cs= 1;
+ continue;
+ }
my_coll_agg_error(av, count, fname, item_sep);
return TRUE;
}
}
+
+ if (unknown_cs &&
+ c.derivation != DERIVATION_EXPLICIT)
+ {
+ my_coll_agg_error(av, count, fname, item_sep);
+ return TRUE;
+ }
+
if ((flags & MY_COLL_DISALLOW_NONE) &&
c.derivation == DERIVATION_NONE)
{
@@ -1608,42 +1625,11 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname,
}
-/*
- Collect arguments' character sets together.
- We allow to apply automatic character set conversion in some cases.
- The conditions when conversion is possible are:
- - arguments A and B have different charsets
- - A wins according to coercibility rules
- (i.e. a column is stronger than a string constant,
- an explicit COLLATE clause is stronger than a column)
- - character set of A is either superset for character set of B,
- or B is a string constant which can be converted into the
- character set of A without data loss.
-
- If all of the above is true, then it's possible to convert
- B into the character set of A, and then compare according
- to the collation of A.
-
- For functions with more than two arguments:
-
- collect(A,B,C) ::= collect(collect(A,B),C)
-
- Since this function calls THD::change_item_tree() on the passed Item **
- pointers, it is necessary to pass the original Item **'s, not copies.
- Otherwise their values will not be properly restored (see BUG#20769).
- If the items are not consecutive (eg. args[2] and args[5]), use the
- item_sep argument, ie.
-
- agg_item_charsets(coll, fname, &args[2], 2, flags, 3)
-
-*/
-bool agg_item_charsets(DTCollation &coll, const char *fname,
- Item **args, uint nargs, uint flags, int item_sep)
+bool agg_item_set_converter(DTCollation &coll, const char *fname,
+ Item **args, uint nargs, uint flags, int item_sep)
{
Item **arg, *safe_args[2];
- if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
- return TRUE;
/*
For better error reporting: save the first and the second argument.
@@ -1724,6 +1710,46 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
}
+/*
+ Collect arguments' character sets together.
+ We allow to apply automatic character set conversion in some cases.
+ The conditions when conversion is possible are:
+ - arguments A and B have different charsets
+ - A wins according to coercibility rules
+ (i.e. a column is stronger than a string constant,
+ an explicit COLLATE clause is stronger than a column)
+ - character set of A is either superset for character set of B,
+ or B is a string constant which can be converted into the
+ character set of A without data loss.
+
+ If all of the above is true, then it's possible to convert
+ B into the character set of A, and then compare according
+ to the collation of A.
+
+ For functions with more than two arguments:
+
+ collect(A,B,C) ::= collect(collect(A,B),C)
+
+ Since this function calls THD::change_item_tree() on the passed Item **
+ pointers, it is necessary to pass the original Item **'s, not copies.
+ Otherwise their values will not be properly restored (see BUG#20769).
+ If the items are not consecutive (eg. args[2] and args[5]), use the
+ item_sep argument, ie.
+
+ agg_item_charsets(coll, fname, &args[2], 2, flags, 3)
+
+*/
+
+bool agg_item_charsets(DTCollation &coll, const char *fname,
+ Item **args, uint nargs, uint flags, int item_sep)
+{
+ if (agg_item_collations(coll, fname, args, nargs, flags, item_sep))
+ return TRUE;
+
+ return agg_item_set_converter(coll, fname, args, nargs, flags, item_sep);
+}
+
+
void Item_ident_for_show::make_field(Send_field *tmp_field)
{
tmp_field->table_name= tmp_field->org_table_name= table_name;
@@ -3010,7 +3036,7 @@ bool Item_param::convert_str_value(THD *thd)
str_value.set_charset(value.cs_info.final_character_set_of_str_value);
/* Here str_value is guaranteed to be in final_character_set_of_str_value */
- max_length= str_value.length();
+ max_length= str_value.numchars() * str_value.charset()->mbmaxlen;
decimals= 0;
/*
str_value_ptr is returned from val_str(). It must be not alloced
@@ -6281,7 +6307,7 @@ bool Item_trigger_field::fix_fields(THD *thd, Item **items)
if (check_grant_column(thd, table_grants, triggers->trigger_table->s->db,
triggers->trigger_table->s->table_name,
field_name,
- strlen(field_name), thd->security_ctx))
+ (uint) strlen(field_name), thd->security_ctx))
return TRUE;
}
#endif // NO_EMBEDDED_ACCESS_CHECKS
diff --git a/sql/item.h b/sql/item.h
index 1058cc5dbb8..852b0fcc1ba 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1169,6 +1169,8 @@ bool agg_item_collations(DTCollation &c, const char *name,
Item **items, uint nitems, uint flags, int item_sep);
bool agg_item_collations_for_comparison(DTCollation &c, const char *name,
Item **items, uint nitems, uint flags);
+bool agg_item_set_converter(DTCollation &coll, const char *fname,
+ Item **args, uint nargs, uint flags, int item_sep);
bool agg_item_charsets(DTCollation &c, const char *name,
Item **items, uint nitems, uint flags, int item_sep);
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 3b1d18b4252..01d3e9bed52 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -490,7 +490,8 @@ int Arg_comparator::set_compare_func(Item_bool_func2 *item, Item_result type)
my_error(ER_OPERAND_COLUMNS, MYF(0), (*a)->element_index(i)->cols());
return 1;
}
- comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i));
+ if (comparators[i].set_cmp_func(owner, (*a)->addr(i), (*b)->addr(i)))
+ return 1;
}
break;
}
@@ -835,6 +836,16 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
get_value_func= &get_time_value;
return 0;
}
+ else if (type == STRING_RESULT &&
+ (*a)->result_type() == STRING_RESULT &&
+ (*b)->result_type() == STRING_RESULT)
+ {
+ DTCollation coll;
+ coll.set((*a)->collation.collation);
+ if (agg_item_set_converter(coll, owner_arg->func_name(),
+ b, 1, MY_COLL_CMP_CONV, 1))
+ return 1;
+ }
return set_compare_func(owner_arg, type);
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 913b32ccb88..47e16a1bcc3 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2758,7 +2758,7 @@ longlong Item_func_find_in_set::val_int()
if (is_last_item && !is_separator)
str_end= substr_end;
if (!my_strnncoll(cs, (const uchar *) str_begin,
- str_end - str_begin,
+ (uint) (str_end - str_begin),
find_str, find_str_len))
return (longlong) position;
else
@@ -4792,7 +4792,7 @@ Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
:var(var_arg), var_type(var_type_arg), component(*component_arg)
{
/* set_name() will allocate the name */
- set_name(name_arg, name_len_arg, system_charset_info);
+ set_name(name_arg, (uint) name_len_arg, system_charset_info);
}
@@ -4961,7 +4961,10 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
if (item->type() == Item::REF_ITEM)
args[i]= item= *((Item_ref *)item)->ref;
if (item->type() != Item::FIELD_ITEM)
- key=NO_SUCH_KEY;
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
+ return TRUE;
+ }
}
/*
Check that all columns come from the same table.
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 34f974042a5..7edc1a62307 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -101,13 +101,10 @@ String *Item_func_md5::val_str(String *str)
str->set_charset(&my_charset_bin);
if (sptr)
{
- my_MD5_CTX context;
unsigned char digest[16];
null_value=0;
- my_MD5Init (&context);
- my_MD5Update (&context,(unsigned char *) sptr->ptr(), sptr->length());
- my_MD5Final (digest, &context);
+ MY_MD5_HASH(digest,(unsigned char *) sptr->ptr(), sptr->length());
if (str->alloc(32)) // Ensure that memory is free
{
null_value=1;
@@ -1743,17 +1740,17 @@ bool Item_func_user::init(const char *user, const char *host)
if (user)
{
CHARSET_INFO *cs= str_value.charset();
- uint res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen;
+ size_t res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen;
- if (str_value.alloc(res_length))
+ if (str_value.alloc((uint) res_length))
{
null_value=1;
return TRUE;
}
- res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), res_length,
+ res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), (uint) res_length,
"%s@%s", user, host);
- str_value.length(res_length);
+ str_value.length((uint) res_length);
str_value.mark_as_const();
}
return FALSE;
@@ -2433,7 +2430,7 @@ String *Item_func_rpad::val_str(String *str)
memcpy(to,ptr_pad,(size_t) pad_byte_length);
to+= pad_byte_length;
}
- res->length(to- (char*) res->ptr());
+ res->length((uint) (to- (char*) res->ptr()));
return (res);
err:
@@ -2701,7 +2698,7 @@ String *Item_func_charset::val_str(String *str)
CHARSET_INFO *cs= args[0]->collation.collation;
null_value= 0;
- str->copy(cs->csname, strlen(cs->csname),
+ str->copy(cs->csname, (uint) strlen(cs->csname),
&my_charset_latin1, collation.collation, &dummy_errors);
return str;
}
@@ -2713,7 +2710,7 @@ String *Item_func_collation::val_str(String *str)
CHARSET_INFO *cs= args[0]->collation.collation;
null_value= 0;
- str->copy(cs->name, strlen(cs->name),
+ str->copy(cs->name, (uint) strlen(cs->name),
&my_charset_latin1, collation.collation, &dummy_errors);
return str;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 23ac20a4017..9794a092648 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -362,7 +362,7 @@ public:
Item_func_encode(Item *a, char *seed_arg):
Item_str_func(a), sql_crypt(seed_arg)
{
- seed.copy(seed_arg, strlen(seed_arg), default_charset_info);
+ seed.copy(seed_arg, (uint) strlen(seed_arg), default_charset_info);
}
String *val_str(String *);
void fix_length_and_dec();
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d33d92a5238..57045f52825 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -440,7 +440,8 @@ void Item_sum::make_field(Send_field *tmp_field)
void Item_sum::print(String *str)
{
- Item **pargs= orig_args;
+ /* orig_args is not filled with valid values until fix_fields() */
+ Item **pargs= fixed ? orig_args : args;
str->append(func_name());
for (uint i=0 ; i < arg_count ; i++)
{
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 38d9d62bd99..22ca8a925db 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -384,7 +384,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
if (tmp - val > 6)
tmp= (char*) val + 6;
l_time->second_part= (int) my_strtoll10(val, &tmp, &error);
- frac_part= 6 - (tmp - val);
+ frac_part= 6 - (uint) (tmp - val);
if (frac_part > 0)
l_time->second_part*= (ulong) log_10_int[frac_part];
val= tmp;
@@ -635,14 +635,14 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
if (!l_time->month)
return 1;
str->append(locale->month_names->type_names[l_time->month-1],
- strlen(locale->month_names->type_names[l_time->month-1]),
+ (uint) strlen(locale->month_names->type_names[l_time->month-1]),
system_charset_info);
break;
case 'b':
if (!l_time->month)
return 1;
str->append(locale->ab_month_names->type_names[l_time->month-1],
- strlen(locale->ab_month_names->type_names[l_time->month-1]),
+ (uint) strlen(locale->ab_month_names->type_names[l_time->month-1]),
system_charset_info);
break;
case 'W':
@@ -651,7 +651,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
weekday= calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),0);
str->append(locale->day_names->type_names[weekday],
- strlen(locale->day_names->type_names[weekday]),
+ (uint) strlen(locale->day_names->type_names[weekday]),
system_charset_info);
break;
case 'a':
@@ -660,13 +660,13 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
weekday=calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),0);
str->append(locale->ab_day_names->type_names[weekday],
- strlen(locale->ab_day_names->type_names[weekday]),
+ (uint) strlen(locale->ab_day_names->type_names[weekday]),
system_charset_info);
break;
case 'D':
if (type == MYSQL_TIMESTAMP_TIME)
return 1;
- length= int10_to_str(l_time->day, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 1, '0');
if (l_time->day >= 10 && l_time->day <= 19)
str->append(STRING_WITH_LEN("th"));
@@ -689,62 +689,62 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
}
break;
case 'Y':
- length= int10_to_str(l_time->year, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->year, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 4, '0');
break;
case 'y':
- length= int10_to_str(l_time->year%100, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->year%100, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'm':
- length= int10_to_str(l_time->month, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'c':
- length= int10_to_str(l_time->month, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 1, '0');
break;
case 'd':
- length= int10_to_str(l_time->day, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'e':
- length= int10_to_str(l_time->day, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 1, '0');
break;
case 'f':
- length= int10_to_str(l_time->second_part, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->second_part, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 6, '0');
break;
case 'H':
- length= int10_to_str(l_time->hour, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->hour, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'h':
case 'I':
hours_i= (l_time->hour%24 + 11)%12+1;
- length= int10_to_str(hours_i, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'i': /* minutes */
- length= int10_to_str(l_time->minute, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->minute, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'j':
if (type == MYSQL_TIMESTAMP_TIME)
return 1;
- length= int10_to_str(calc_daynr(l_time->year,l_time->month,
+ length= (uint) (int10_to_str(calc_daynr(l_time->year,l_time->month,
l_time->day) -
- calc_daynr(l_time->year,1,1) + 1, intbuff, 10) - intbuff;
+ calc_daynr(l_time->year,1,1) + 1, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 3, '0');
break;
case 'k':
- length= int10_to_str(l_time->hour, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->hour, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 1, '0');
break;
case 'l':
hours_i= (l_time->hour%24 + 11)%12+1;
- length= int10_to_str(hours_i, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 1, '0');
break;
case 'p':
@@ -763,7 +763,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
break;
case 'S':
case 's':
- length= int10_to_str(l_time->second, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(l_time->second, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'T':
@@ -781,11 +781,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
uint year;
if (type == MYSQL_TIMESTAMP_TIME)
return 1;
- length= int10_to_str(calc_week(l_time,
+ length= (uint) (int10_to_str(calc_week(l_time,
(*ptr) == 'U' ?
WEEK_FIRST_WEEKDAY : WEEK_MONDAY_FIRST,
&year),
- intbuff, 10) - intbuff;
+ intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
}
break;
@@ -795,12 +795,12 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
uint year;
if (type == MYSQL_TIMESTAMP_TIME)
return 1;
- length= int10_to_str(calc_week(l_time,
+ length= (uint) (int10_to_str(calc_week(l_time,
((*ptr) == 'V' ?
(WEEK_YEAR | WEEK_FIRST_WEEKDAY) :
(WEEK_YEAR | WEEK_MONDAY_FIRST)),
&year),
- intbuff, 10) - intbuff;
+ intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
}
break;
@@ -815,7 +815,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
WEEK_YEAR | WEEK_FIRST_WEEKDAY :
WEEK_YEAR | WEEK_MONDAY_FIRST),
&year);
- length= int10_to_str(year, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(year, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 4, '0');
}
break;
@@ -824,7 +824,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
return 1;
weekday=calc_weekday(calc_daynr(l_time->year,l_time->month,
l_time->day),1);
- length= int10_to_str(weekday, intbuff, 10) - intbuff;
+ length= (uint) (int10_to_str(weekday, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 1, '0');
break;
@@ -875,7 +875,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
value= value*LL(10) + (longlong) (*str - '0');
if (transform_msec && i == count - 1) // microseconds always last
{
- long msec_length= 6 - (str - start);
+ long msec_length= 6 - (uint) (str - start);
if (msec_length > 0)
value*= (long) log_10_int[msec_length];
}
@@ -1063,7 +1063,7 @@ String* Item_func_monthname::val_str(String* str)
}
null_value=0;
month_name= locale->month_names->type_names[month-1];
- str->copy(month_name, strlen(month_name), &my_charset_utf8_bin,
+ str->copy(month_name, (uint) strlen(month_name), &my_charset_utf8_bin,
collation.collation, &err);
return str;
}
@@ -1207,7 +1207,7 @@ String* Item_func_dayname::val_str(String* str)
return (String*) 0;
day_name= locale->day_names->type_names[weekday];
- str->copy(day_name, strlen(day_name), &my_charset_utf8_bin,
+ str->copy(day_name, (uint) strlen(day_name), &my_charset_utf8_bin,
collation.collation, &err);
return str;
}
@@ -3222,14 +3222,14 @@ String *Item_func_get_format::val_str(String *str)
format++)
{
uint format_name_len;
- format_name_len= strlen(format_name);
+ format_name_len= (uint) strlen(format_name);
if (val_len == format_name_len &&
!my_strnncoll(&my_charset_latin1,
(const uchar *) val->ptr(), val_len,
(const uchar *) format_name, val_len))
{
const char *format_str= get_date_time_format_str(format, type);
- str->set(format_str, strlen(format_str), &my_charset_bin);
+ str->set(format_str, (uint) strlen(format_str), &my_charset_bin);
return str;
}
}
diff --git a/sql/lock.cc b/sql/lock.cc
index 47458702033..e22eecd9b73 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -347,7 +347,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
for (i= 0; i < sql_lock->table_count; i++)
{
TABLE *tbl= *table;
- tbl->lock_position= table - sql_lock->table;
+ tbl->lock_position= (uint) (table - sql_lock->table);
tbl->lock_data_start= found;
found+= tbl->lock_count;
table++;
@@ -740,7 +740,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
{
my_error(ER_OPEN_AS_READONLY,MYF(0),table->alias);
/* Clear the lock type of the lock data that are stored already. */
- sql_lock->lock_count= locks - sql_lock->locks;
+ sql_lock->lock_count= (uint) (locks - sql_lock->locks);
reset_lock_data(sql_lock);
my_free((gptr) sql_lock,MYF(0));
DBUG_RETURN(0);
diff --git a/sql/log.cc b/sql/log.cc
index c411f7c8238..d979dd101e0 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -487,7 +487,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name,
{
if (!log_name || !log_name[0])
{
- strmake(buff, pidfile_name, FN_REFLEN - strlen(suffix) - 1);
+ strmake(buff, pidfile_name, (uint) (FN_REFLEN - strlen(suffix) - 1));
return (const char *)
fn_format(buff, buff, "", suffix, MYF(MY_REPLACE_EXT|MY_REPLACE_DIR));
@@ -728,7 +728,7 @@ bool MYSQL_LOG::open(const char *log_name,
file. As every time we write to the index file, we sync it.
*/
if (my_b_write(&index_file, (byte*) log_file_name,
- strlen(log_file_name)) ||
+ (uint) strlen(log_file_name)) ||
my_b_write(&index_file, (byte*) "\n", 1) ||
flush_io_cache(&index_file) ||
my_sync(index_file.file, MYF(MY_WME)))
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ef419aaee40..c4cdfc27fa0 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -268,7 +268,7 @@ append_query_string(CHARSET_INFO *csinfo,
from->ptr(), from->length());
*ptr++='\'';
}
- to->length(orig_len + ptr - beg);
+ to->length((uint) (orig_len + ptr - beg));
return 0;
}
#endif
@@ -556,7 +556,7 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
protocol->store(log_name, &my_charset_bin);
protocol->store((ulonglong) pos);
event_type = get_type_str();
- protocol->store(event_type, strlen(event_type), &my_charset_bin);
+ protocol->store(event_type, (uint) strlen(event_type), &my_charset_bin);
protocol->store((uint32) server_id);
protocol->store((ulonglong) log_pos);
pack_info(protocol);
@@ -976,7 +976,7 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
fputc('#', file);
print_timestamp(file);
- fprintf(file, " server id %d end_log_pos %s ", server_id,
+ fprintf(file, " server id %lu end_log_pos %s ", (ulong) server_id,
llstr(log_pos,llbuff));
/* mysqlbinlog --hexdump */
@@ -1106,7 +1106,7 @@ void Query_log_event::pack_info(Protocol *protocol)
memcpy(pos, query, q_len);
pos+= q_len;
}
- protocol->store(buf, pos-buf, &my_charset_bin);
+ protocol->store(buf, (uint) (pos - buf), &my_charset_bin);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
}
#endif
@@ -1117,6 +1117,11 @@ void Query_log_event::pack_info(Protocol *protocol)
static void write_str_with_code_and_len(char **dst, const char *src,
int len, uint code)
{
+ /*
+ only 1 byte to store the length of catalog, so it should not
+ surpass 255
+ */
+ DBUG_ASSERT(len <= 255);
DBUG_ASSERT(src);
*((*dst)++)= code;
*((*dst)++)= (uchar) len;
@@ -1136,16 +1141,8 @@ static void write_str_with_code_and_len(char **dst, const char *src,
bool Query_log_event::write(IO_CACHE* file)
{
- uchar buf[QUERY_HEADER_LEN+
- 1+4+ // code of flags2 and flags2
- 1+8+ // code of sql_mode and sql_mode
- 1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
- 1+4+ // code of autoinc and the 2 autoinc variables
- 1+6+ // code of charset and charset
- 1+1+MAX_TIME_ZONE_NAME_LENGTH+ // code of tz and tz length and tz name
- 1+2+ // code of lc_time_names and lc_time_names_number
- 1+2 // code of charset_database and charset_database_number
- ], *start, *start_of_status;
+ uchar buf[QUERY_HEADER_LEN + MAX_SIZE_LOG_EVENT_STATUS];
+ uchar *start, *start_of_status;
ulong event_length;
if (!query)
@@ -1251,10 +1248,8 @@ bool Query_log_event::write(IO_CACHE* file)
{
/* In the TZ sys table, column Name is of length 64 so this should be ok */
DBUG_ASSERT(time_zone_len <= MAX_TIME_ZONE_NAME_LENGTH);
- *start++= Q_TIME_ZONE_CODE;
- *start++= time_zone_len;
- memcpy(start, time_zone_str, time_zone_len);
- start+= time_zone_len;
+ write_str_with_code_and_len((char **)(&start),
+ time_zone_str, time_zone_len, Q_TIME_ZONE_CODE);
}
if (lc_time_names_number)
{
@@ -1270,7 +1265,17 @@ bool Query_log_event::write(IO_CACHE* file)
int2store(start, charset_database_number);
start+= 2;
}
+ if (table_map_for_update)
+ {
+ *start++= Q_TABLE_MAP_FOR_UPDATE_CODE;
+ int8store(start, table_map_for_update);
+ start+= 8;
+ }
/*
+ NOTE: When adding new status vars, please don't forget to update
+ the MAX_SIZE_LOG_EVENT_STATUS in log_event.h and update function
+ code_name in this file.
+
Here there could be code like
if (command-line-option-which-says-"log_this_variable" && inited)
{
@@ -1348,7 +1353,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
auto_increment_increment(thd_arg->variables.auto_increment_increment),
auto_increment_offset(thd_arg->variables.auto_increment_offset),
lc_time_names_number(thd_arg->variables.lc_time_names->number),
- charset_database_number(0)
+ charset_database_number(0),
+ table_map_for_update((ulonglong)thd_arg->table_map_for_update)
{
time_t end_time;
@@ -1437,7 +1443,7 @@ get_str_len_and_pointer(const Log_event::Byte **src,
if (length > 0)
{
if (*src + length >= end)
- return *src + length - end + 1; // Number of bytes missing
+ return (int) (*src + length - end + 1); // Number of bytes missing
*dst= (char *)*src + 1; // Will be copied later
}
*len= length;
@@ -1471,6 +1477,7 @@ code_name(int code)
case Q_CATALOG_NZ_CODE: return "Q_CATALOG_NZ_CODE";
case Q_LC_TIME_NAMES_CODE: return "Q_LC_TIME_NAMES_CODE";
case Q_CHARSET_DATABASE_CODE: return "Q_CHARSET_DATABASE_CODE";
+ case Q_TABLE_MAP_FOR_UPDATE_CODE: return "Q_TABLE_MAP_FOR_UPDATE_CODE";
}
sprintf(buf, "CODE#%d", code);
return buf;
@@ -1507,7 +1514,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
db(NullS), catalog_len(0), status_vars_len(0),
flags2_inited(0), sql_mode_inited(0), charset_inited(0),
auto_increment_increment(1), auto_increment_offset(1),
- time_zone_len(0), lc_time_names_number(0), charset_database_number(0)
+ time_zone_len(0), lc_time_names_number(0), charset_database_number(0),
+ table_map_for_update(0)
{
ulong data_len;
uint32 tmp;
@@ -1649,6 +1657,11 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
charset_database_number= uint2korr(pos);
pos+= 2;
break;
+ case Q_TABLE_MAP_FOR_UPDATE_CODE:
+ CHECK_SPACE(pos, end, 8);
+ table_map_for_update= uint8korr(pos);
+ pos+= 8;
+ break;
default:
/* That's why you must write status vars in growing order of code */
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
@@ -1908,7 +1921,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli,
Thank you.
*/
thd->catalog= catalog_len ? (char *) catalog : (char *)"";
- thd->set_db(new_db, strlen(new_db)); /* allocates a copy of 'db' */
+ thd->set_db(new_db, (uint) strlen(new_db)); /* allocates a copy of 'db' */
thd->variables.auto_increment_increment= auto_increment_increment;
thd->variables.auto_increment_offset= auto_increment_offset;
@@ -2036,6 +2049,8 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli,
else
thd->variables.collation_database= thd->db_charset;
+ thd->table_map_for_update= (table_map)table_map_for_update;
+
/* Execute the query (note that we bypass dispatch_command()) */
const char* found_semicolon= NULL;
mysql_parse(thd, thd->query, thd->query_length, &found_semicolon);
@@ -2771,7 +2786,7 @@ void Load_log_event::pack_info(Protocol *protocol)
if (!(buf= my_malloc(get_query_buffer_length(), MYF(MY_WME))))
return;
print_query(TRUE, buf, &end, 0, 0);
- protocol->store(buf, end-buf, &my_charset_bin);
+ protocol->store(buf, (uint) (end - buf), &my_charset_bin);
my_free(buf, MYF(0));
}
#endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */
@@ -2978,7 +2993,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
table_name = fields + field_block_len;
db = table_name + table_name_len + 1;
fname = db + db_len + 1;
- fname_len = strlen(fname);
+ fname_len = (uint) strlen(fname);
// null termination is accomplished by the caller doing buf[event_len]=0
DBUG_RETURN(0);
@@ -3144,7 +3159,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
bool use_rli_only_for_errors)
{
const char *new_db= rewrite_db(db);
- thd->set_db(new_db, strlen(new_db));
+ thd->set_db(new_db, (uint) strlen(new_db));
DBUG_ASSERT(thd->query == 0);
thd->query_length= 0; // Should not be needed
thd->query_error= 0;
@@ -3237,7 +3252,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
print_query(FALSE, load_data_query, &end, (char **)&thd->lex->fname_start,
(char **)&thd->lex->fname_end);
*end= 0;
- thd->query_length= end - load_data_query;
+ thd->query_length= (uint) (end - load_data_query);
thd->query= load_data_query;
if (sql_ex.opt_flags & REPLACE_FLAG)
@@ -3857,7 +3872,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
break;
case INT_RESULT:
buf= my_malloc(val_offset + 22, MYF(MY_WME));
- event_len= longlong10_to_str(uint8korr(val), buf + val_offset,-10)-buf;
+ event_len= (uint) (longlong10_to_str(uint8korr(val), buf + val_offset,-10) - buf);
break;
case DECIMAL_RESULT:
{
@@ -3883,7 +3898,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
char *p= strxmov(buf + val_offset, "_", cs->csname, " ", NullS);
p= str_to_hex(p, val, val_len);
p= strxmov(p, " COLLATE ", cs->name, NullS);
- event_len= p-buf;
+ event_len= (uint) (p - buf);
}
break;
case ROW_RESULT:
@@ -4204,7 +4219,7 @@ void Slave_log_event::pack_info(Protocol *protocol)
pos= strmov(pos, master_log);
pos= strmov(pos, ",pos=");
pos= longlong10_to_str(master_pos, pos, 10);
- protocol->store(buf, pos-buf, &my_charset_bin);
+ protocol->store(buf, (uint) (pos - buf), &my_charset_bin);
}
#endif /* !MYSQL_CLIENT */
@@ -4222,8 +4237,8 @@ Slave_log_event::Slave_log_event(THD* thd_arg,
// TODO: re-write this better without holding both locks at the same time
pthread_mutex_lock(&mi->data_lock);
pthread_mutex_lock(&rli->data_lock);
- master_host_len = strlen(mi->host);
- master_log_len = strlen(rli->group_master_log_name);
+ master_host_len= (uint) strlen(mi->host);
+ master_log_len= (uint) strlen(rli->group_master_log_name);
// on OOM, just do not initialize the structure and print the error
if ((mem_pool = (char*)my_malloc(get_data_size() + 1,
MYF(MY_WME))))
@@ -4292,7 +4307,7 @@ void Slave_log_event::init_from_mem_pool(int data_size)
master_pos = uint8korr(mem_pool + SL_MASTER_POS_OFFSET);
master_port = uint2korr(mem_pool + SL_MASTER_PORT_OFFSET);
master_host = mem_pool + SL_MASTER_HOST_OFFSET;
- master_host_len = strlen(master_host);
+ master_host_len= (uint) strlen(master_host);
// safety
master_log = master_host + master_host_len + 1;
if (master_log > mem_pool + data_size)
@@ -4300,7 +4315,7 @@ void Slave_log_event::init_from_mem_pool(int data_size)
master_host = 0;
return;
}
- master_log_len = strlen(master_log);
+ master_log_len= (uint) strlen(master_log);
}
@@ -5222,7 +5237,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol)
}
pos= strmov(pos, " ;file_id=");
pos= int10_to_str((long) file_id, pos, 10);
- protocol->store(buf, pos-buf, &my_charset_bin);
+ protocol->store(buf, (uint) (pos - buf), &my_charset_bin);
my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
}
@@ -5265,7 +5280,7 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli)
p= strmake(p, STRING_WITH_LEN(" INTO"));
p= strmake(p, query+fn_pos_end, q_len-fn_pos_end);
- error= Query_log_event::exec_event(rli, buf, p-buf);
+ error= Query_log_event::exec_event(rli, buf, (uint) (p - buf));
/* Forging file name for deletion in same buffer */
*fname_end= 0;
diff --git a/sql/log_event.h b/sql/log_event.h
index 5b065a33dd1..6ccbf8e4d5c 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -204,12 +204,15 @@ struct sql_ex_info
packet (i.e. a query) sent from client to master;
First, an auxiliary log_event status vars estimation:
*/
-#define MAX_SIZE_LOG_EVENT_STATUS (4 /* flags2 */ + \
- 8 /* sql mode */ + \
- 1 + 1 + 255 /* catalog */ + \
- 4 /* autoinc */ + \
- 6 /* charset */ + \
- MAX_TIME_ZONE_NAME_LENGTH)
+#define MAX_SIZE_LOG_EVENT_STATUS (1 + 4 /* type, flags2 */ + \
+ 1 + 8 /* type, sql_mode */ + \
+ 1 + 1 + 255 /* type, length, catalog */ + \
+ 1 + 4 /* type, auto_increment */ + \
+ 1 + 6 /* type, charset */ + \
+ 1 + 1 + 255 /* type, length, time_zone */ + \
+ 1 + 2 /* type, lc_time_names_number */ + \
+ 1 + 2 /* type, charset_database_number */ + \
+ 1 + 8 /* type, table_map_for_update */)
#define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \
LOG_EVENT_HEADER_LEN + /* write_header */ \
QUERY_HEADER_LEN + /* write_data */ \
@@ -273,6 +276,8 @@ struct sql_ex_info
#define Q_LC_TIME_NAMES_CODE 7
#define Q_CHARSET_DATABASE_CODE 8
+
+#define Q_TABLE_MAP_FOR_UPDATE_CODE 9
/* Intvar event post-header */
#define I_TYPE_OFFSET 0
@@ -800,6 +805,11 @@ public:
const char *time_zone_str;
uint lc_time_names_number; /* 0 means en_US */
uint charset_database_number;
+ /*
+ map for tables that will be updated for a multi-table update query
+ statement, for other query statements, this will be zero.
+ */
+ ulonglong table_map_for_update;
#ifndef MYSQL_CLIENT
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ca68976d939..ad3521e5dde 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -186,39 +186,41 @@ int initgroups(const char *,unsigned int);
#ifdef HAVE_FP_EXCEPT // Fix type conflict
typedef fp_except fp_except_t;
#endif
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
+#ifdef HAVE_SYS_FPU_H
+/* for IRIX to use set_fpc_csr() */
+#include <sys/fpu.h>
+#endif
+inline void setup_fpu()
+{
+#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
/* We can't handle floating point exceptions with threads, so disable
this on freebsd
+ Don't fall for overflow, underflow,divide-by-zero or loss of precision
*/
-
-inline void set_proper_floating_point_mode()
-{
- /* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
#if defined(__i386__)
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#else
- fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
- FP_X_IMP));
-#endif
-}
-#elif defined(__sgi)
-/* for IRIX to use set_fpc_csr() */
-#include <sys/fpu.h>
+ fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
+ FP_X_IMP));
+#endif /* __i386__ */
+#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
-inline void set_proper_floating_point_mode()
-{
+#ifdef HAVE_FESETROUND
+ /* Set FPU rounding mode to "round-to-nearest" */
+ fesetround(FE_TONEAREST);
+#endif /* HAVE_FESETROUND */
+
+#if defined(__sgi) && defined(HAVE_SYS_FPU_H)
/* Enable denormalized DOUBLE values support for IRIX */
- {
- union fpc_csr n;
- n.fc_word = get_fpc_csr();
- n.fc_struct.flush = 0;
- set_fpc_csr(n.fc_word);
- }
+ union fpc_csr n;
+ n.fc_word = get_fpc_csr();
+ n.fc_struct.flush = 0;
+ set_fpc_csr(n.fc_word);
+#endif
}
-#else
-#define set_proper_floating_point_mode()
-#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
} /* cplusplus */
@@ -2813,7 +2815,7 @@ static bool init_global_datetime_format(timestamp_type format_type,
*/
opt_date_time_formats[format_type]= str;
}
- if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
+ if (!(*var_ptr= date_time_format_make(format_type, str, (uint) strlen(str))))
{
fprintf(stderr, "Wrong date/time format specifier: %s\n", str);
return 1;
@@ -3039,7 +3041,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
sys_init_slave.value_length= 0;
if ((sys_init_slave.value= opt_init_slave))
- sys_init_slave.value_length= strlen(opt_init_slave);
+ sys_init_slave.value_length= (uint) strlen(opt_init_slave);
else
sys_init_slave.value=my_strdup("",MYF(0));
sys_init_slave.is_os_charset= TRUE;
@@ -3279,7 +3281,7 @@ static int init_server_components()
query_cache_init();
query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
- set_proper_floating_point_mode();
+ setup_fpu();
init_thr_lock();
#ifdef HAVE_REPLICATION
init_slave_list();
@@ -7334,7 +7336,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_STORAGE_ENGINE:
{
if ((enum db_type)((global_system_variables.table_type=
- ha_resolve_by_name(argument, strlen(argument)))) ==
+ ha_resolve_by_name(argument, (uint) strlen(argument)))) ==
DB_TYPE_UNKNOWN)
{
fprintf(stderr,"Unknown/unsupported table type: %s\n",argument);
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index a40764577fd..627a5fae5e3 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -253,7 +253,7 @@ static int net_data_is_ready(my_socket sd)
tv.tv_sec= tv.tv_usec= 0;
- if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0)
+ if ((res= select((int) (sd + 1), &sfds, NULL, NULL, &tv)) < 0)
return 0;
else
return test(res ? FD_ISSET(sd, &sfds) : 0);
@@ -501,7 +501,7 @@ net_write_buff(NET *net,const char *packet,ulong len)
{
ulong left_length;
if (net->compress && net->max_packet > MAX_PACKET_LENGTH)
- left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff);
+ left_length= (ulong) (MAX_PACKET_LENGTH - (net->write_pos - net->buff));
else
left_length= (ulong) (net->buff_end - net->write_pos);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index ebebfafb5d8..c3a43776429 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -673,7 +673,7 @@ int SEL_IMERGE::or_sel_tree(PARAM *param, SEL_TREE *tree)
if (trees_next == trees_end)
{
const int realloc_ratio= 2; /* Double size for next round */
- uint old_elements= (trees_end - trees);
+ uint old_elements= (uint) (trees_end - trees);
uint old_size= sizeof(SEL_TREE**) * old_elements;
uint new_size= old_size * realloc_ratio;
SEL_TREE **new_trees;
@@ -2398,7 +2398,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
{
SEL_TREE **ptree;
TRP_INDEX_MERGE *imerge_trp= NULL;
- uint n_child_scans= imerge->trees_next - imerge->trees;
+ uint n_child_scans= (uint) (imerge->trees_next - imerge->trees);
TRP_RANGE **range_scans;
TRP_RANGE **cur_child;
TRP_RANGE **cpk_scan= NULL;
@@ -2997,7 +2997,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
tuple_arg= tuple_arg->next_key_part;
tuple_arg->store_min(key_part[tuple_arg->part].store_length, &key_ptr, 0);
}
- min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val);
+ min_range.length= max_range.length= (uint) ((char*) key_ptr - (char*) key_val);
records= (info->param->table->file->
records_in_range(scan->keynr, &min_range, &max_range));
if (cur_covered)
@@ -3297,7 +3297,7 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
intersect_scans_best););
*are_all_covering= intersect->is_covering;
- uint best_num= intersect_scans_best - intersect_scans;
+ uint best_num= (uint) (intersect_scans_best - intersect_scans);
ror_intersect_cpy(intersect, intersect_best);
/*
@@ -3474,7 +3474,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
TRP_ROR_INTERSECT *trp;
if (!(trp= new (param->mem_root) TRP_ROR_INTERSECT))
DBUG_RETURN(trp);
- uint best_num= (ror_scan_mark - tree->ror_scans);
+ uint best_num= (uint) (ror_scan_mark - tree->ror_scans);
if (!(trp->first_scan= (ROR_SCAN_INFO**)alloc_root(param->mem_root,
sizeof(ROR_SCAN_INFO*)*
best_num)))
@@ -3594,7 +3594,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
"ROR scans"););
if (key_to_read)
{
- idx= key_to_read - tree->keys;
+ idx= (uint) (key_to_read - tree->keys);
if ((read_plan= new (param->mem_root) TRP_RANGE(*key_to_read, idx)))
{
read_plan->records= best_records;
@@ -4755,7 +4755,7 @@ tree_and(PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
tree1->type= SEL_TREE::IMPOSSIBLE;
DBUG_RETURN(tree1);
}
- result_keys.set_bit(key1 - tree1->keys);
+ result_keys.set_bit((uint) (key1 - tree1->keys));
#ifdef EXTRA_DEBUG
if (*key1 && param->alloced_sel_args < SEL_ARG::MAX_SEL_ARGS)
(*key1)->test_use_count(*key1);
@@ -4837,7 +4837,7 @@ tree_or(PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
if (*key1)
{
result=tree1; // Added to tree1
- result_keys.set_bit(key1 - tree1->keys);
+ result_keys.set_bit((uint) (key1 - tree1->keys));
#ifdef EXTRA_DEBUG
if (param->alloced_sel_args < SEL_ARG::MAX_SEL_ARGS)
(*key1)->test_use_count(*key1);
@@ -6956,8 +6956,8 @@ int QUICK_RANGE_SELECT::get_next()
}
}
- uint count= min(multi_range_length, ranges.elements -
- (cur_range - (QUICK_RANGE**) ranges.buffer));
+ uint count= min(multi_range_length, (uint) (ranges.elements -
+ (cur_range - (QUICK_RANGE**) ranges.buffer)));
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
@@ -7047,7 +7047,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, byte *cur_prefix)
DBUG_RETURN(result);
}
- uint count= ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer);
+ uint count= (uint) (ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer));
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
@@ -7102,7 +7102,7 @@ int QUICK_RANGE_SELECT_GEOM::get_next()
DBUG_RETURN(result);
}
- uint count= ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer);
+ uint count= (uint) (ranges.elements - (cur_range - (QUICK_RANGE**) ranges.buffer));
if (count == 0)
{
/* Ranges have already been used up before. None is left for read. */
@@ -7435,18 +7435,18 @@ void QUICK_RANGE_SELECT::add_keys_and_lengths(String *key_names,
String *used_lengths)
{
char buf[64];
- uint length;
+ size_t length;
KEY *key_info= head->key_info + index;
key_names->append(key_info->name);
length= longlong2str(max_used_key_length, buf, 10) - buf;
- used_lengths->append(buf, length);
+ used_lengths->append(buf, (uint) length);
}
void QUICK_INDEX_MERGE_SELECT::add_keys_and_lengths(String *key_names,
String *used_lengths)
{
char buf[64];
- uint length;
+ size_t length;
bool first= TRUE;
QUICK_RANGE_SELECT *quick;
@@ -7464,7 +7464,7 @@ void QUICK_INDEX_MERGE_SELECT::add_keys_and_lengths(String *key_names,
KEY *key_info= head->key_info + quick->index;
key_names->append(key_info->name);
length= longlong2str(quick->max_used_key_length, buf, 10) - buf;
- used_lengths->append(buf, length);
+ used_lengths->append(buf, (uint) length);
}
if (pk_quick_select)
{
@@ -7473,7 +7473,7 @@ void QUICK_INDEX_MERGE_SELECT::add_keys_and_lengths(String *key_names,
key_names->append(key_info->name);
length= longlong2str(pk_quick_select->max_used_key_length, buf, 10) - buf;
used_lengths->append(',');
- used_lengths->append(buf, length);
+ used_lengths->append(buf, (uint) length);
}
}
@@ -7481,7 +7481,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names,
String *used_lengths)
{
char buf[64];
- uint length;
+ size_t length;
bool first= TRUE;
QUICK_RANGE_SELECT *quick;
List_iterator_fast<QUICK_RANGE_SELECT> it(quick_selects);
@@ -7497,7 +7497,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names,
}
key_names->append(key_info->name);
length= longlong2str(quick->max_used_key_length, buf, 10) - buf;
- used_lengths->append(buf, length);
+ used_lengths->append(buf, (uint) length);
}
if (cpk_quick)
@@ -7507,7 +7507,7 @@ void QUICK_ROR_INTERSECT_SELECT::add_keys_and_lengths(String *key_names,
key_names->append(key_info->name);
length= longlong2str(cpk_quick->max_used_key_length, buf, 10) - buf;
used_lengths->append(',');
- used_lengths->append(buf, length);
+ used_lengths->append(buf, (uint) length);
}
}
@@ -7775,32 +7775,37 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
*/
KEY *cur_index_info= table->key_info;
KEY *cur_index_info_end= cur_index_info + table->s->keys;
- KEY_PART_INFO *cur_part= NULL;
- KEY_PART_INFO *end_part; /* Last part for loops. */
- /* Last index part. */
- KEY_PART_INFO *last_part= NULL;
- KEY_PART_INFO *first_non_group_part= NULL;
- KEY_PART_INFO *first_non_infix_part= NULL;
- uint key_infix_parts= 0;
- uint cur_group_key_parts= 0;
- uint cur_group_prefix_len= 0;
/* Cost-related variables for the best index so far. */
double best_read_cost= DBL_MAX;
ha_rows best_records= 0;
SEL_ARG *best_index_tree= NULL;
ha_rows best_quick_prefix_records= 0;
uint best_param_idx= 0;
- double cur_read_cost= DBL_MAX;
- ha_rows cur_records;
+
+ const uint pk= param->table->s->primary_key;
SEL_ARG *cur_index_tree= NULL;
ha_rows cur_quick_prefix_records= 0;
uint cur_param_idx=MAX_KEY;
- key_map cur_used_key_parts;
- uint pk= param->table->s->primary_key;
for (uint cur_index= 0 ; cur_index_info != cur_index_info_end ;
cur_index_info++, cur_index++)
{
+ KEY_PART_INFO *cur_part;
+ KEY_PART_INFO *end_part; /* Last part for loops. */
+ /* Last index part. */
+ KEY_PART_INFO *last_part;
+ KEY_PART_INFO *first_non_group_part;
+ KEY_PART_INFO *first_non_infix_part;
+ uint key_infix_parts;
+ uint cur_group_key_parts= 0;
+ uint cur_group_prefix_len= 0;
+ double cur_read_cost;
+ ha_rows cur_records;
+ key_map used_key_parts_map;
+ uint cur_key_infix_len= 0;
+ byte cur_key_infix[MAX_KEY_LENGTH];
+ uint cur_used_key_parts;
+
/* Check (B1) - if current index is covering. */
if (!table->used_keys.is_set(cur_index))
goto next_index;
@@ -7879,7 +7884,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
else if (join->select_distinct)
{
select_items_it.rewind();
- cur_used_key_parts.clear_all();
+ used_key_parts_map.clear_all();
uint max_key_part= 0;
while ((item= select_items_it++))
{
@@ -7890,13 +7895,13 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
Check if this attribute was already present in the select list.
If it was present, then its corresponding key part was alredy used.
*/
- if (cur_used_key_parts.is_set(key_part_nr))
+ if (used_key_parts_map.is_set(key_part_nr))
continue;
if (key_part_nr < 1 || key_part_nr > join->fields_list.elements)
goto next_index;
cur_part= cur_index_info->key_part + key_part_nr - 1;
cur_group_prefix_len+= cur_part->store_length;
- cur_used_key_parts.set_bit(key_part_nr);
+ used_key_parts_map.set_bit(key_part_nr);
++cur_group_key_parts;
max_key_part= max(max_key_part,key_part_nr);
}
@@ -7908,7 +7913,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
*/
ulonglong all_parts, cur_parts;
all_parts= (1<<max_key_part) - 1;
- cur_parts= cur_used_key_parts.to_ulonglong() >> 1;
+ cur_parts= used_key_parts_map.to_ulonglong() >> 1;
if (all_parts != cur_parts)
goto next_index;
}
@@ -7958,7 +7963,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
&dummy);
if (!get_constant_key_infix(cur_index_info, index_range_tree,
first_non_group_part, min_max_arg_part,
- last_part, thd, key_infix, &key_infix_len,
+ last_part, thd, cur_key_infix,
+ &cur_key_infix_len,
&first_non_infix_part))
goto next_index;
}
@@ -8010,9 +8016,9 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
}
/* If we got to this point, cur_index_info passes the test. */
- key_infix_parts= key_infix_len ?
+ key_infix_parts= cur_key_infix_len ? (uint)
(first_non_infix_part - first_non_group_part) : 0;
- used_key_parts= cur_group_key_parts + key_infix_parts;
+ cur_used_key_parts= cur_group_key_parts + key_infix_parts;
/* Compute the cost of using this index. */
if (tree)
@@ -8024,7 +8030,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
cur_quick_prefix_records= check_quick_select(param, cur_param_idx,
cur_index_tree);
}
- cost_group_min_max(table, cur_index_info, used_key_parts,
+ cost_group_min_max(table, cur_index_info, cur_used_key_parts,
cur_group_key_parts, tree, cur_index_tree,
cur_quick_prefix_records, have_min, have_max,
&cur_read_cost, &cur_records);
@@ -8035,7 +8041,6 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
*/
if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost))
{
- DBUG_ASSERT(tree != 0 || cur_param_idx == MAX_KEY);
index_info= cur_index_info;
index= cur_index;
best_read_cost= cur_read_cost;
@@ -8045,11 +8050,13 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
best_param_idx= cur_param_idx;
group_key_parts= cur_group_key_parts;
group_prefix_len= cur_group_prefix_len;
+ key_infix_len= cur_key_infix_len;
+ if (key_infix_len)
+ memcpy (key_infix, cur_key_infix, sizeof (key_infix));
+ used_key_parts= cur_used_key_parts;
}
- next_index:
- cur_group_key_parts= 0;
- cur_group_prefix_len= 0;
+ next_index:;
}
if (!index_info) /* No usable index found. */
DBUG_RETURN(NULL);
@@ -8346,7 +8353,7 @@ get_field_keypart(KEY *index, Field *field)
for (part= index->key_part, end= part + index->key_parts; part < end; part++)
{
if (field->eq(part->field))
- return part - index->key_part + 1;
+ return (uint) (part - index->key_part + 1);
}
return 0;
}
@@ -9601,7 +9608,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::add_keys_and_lengths(String *key_names,
char buf[64];
uint length;
key_names->append(index_info->name);
- length= longlong2str(max_used_key_length, buf, 10) - buf;
+ length= (uint) (longlong2str(max_used_key_length, buf, 10) - buf);
used_lengths->append(buf, length);
}
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index 39db1344588..f8603f06fa0 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -636,12 +636,12 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
key_part_map org_key_part_used= *key_part_used;
if (eq_type || between || max_fl == less_fl)
{
- uint length= (key_ptr-ref->key_buff)+part->store_length;
+ size_t length= (key_ptr-ref->key_buff)+part->store_length;
if (ref->key_length < length)
/* Ultimately ref->key_length will contain the length of the search key */
- ref->key_length= length;
+ ref->key_length= (uint) length;
if (!*prefix_len && part+1 == field_part)
- *prefix_len= length;
+ *prefix_len= (uint) length;
if (is_field_part && eq_type)
*prefix_len= ref->key_length;
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index c4b07ed9dac..03e0d25b885 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -215,7 +215,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
dir->str, file_name->str, (ulong) base));
fn_format(path, file_name->str, dir->str, 0, MY_UNPACK_FILENAME);
- path_end= strlen(path);
+ path_end= (uint) strlen(path);
// temporary file name
path[path_end]='~';
@@ -411,7 +411,7 @@ sql_parse_prepare(const LEX_STRING *file_name, MEM_ROOT *mem_root,
sign++;
if (*sign != '\n')
goto frm_error;
- parser->file_type.length= sign - parser->file_type.str;
+ parser->file_type.length= (uint) (sign - parser->file_type.str);
// EOS for file signature just for safety
*sign= '\0';
@@ -456,7 +456,7 @@ parse_string(char *ptr, char *end, MEM_ROOT *mem_root, LEX_STRING *str)
if (eol >= end)
return 0;
- str->length= eol - ptr;
+ str->length= (uint) (eol - ptr);
if (!(str->str= alloc_root(mem_root, str->length+1)))
return 0;
@@ -521,7 +521,7 @@ read_escaped_string(char *ptr, char *eol, LEX_STRING *str)
else
*write_pos= c;
}
- str->str[str->length= write_pos-str->str]= '\0'; // just for safety
+ str->str[str->length= (uint) (write_pos - str->str)]= '\0'; // just for safety
return FALSE;
}
@@ -548,7 +548,7 @@ parse_escaped_string(char *ptr, char *end, MEM_ROOT *mem_root, LEX_STRING *str)
char *eol= strchr(ptr, '\n');
if (eol == 0 || eol >= end ||
- !(str->str= alloc_root(mem_root, (eol - ptr) + 1)) ||
+ !(str->str= alloc_root(mem_root, (uint) ((eol - ptr) + 1))) ||
read_escaped_string(ptr, eol, str))
return 0;
diff --git a/sql/protocol.cc b/sql/protocol.cc
index ff58d96f59b..728b9954f6a 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -306,7 +306,7 @@ send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
pos+=2;
}
if (message)
- pos=net_store_data((char*) pos, message, strlen(message));
+ pos=net_store_data((char*) pos, message, (uint) strlen(message));
VOID(my_net_write(net,buff,(uint) (pos-buff)));
VOID(net_flush(net));
/* We can't anymore send an error to the client */
@@ -616,7 +616,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
else
{
/* With conversion */
- uint max_char_len;
+ ulonglong max_length;
+ uint32 field_length;
int2store(pos, thd_charset->number);
/*
For TEXT/BLOB columns, field_length describes the maximum data
@@ -627,12 +628,22 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
char_count * mbmaxlen, where character count is taken from the
definition of the column. In other words, the maximum number
of characters here is limited by the column definition.
+
+ When one has a LONG TEXT column with a single-byte
+ character set, and the connection character set is multi-byte, the
+ client may get fields longer than UINT_MAX32, due to
+ <character set column> -> <character set connection> conversion.
+ In that case column max length does not fit into the 4 bytes
+ reserved for it in the protocol.
*/
- max_char_len= (field.type >= (int) MYSQL_TYPE_TINY_BLOB &&
- field.type <= (int) MYSQL_TYPE_BLOB) ?
- field.length / item->collation.collation->mbminlen :
- field.length / item->collation.collation->mbmaxlen;
- int4store(pos+2, max_char_len * thd_charset->mbmaxlen);
+ max_length= (field.type >= MYSQL_TYPE_TINY_BLOB &&
+ field.type <= MYSQL_TYPE_BLOB) ?
+ field.length / item->collation.collation->mbminlen :
+ field.length / item->collation.collation->mbmaxlen;
+ max_length*= thd_charset->mbmaxlen;
+ field_length= (max_length > UINT_MAX32) ?
+ UINT_MAX32 : (uint32) max_length;
+ int4store(pos + 2, field_length);
}
pos[6]= field.type;
int2store(pos+7,field.flags);
@@ -724,8 +735,8 @@ bool Protocol::store(const char *from, CHARSET_INFO *cs)
{
if (!from)
return store_null();
- uint length= strlen(from);
- return store(from, length, cs);
+ size_t length= strlen(from);
+ return store(from, (uint) length, cs);
}
diff --git a/sql/set_var.cc b/sql/set_var.cc
index a29abe6581f..735bb5279bd 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1927,7 +1927,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
pthread_mutex_lock(&LOCK_global_system_variables);
char *str= (char*) value_ptr(thd, var_type, base);
if (str)
- tmp= new Item_string(str, strlen(str),
+ tmp= new Item_string(str, (uint) strlen(str),
charset(thd), DERIVATION_SYSCONST);
else
{
@@ -2079,7 +2079,7 @@ void sys_var_thd_date_time_format::set_default(THD *thd, enum_var_type type)
{
const char *format;
if ((format= opt_date_time_formats[date_time_type]))
- res= date_time_format_make(date_time_type, format, strlen(format));
+ res= date_time_format_make(date_time_type, format, (uint) strlen(format));
}
else
{
@@ -3166,10 +3166,10 @@ static byte *get_tmpdir(THD *thd)
static struct my_option *find_option(struct my_option *opt, const char *name)
{
- uint length=strlen(name);
+ size_t length=strlen(name);
for (; opt->name; opt++)
{
- if (!getopt_compare_strings(opt->name, name, length) &&
+ if (!getopt_compare_strings(opt->name, name, (uint) length) &&
!opt->name[length])
{
/*
@@ -3210,7 +3210,7 @@ void set_var_init()
var < end;
var++)
{
- (*var)->name_length= strlen((*var)->name);
+ (*var)->name_length= (uint) strlen((*var)->name);
(*var)->option_limits= find_option(my_long_options, (*var)->name);
my_hash_insert(&system_variable_hash, (byte*) *var);
}
@@ -3249,7 +3249,7 @@ sys_var *find_sys_var(const char *str, uint length)
sys_var *var= (sys_var*) hash_search(&system_variable_hash,
(byte*) str,
length ? length :
- strlen(str));
+ (uint) strlen(str));
if (!var)
my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
return var;
@@ -3479,7 +3479,7 @@ int set_var_password::check(THD *thd)
if (*thd->security_ctx->priv_host != 0)
{
user->host.str= (char *) thd->security_ctx->priv_host;
- user->host.length= strlen(thd->security_ctx->priv_host);
+ user->host.length= (uint) strlen(thd->security_ctx->priv_host);
}
else
{
@@ -3495,7 +3495,7 @@ int set_var_password::check(THD *thd)
}
/* Returns 1 as the function sends error to client */
return check_change_password(thd, user->host.str, user->user.str,
- password, strlen(password)) ? 1 : 0;
+ password, (uint) strlen(password)) ? 1 : 0;
#else
return 0;
#endif
diff --git a/sql/slave.cc b/sql/slave.cc
index b4e74f8e68d..cc82710dec7 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1003,7 +1003,7 @@ int db_ok_with_wild_table(const char *db)
int len;
end= strmov(hash_key, db);
*end++= '.';
- len= end - hash_key ;
+ len= (uint) (end - hash_key);
if (wild_do_table_inited && find_wild(&replicate_wild_do_table,
hash_key, len))
return 1;
@@ -1189,7 +1189,7 @@ void skip_load_data_infile(NET *net)
bool net_request_file(NET* net, const char* fname)
{
DBUG_ENTER("net_request_file");
- DBUG_RETURN(net_write_command(net, 251, fname, strlen(fname), "", 0));
+ DBUG_RETURN(net_write_command(net, 251, fname, (uint) strlen(fname), "", 0));
}
@@ -1581,7 +1581,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
save_db = thd->db;
save_db_length= thd->db_length;
DBUG_ASSERT(db != 0);
- thd->reset_db((char*)db, strlen(db));
+ thd->reset_db((char*)db, (uint) strlen(db));
mysql_parse(thd, thd->query, packet_len, &found_semicolon); // run create table
thd->db = save_db; // leave things the way the were before
thd->db_length= save_db_length;
@@ -2314,11 +2314,11 @@ int register_slave_on_master(MYSQL* mysql)
if (!report_host)
return 0;
- report_host_len= strlen(report_host);
+ report_host_len= (uint) strlen(report_host);
if (report_user)
- report_user_len= strlen(report_user);
+ report_user_len= (uint) strlen(report_user);
if (report_password)
- report_password_len= strlen(report_password);
+ report_password_len= (uint) strlen(report_password);
/* 30 is a good safety margin */
if (report_host_len + report_user_len + report_password_len + 30 >
sizeof(buf))
@@ -3043,7 +3043,7 @@ static int request_table_dump(MYSQL* mysql, const char* db, const char* table)
*p++ = table_len;
memcpy(p, table, table_len);
- if (simple_command(mysql, COM_TABLE_DUMP, buf, p - buf + table_len, 1))
+ if (simple_command(mysql, COM_TABLE_DUMP, buf, (uint) (p - buf + table_len), 1))
{
sql_print_error("request_table_dump: Error sending the table dump \
command");
diff --git a/sql/sp.cc b/sql/sp.cc
index d2a12f2190f..3af51b82521 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -414,7 +414,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
thd->lex= &newlex;
newlex.current_select= NULL;
- parse_user(definer, strlen(definer),
+ parse_user(definer, (uint) strlen(definer),
definer_user_name.str, &definer_user_name.length,
definer_host_name.str, &definer_host_name.length);
@@ -929,7 +929,7 @@ sp_drop_db_routines(THD *thd, char *db)
if (!(table= open_proc_table_for_update(thd)))
goto err;
- table->field[MYSQL_PROC_FIELD_DB]->store(db, strlen(db), system_charset_info);
+ table->field[MYSQL_PROC_FIELD_DB]->store(db, (uint) strlen(db), system_charset_info);
key_len= table->key_info->key_part[0].store_length;
ret= SP_OK;
@@ -1099,8 +1099,8 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
sp_name *name;
LEX_STRING lex_db;
LEX_STRING lex_name;
- lex_db.length= strlen(routine->db);
- lex_name.length= strlen(routine->table_name);
+ lex_db.length= (uint) strlen(routine->db);
+ lex_name.length= (uint) strlen(routine->table_name);
lex_db.str= thd->strmake(routine->db, lex_db.length);
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
name= new sp_name(lex_db, lex_name, true);
@@ -1918,7 +1918,7 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db,
if (thd->db)
{
- old_db->length= (strmake(old_db->str, thd->db, old_db->length - 1) -
+ old_db->length= (uint) (strmake(old_db->str, thd->db, old_db->length - 1) -
old_db->str);
}
else
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 3ec6dd5cf06..b51d97e66c5 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -381,7 +381,7 @@ sp_name::sp_name(THD *thd, char *key, uint key_len)
m_qname.length= key_len - 1;
if ((m_name.str= strchr(m_qname.str, '.')))
{
- m_db.length= m_name.str - key;
+ m_db.length= (uint) (m_name.str - key);
m_db.str= strmake_root(thd->mem_root, key, m_db.length);
m_name.str++;
m_name.length= m_qname.length - m_db.length - 1;
@@ -447,7 +447,7 @@ sp_head::operator new(size_t size) throw()
sp_head *sp;
init_sql_alloc(&own_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
- sp= (sp_head *) alloc_root(&own_root, size);
+ sp= (sp_head *) alloc_root(&own_root, (uint) size);
if (sp == NULL)
DBUG_RETURN(NULL);
sp->main_mem_root= own_root;
@@ -598,7 +598,7 @@ sp_head::init_strings(THD *thd, LEX *lex)
if (m_param_begin && m_param_end)
{
- m_params.length= m_param_end - m_param_begin;
+ m_params.length= (uint) (m_param_end - m_param_begin);
m_params.str= strmake_root(root,
(char *)m_param_begin, m_params.length);
}
@@ -611,9 +611,9 @@ sp_head::init_strings(THD *thd, LEX *lex)
*/
endp= skip_rear_comments(thd->charset(), (char*) m_body_begin, (char*) endp);
- m_body.length= endp - m_body_begin;
+ m_body.length= (uint) (endp - m_body_begin);
m_body.str= strmake_root(root, m_body_begin, m_body.length);
- m_defstr.length= endp - lip->buf;
+ m_defstr.length= (uint) (endp - lip->buf);
m_defstr.str= strmake_root(root, lip->buf, m_defstr.length);
DBUG_VOID_RETURN;
}
@@ -3606,7 +3606,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
memcpy(tname+tlen, table->table_name, table->table_name_length);
tlen+= table->table_name_length;
tname[tlen++]= '\0';
- alen= strlen(table->alias);
+ alen= (uint) strlen(table->alias);
memcpy(tname+tlen, table->alias, alen);
tlen+= alen;
tname[tlen]= '\0';
@@ -3771,9 +3771,9 @@ sp_add_to_query_tables(THD *thd, LEX *lex,
thd->fatal_error();
return NULL;
}
- table->db_length= strlen(db);
+ table->db_length= (uint) strlen(db);
table->db= thd->strmake(db, table->db_length);
- table->table_name_length= strlen(name);
+ table->table_name_length= (uint) strlen(name);
table->table_name= thd->strmake(name, table->table_name_length);
table->alias= thd->strdup(name);
table->lock_type= locktype;
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 69d0c15748a..80506f16d0f 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -54,7 +54,7 @@ static Geometry::Class_info **ci_collection_end=
Geometry::Class_info::Class_info(const char *name, int type_id,
void(*create_func)(void *)):
- m_name(name, strlen(name)), m_type_id(type_id), m_create_func(create_func)
+ m_name(name, (uint) strlen(name)), m_type_id(type_id), m_create_func(create_func)
{
ci_collection[type_id]= this;
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 22135d376fe..b2d0304f007 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -313,8 +313,8 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
}
const char *password= get_field(thd->mem_root, table->field[2]);
- uint password_len= password ? strlen(password) : 0;
- set_user_salt(&user, password, password_len);
+ size_t password_len= password ? strlen(password) : 0;
+ set_user_salt(&user, password, (uint) password_len);
if (user.salt_len == 0 && password_len != 0)
{
switch (password_len) {
@@ -1405,7 +1405,7 @@ int check_change_password(THD *thd, const char *host, const char *user,
MYF(0));
return(1);
}
- uint len=strlen(new_password);
+ size_t len= strlen(new_password);
if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
@@ -1439,14 +1439,14 @@ bool change_password(THD *thd, const char *host, const char *user,
/* Buffer should be extended when password length is extended. */
char buff[512];
ulong query_length;
- uint new_password_len= strlen(new_password);
+ size_t new_password_len= strlen(new_password);
bool result= 1;
DBUG_ENTER("change_password");
DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
host,user,new_password));
DBUG_ASSERT(host != 0); // Ensured by parent
- if (check_change_password(thd, host, user, new_password, new_password_len))
+ if (check_change_password(thd, host, user, new_password, (uint) new_password_len))
DBUG_RETURN(1);
bzero((char*) &tables, sizeof(tables));
@@ -1483,12 +1483,12 @@ bool change_password(THD *thd, const char *host, const char *user,
goto end;
}
/* update loaded acl entry: */
- set_user_salt(acl_user, new_password, new_password_len);
+ set_user_salt(acl_user, new_password, (uint) new_password_len);
if (update_user_table(thd, table,
acl_user->host.hostname ? acl_user->host.hostname : "",
acl_user->user ? acl_user->user : "",
- new_password, new_password_len))
+ new_password, (uint) new_password_len))
{
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
goto end;
@@ -1641,11 +1641,11 @@ bool hostname_requires_resolving(const char *hostname)
char cur;
if (!hostname)
return FALSE;
- int namelen= strlen(hostname);
- int lhlen= strlen(my_localhost);
+ size_t namelen= strlen(hostname);
+ size_t lhlen= strlen(my_localhost);
if ((namelen == lhlen) &&
- !my_strnncoll(system_charset_info, (const uchar *)hostname, namelen,
- (const uchar *)my_localhost, strlen(my_localhost)))
+ !my_strnncoll(system_charset_info, (const uchar *)hostname, (uint) namelen,
+ (const uchar *)my_localhost, (uint) strlen(my_localhost)))
return FALSE;
for (; (cur=*hostname); hostname++)
{
@@ -1873,13 +1873,13 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
table->field[next_field+3]->store("", 0, &my_charset_latin1);
if (lex->ssl_cipher)
table->field[next_field+1]->store(lex->ssl_cipher,
- strlen(lex->ssl_cipher), system_charset_info);
+ (uint) strlen(lex->ssl_cipher), system_charset_info);
if (lex->x509_issuer)
table->field[next_field+2]->store(lex->x509_issuer,
- strlen(lex->x509_issuer), system_charset_info);
+ (uint) strlen(lex->x509_issuer), system_charset_info);
if (lex->x509_subject)
table->field[next_field+3]->store(lex->x509_subject,
- strlen(lex->x509_subject), system_charset_info);
+ (uint) strlen(lex->x509_subject), system_charset_info);
break;
case SSL_TYPE_NOT_SPECIFIED:
break;
@@ -3866,6 +3866,11 @@ bool check_grant_all_columns(THD *thd, ulong want_access_arg,
Security_context *sctx= thd->security_ctx;
ulong want_access= want_access_arg;
const char *table_name= NULL;
+ /*
+ Flag that gets set if privilege checking has to be performed on column
+ level.
+ */
+ bool using_column_privileges= FALSE;
if (grant_option)
{
@@ -3909,6 +3914,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access_arg,
GRANT_COLUMN *grant_column=
column_hash_search(grant_table, field_name,
(uint) strlen(field_name));
+ if (grant_column)
+ using_column_privileges= TRUE;
if (!grant_column || (~grant_column->rights & want_access))
goto err;
}
@@ -3924,12 +3931,21 @@ err:
char command[128];
get_privilege_desc(command, sizeof(command), want_access);
- my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
- command,
- sctx->priv_user,
- sctx->host_or_ip,
- fields->name(),
- table_name);
+ /*
+ Do not give an error message listing a column name unless the user has
+ privilege to see all columns.
+ */
+ if (using_column_privileges)
+ my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
+ command, sctx->priv_user,
+ sctx->host_or_ip, table_name);
+ else
+ my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0),
+ command,
+ sctx->priv_user,
+ sctx->host_or_ip,
+ fields->name(),
+ table_name);
return 1;
}
@@ -4186,10 +4202,10 @@ static void add_user_option(String *grant, ulong value, const char *name)
{
char buff[22], *p; // just as in int2str
grant->append(' ');
- grant->append(name, strlen(name));
+ grant->append(name, (uint) strlen(name));
grant->append(' ');
p=int10_to_str(value, buff, 10);
- grant->append(buff,p-buff);
+ grant->append(buff,(uint) (p - buff));
}
}
@@ -4327,7 +4343,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
{
ssl_options++;
global.append(STRING_WITH_LEN("ISSUER \'"));
- global.append(acl_user->x509_issuer,strlen(acl_user->x509_issuer));
+ global.append(acl_user->x509_issuer,(uint) strlen(acl_user->x509_issuer));
global.append('\'');
}
if (acl_user->x509_subject)
@@ -4335,7 +4351,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (ssl_options++)
global.append(' ');
global.append(STRING_WITH_LEN("SUBJECT \'"));
- global.append(acl_user->x509_subject,strlen(acl_user->x509_subject),
+ global.append(acl_user->x509_subject,(uint) strlen(acl_user->x509_subject),
system_charset_info);
global.append('\'');
}
@@ -4344,7 +4360,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (ssl_options++)
global.append(' ');
global.append(STRING_WITH_LEN("CIPHER '"));
- global.append(acl_user->ssl_cipher,strlen(acl_user->ssl_cipher),
+ global.append(acl_user->ssl_cipher,(uint) strlen(acl_user->ssl_cipher),
system_charset_info);
global.append('\'');
}
@@ -4424,13 +4440,13 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
db.append (STRING_WITH_LEN(" ON "));
- append_identifier(thd, &db, acl_db->db, strlen(acl_db->db));
+ append_identifier(thd, &db, acl_db->db, (uint) strlen(acl_db->db));
db.append (STRING_WITH_LEN(".* TO '"));
db.append(lex_user->user.str, lex_user->user.length,
system_charset_info);
db.append (STRING_WITH_LEN("'@'"));
// host and lex_user->host are equal except for case
- db.append(host, strlen(host), system_charset_info);
+ db.append(host, (uint) strlen(host), system_charset_info);
db.append ('\'');
if (want_access & GRANT_ACL)
db.append(STRING_WITH_LEN(" WITH GRANT OPTION"));
@@ -4536,16 +4552,16 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
global.append(STRING_WITH_LEN(" ON "));
append_identifier(thd, &global, grant_table->db,
- strlen(grant_table->db));
+ (uint) strlen(grant_table->db));
global.append('.');
append_identifier(thd, &global, grant_table->tname,
- strlen(grant_table->tname));
+ (uint) strlen(grant_table->tname));
global.append(STRING_WITH_LEN(" TO '"));
global.append(lex_user->user.str, lex_user->user.length,
system_charset_info);
global.append(STRING_WITH_LEN("'@'"));
// host and lex_user->host are equal except for case
- global.append(host, strlen(host), system_charset_info);
+ global.append(host, (uint) strlen(host), system_charset_info);
global.append('\'');
if (table_access & GRANT_ACL)
global.append(STRING_WITH_LEN(" WITH GRANT OPTION"));
@@ -4642,16 +4658,16 @@ static int show_routine_grants(THD* thd, LEX_USER *lex_user, HASH *hash,
global.append(type,typelen);
global.append(' ');
append_identifier(thd, &global, grant_proc->db,
- strlen(grant_proc->db));
+ (uint) strlen(grant_proc->db));
global.append('.');
append_identifier(thd, &global, grant_proc->tname,
- strlen(grant_proc->tname));
+ (uint) strlen(grant_proc->tname));
global.append(STRING_WITH_LEN(" TO '"));
global.append(lex_user->user.str, lex_user->user.length,
system_charset_info);
global.append(STRING_WITH_LEN("'@'"));
// host and lex_user->host are equal except for case
- global.append(host, strlen(host), system_charset_info);
+ global.append(host, (uint) strlen(host), system_charset_info);
global.append('\'');
if (proc_access & GRANT_ACL)
global.append(STRING_WITH_LEN(" WITH GRANT OPTION"));
@@ -5769,11 +5785,11 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
{
LEX_USER lex_user;
lex_user.user.str= grant_proc->user;
- lex_user.user.length= strlen(grant_proc->user);
+ lex_user.user.length= (uint) strlen(grant_proc->user);
lex_user.host.str= grant_proc->host.hostname ?
grant_proc->host.hostname : (char*)"";
lex_user.host.length= grant_proc->host.hostname ?
- strlen(grant_proc->host.hostname) : 0;
+ (uint) strlen(grant_proc->host.hostname) : 0;
if (!replace_routine_table(thd,grant_proc,tables[4].table,lex_user,
grant_proc->db, grant_proc->tname,
is_proc, ~(ulong)0, 1))
@@ -5852,8 +5868,8 @@ int sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
tables->db= (char*)sp_db;
tables->table_name= tables->alias= (char*)sp_name;
- combo->host.length= strlen(combo->host.str);
- combo->user.length= strlen(combo->user.str);
+ combo->host.length= (uint) strlen(combo->host.str);
+ combo->user.length= (uint) strlen(combo->user.str);
combo->host.str= thd->strmake(combo->host.str,combo->host.length);
combo->user.str= thd->strmake(combo->user.str,combo->user.length);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 881c6a421e8..0cf3e023be9 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -780,10 +780,10 @@ void close_temporary_tables(THD *thd)
We are going to add 4 ` around the db/table names and possible more
due to special characters in the names
*/
- append_identifier(thd, &s_query, table->s->db, strlen(table->s->db));
+ append_identifier(thd, &s_query, table->s->db, (uint) strlen(table->s->db));
s_query.q_append('.');
append_identifier(thd, &s_query, table->s->table_name,
- strlen(table->s->table_name));
+ (uint) strlen(table->s->table_name));
s_query.q_append(',');
next= table->next;
close_temporary(table, 1);
@@ -3690,7 +3690,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
if (field_ptr && *field_ptr)
{
- *cached_field_index_ptr= field_ptr - table->field;
+ *cached_field_index_ptr= (uint) (field_ptr - table->field);
field= *field_ptr;
}
else
@@ -5479,7 +5479,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Ensure that we have access rights to all fields to be inserted. */
- if (!((table && (table->grant.privilege & SELECT_ACL) ||
+ if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL) ||
tables->view && (tables->grant.privilege & SELECT_ACL))) &&
!any_privileges)
{
@@ -5992,7 +5992,7 @@ my_bool mysql_rm_tmp_tables(void)
if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length))
{
char *ext= fn_ext(file->name);
- uint ext_len= strlen(ext);
+ size_t ext_len= strlen(ext);
uint filePath_len= my_snprintf(filePath, sizeof(filePath),
"%s%s", tmpdir, file->name);
if (!bcmp(reg_ext, ext, ext_len))
@@ -6264,7 +6264,7 @@ open_new_frm(THD *thd, const char *path, const char *alias,
DBUG_ENTER("open_new_frm");
pathstr.str= (char*) path;
- pathstr.length= strlen(path);
+ pathstr.length= (uint) strlen(path);
if ((parser= sql_parse_prepare(&pathstr, mem_root, 1)))
{
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index b55fa148e24..bd56994e216 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -363,6 +363,43 @@ TYPELIB query_cache_type_typelib=
array_elements(query_cache_type_names)-1,"", query_cache_type_names, NULL
};
+
+/**
+ Helper function for determine if a SELECT statement has a SQL_NO_CACHE
+ directive.
+
+ @param sql A pointer to the first white space character after SELECT
+
+ @return
+ @retval TRUE The character string contains SQL_NO_CACHE
+ @retval FALSE No directive found.
+*/
+
+static bool has_no_cache_directive(char *sql)
+{
+ int i=0;
+ while (sql[i] == ' ')
+ ++i;
+
+ if (my_toupper(system_charset_info, sql[i]) == 'S' &&
+ my_toupper(system_charset_info, sql[i+1]) == 'Q' &&
+ my_toupper(system_charset_info, sql[i+2]) == 'L' &&
+ my_toupper(system_charset_info, sql[i+3]) == '_' &&
+ my_toupper(system_charset_info, sql[i+4]) == 'N' &&
+ my_toupper(system_charset_info, sql[i+5]) == 'O' &&
+ my_toupper(system_charset_info, sql[i+6]) == '_' &&
+ my_toupper(system_charset_info, sql[i+7]) == 'C' &&
+ my_toupper(system_charset_info, sql[i+8]) == 'A' &&
+ my_toupper(system_charset_info, sql[i+9]) == 'C' &&
+ my_toupper(system_charset_info, sql[i+10]) == 'H' &&
+ my_toupper(system_charset_info, sql[i+11]) == 'E' &&
+ my_toupper(system_charset_info, sql[i+12]) == ' ')
+ return TRUE;
+
+ return FALSE;
+}
+
+
/*****************************************************************************
Query_cache_block_table method(s)
*****************************************************************************/
@@ -1095,6 +1132,16 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
goto err;
}
+
+ if (query_length > 20 && has_no_cache_directive(&sql[i+6]))
+ {
+ /*
+ We do not increase 'refused' statistics here since it will be done
+ later when the query is parsed.
+ */
+ DBUG_PRINT("qcache", ("The statement has a SQL_NO_CACHE directive"));
+ goto err;
+ }
}
#ifdef __WIN__
@@ -3126,7 +3173,7 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
{
ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
MYRG_INFO *file = handler->myrg_info();
- table_count+= (file->end_table - file->open_tables);
+ table_count+= (uint) (file->end_table - file->open_tables);
}
}
}
@@ -3313,7 +3360,7 @@ my_bool Query_cache::move_by_type(byte **border,
*pprev = block->pprev,
*pnext = block->pnext,
*new_block =(Query_cache_block *) *border;
- uint tablename_offset = block->table()->table() - block->table()->db();
+ size_t tablename_offset= block->table()->table() - block->table()->db();
char *data = (char*) block->data();
byte *key;
uint key_length;
@@ -3625,7 +3672,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path,
filename= tablename + dirname_length(tablename + 2) + 2;
/* Find start of databasename */
for (dbname= filename - 2 ; dbname[-1] != FN_LIBCHAR ; dbname--) ;
- *db_length= (filename - dbname) - 1;
+ *db_length= (uint) ((filename - dbname) - 1);
DBUG_PRINT("qcache", ("table '%-.*s.%s'", *db_length, dbname, filename));
DBUG_RETURN((uint) (strmov(strmake(key, dbname, *db_length) + 1,
@@ -3934,8 +3981,8 @@ my_bool Query_cache::check_integrity(bool locked)
}
else
{
- int idx = (((byte*)bin) - ((byte*)bins)) /
- sizeof(Query_cache_memory_bin);
+ int idx = (int) ((((byte*)bin) - ((byte*)bins)) /
+ sizeof(Query_cache_memory_bin));
if (in_list(bins[idx].free_blocks, block, "free memory"))
result = 1;
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 91c0aa66761..74bc669a049 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -172,7 +172,9 @@ THD::THD()
/* statement id */ 0),
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),
+ user_time(0), in_sub_stmt(0),
+ table_map_for_update(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),
@@ -341,6 +343,12 @@ void THD::init(void)
if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;
options= thd_startup_options;
+
+ if (variables.max_join_size == HA_POS_ERROR)
+ options |= OPTION_BIG_SELECTS;
+ else
+ options &= ~OPTION_BIG_SELECTS;
+
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 ?
@@ -651,6 +659,8 @@ void THD::cleanup_after_query()
free_items();
/* Reset where. */
where= THD::DEFAULT_WHERE;
+ /* reset table map for multi-table update */
+ table_map_for_update= 0;
}
@@ -1047,6 +1057,11 @@ bool select_send::send_data(List<Item> &items)
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
break;
}
+ /*
+ Reset buffer to its original state, as it may have been altered in
+ Item::send().
+ */
+ buffer.set(buff, sizeof(buff), &my_charset_bin);
}
thd->sent_row_count++;
if (!thd->vio_ok())
@@ -1743,7 +1758,7 @@ void Query_arena::set_query_arena(Query_arena *set)
void Query_arena::cleanup_stmt()
{
- DBUG_ASSERT("Query_arena::cleanup_stmt()" == "not implemented");
+ DBUG_ASSERT(! "Query_arena::cleanup_stmt() not implemented");
}
/*
diff --git a/sql/sql_class.h b/sql/sql_class.h
index cc7ef7809d4..3e3dfcd08fa 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1358,6 +1358,13 @@ public:
Note: in the parser, stmt_arena == thd, even for PS/SP.
*/
Query_arena *stmt_arena;
+
+ /*
+ map for tables that will be updated for a multi-table update query
+ statement, for other query statements, this will be zero.
+ */
+ table_map table_map_for_update;
+
/*
next_insert_id is set on SET INSERT_ID= #. This is used as the next
generated auto_increment value in handler.cc
diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc
index 367b9e38e56..38dfc869b3a 100644
--- a/sql/sql_crypt.cc
+++ b/sql/sql_crypt.cc
@@ -31,7 +31,7 @@
SQL_CRYPT::SQL_CRYPT(const char *password)
{
ulong rand_nr[2];
- hash_password(rand_nr,password, strlen(password));
+ hash_password(rand_nr,password, (uint) strlen(password));
crypt_init(rand_nr);
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index c3cf7429222..80fea3ef1b1 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -239,7 +239,7 @@ void del_dbopt(const char *path)
my_dbopt_t *opt;
rw_wrlock(&LOCK_dboptions);
if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const byte*) path,
- strlen(path))))
+ (uint) strlen(path))))
hash_delete(&dboptions, (byte*) opt);
rw_unlock(&LOCK_dboptions);
}
@@ -582,7 +582,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
# database does not exist.
*/
qinfo.db = db;
- qinfo.db_len = strlen(db);
+ qinfo.db_len = (uint) strlen(db);
/* These DDL methods and logging protected with LOCK_mysql_create_db */
mysql_bin_log.write(&qinfo);
@@ -653,7 +653,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
default.
*/
qinfo.db = db;
- qinfo.db_len = strlen(db);
+ qinfo.db_len = (uint) strlen(db);
thd->clear_error();
/* These DDL methods and logging protected with LOCK_mysql_create_db */
@@ -777,7 +777,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
default.
*/
qinfo.db = db;
- qinfo.db_len = strlen(db);
+ qinfo.db_len = (uint) strlen(db);
thd->clear_error();
/* These DDL methods and logging protected with LOCK_mysql_create_db */
@@ -797,18 +797,18 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
goto exit; /* not much else we can do */
query_pos= query_data_start= strmov(query,"drop table ");
query_end= query + MAX_DROP_TABLE_Q_LEN;
- db_len= strlen(db);
+ db_len= (uint) strlen(db);
for (tbl= dropped_tables; tbl; tbl= tbl->next_local)
{
uint tbl_name_len;
/* 3 for the quotes and the comma*/
- tbl_name_len= strlen(tbl->table_name) + 3;
+ tbl_name_len= (uint) strlen(tbl->table_name) + 3;
if (query_pos + tbl_name_len + 1 >= query_end)
{
/* These DDL methods and logging protected with LOCK_mysql_create_db */
- write_to_binlog(thd, query, query_pos -1 - query, db, db_len);
+ write_to_binlog(thd, query, (uint) (query_pos - 1 - query), db, db_len);
query_pos= query_data_start;
}
@@ -821,7 +821,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
if (query_pos != query_data_start)
{
/* These DDL methods and logging protected with LOCK_mysql_create_db */
- write_to_binlog(thd, query, query_pos -1 - query, db, db_len);
+ write_to_binlog(thd, query, (uint) (query_pos - 1 - query), db, db_len);
}
}
@@ -938,7 +938,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
/* Drop the table nicely */
*extension= 0; // Remove extension
TABLE_LIST *table_list=(TABLE_LIST*)
- thd->calloc(sizeof(*table_list)+ strlen(db)+strlen(file->name)+2);
+ thd->calloc((uint) (sizeof(*table_list)+ strlen(db)+strlen(file->name)+2));
if (!table_list)
goto err;
table_list->db= (char*) (table_list+1);
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 84622398f6f..830d1b7c36f 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -177,7 +177,7 @@ exit:
orig_table_list->derived_result= derived_result;
orig_table_list->table= table;
orig_table_list->table_name= (char*) table->s->table_name;
- orig_table_list->table_name_length= strlen((char*)table->s->table_name);
+ orig_table_list->table_name_length= (uint) strlen((char*)table->s->table_name);
table->derived_select_number= first_select->select_number;
table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 344a0c00db8..8f825f83df1 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -243,7 +243,7 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
protocol->store(warning_level_names[err->level],
warning_level_length[err->level], system_charset_info);
protocol->store((uint32) err->code);
- protocol->store(err->msg, strlen(err->msg), system_charset_info);
+ protocol->store(err->msg, (uint) strlen(err->msg), system_charset_info);
if (protocol->write())
DBUG_RETURN(TRUE);
}
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 822f2b2c419..c376f1b3d1d 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -90,7 +90,7 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags);
static char *mysql_ha_hash_get_key(TABLE_LIST *tables, uint *key_len_p,
my_bool first __attribute__((unused)))
{
- *key_len_p= strlen(tables->alias) + 1 ; /* include '\0' in comparisons */
+ *key_len_p= (uint) strlen(tables->alias) + 1 ; /* include '\0' in comparisons */
return tables->alias;
}
@@ -151,6 +151,9 @@ static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
}
VOID(pthread_mutex_unlock(&LOCK_open));
}
+
+ /* Mark table as closed, ready for re-open if necessary. */
+ tables->table= NULL;
}
/*
@@ -168,8 +171,7 @@ static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
'reopen' is set when a handler table is to be re-opened. In this case,
'tables' is the pointer to the hashed TABLE_LIST object which has been
saved on the original open.
- 'reopen' is also used to suppress the sending of an 'ok' message or
- error messages.
+ 'reopen' is also used to suppress the sending of an 'ok' message.
RETURN
FALSE OK
@@ -202,11 +204,10 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
else if (! reopen) /* Otherwise we have 'tables' already. */
{
if (hash_search(&thd->handler_tables_hash, (byte*) tables->alias,
- strlen(tables->alias) + 1))
+ (uint) strlen(tables->alias) + 1))
{
DBUG_PRINT("info",("duplicate '%s'", tables->alias));
- if (! reopen)
- my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias);
+ my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias);
goto err;
}
}
@@ -251,17 +252,16 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
/* There can be only one table in '*tables'. */
if (! (tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
{
- if (! reopen)
- my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
+ my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
goto err;
}
if (! reopen)
{
/* copy the TABLE_LIST struct */
- dblen= strlen(tables->db) + 1;
- namelen= strlen(tables->table_name) + 1;
- aliaslen= strlen(tables->alias) + 1;
+ dblen= (uint) strlen(tables->db) + 1;
+ namelen= (uint) strlen(tables->table_name) + 1;
+ aliaslen= (uint) strlen(tables->alias) + 1;
if (!(my_multi_malloc(MYF(MY_WME),
&hash_tables, sizeof(*hash_tables),
&db, dblen,
@@ -324,7 +324,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
(byte*) tables->alias,
- strlen(tables->alias) + 1)))
+ (uint) strlen(tables->alias) + 1)))
{
mysql_ha_close_table(thd, hash_tables);
hash_delete(&thd->handler_tables_hash, (byte*) hash_tables);
@@ -396,7 +396,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
retry:
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
(byte*) tables->alias,
- strlen(tables->alias) + 1)))
+ (uint) strlen(tables->alias) + 1)))
{
table= hash_tables->table;
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
@@ -464,8 +464,7 @@ retry:
if (need_reopen)
{
- mysql_ha_close_table(thd, tables);
- hash_tables->table= NULL;
+ mysql_ha_close_table(thd, hash_tables);
/*
The lock might have been aborted, we need to manually reset
thd->some_tables_deleted because handler's tables are closed
@@ -779,7 +778,7 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
(byte*) table->alias,
- strlen(table->alias) + 1)))
+ (uint) strlen(table->alias) + 1)))
{
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
{
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 6036a687274..e369a72fa9f 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -628,7 +628,7 @@ bool mysqld_help(THD *thd, const char *mask)
List<String> topics_list, categories_list, subcategories_list;
String name, description, example;
int count_topics, count_categories, error;
- uint mlen= strlen(mask);
+ size_t mlen= strlen(mask);
size_t i;
MEM_ROOT *mem_root= thd->mem_root;
DBUG_ENTER("mysqld_help");
@@ -668,7 +668,7 @@ bool mysqld_help(THD *thd, const char *mask)
tables[i].table->file->init_table_handle_for_HANDLER();
if (!(select=
- prepare_select_for_name(thd,mask,mlen,tables,tables[0].table,
+ prepare_select_for_name(thd,mask,(uint) mlen,tables,tables[0].table,
used_fields[help_topic_name].field,&error)))
goto error;
@@ -681,7 +681,7 @@ bool mysqld_help(THD *thd, const char *mask)
{
int key_id;
if (!(select=
- prepare_select_for_name(thd,mask,mlen,tables,tables[3].table,
+ prepare_select_for_name(thd,mask,(uint) mlen,tables,tables[3].table,
used_fields[help_keyword_name].field,&error)))
goto error;
@@ -698,7 +698,7 @@ bool mysqld_help(THD *thd, const char *mask)
int16 category_id;
Field *cat_cat_id= used_fields[help_category_parent_category_id].field;
if (!(select=
- prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
+ prepare_select_for_name(thd,mask,(uint) mlen,tables,tables[1].table,
used_fields[help_category_name].field,&error)))
goto error;
@@ -759,7 +759,7 @@ bool mysqld_help(THD *thd, const char *mask)
send_variant_2_list(mem_root,protocol, &topics_list, "N", 0))
goto error;
if (!(select=
- prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
+ prepare_select_for_name(thd,mask,(uint) mlen,tables,tables[1].table,
used_fields[help_category_name].field,&error)))
goto error;
search_categories(thd, tables[1].table, used_fields,
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 4eddcd17df1..2fe0a30f519 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1819,7 +1819,7 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list)
pthread_mutex_lock(&LOCK_thread_count);
thread_count++;
pthread_mutex_unlock(&LOCK_thread_count);
- di->thd.set_db(table_list->db, strlen(table_list->db));
+ di->thd.set_db(table_list->db, (uint) 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)
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 71aa80b8170..4c53772bc25 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -858,7 +858,7 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_HEX_NUMBER: // Found x'hexstring'
yyGet(); // Skip '
while (my_isxdigit(cs,(c = yyGet()))) ;
- length=(lip->ptr - lip->tok_start); // Length of hexnum+3
+ length=(uint) (lip->ptr - lip->tok_start); // Length of hexnum+3
if (!(length & 1) || c != '\'')
{
return(ABORT_SYM); // Illegal hex constant
@@ -872,7 +872,7 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_BIN_NUMBER: // Found b'bin-string'
yyGet(); // Skip '
while ((c= yyGet()) == '0' || c == '1');
- length= (lip->ptr - lip->tok_start); // Length of bin-num + 3
+ length= (uint) (lip->ptr - lip->tok_start); // Length of bin-num + 3
if (c != '\'')
return(ABORT_SYM); // Illegal hex constant
yyGet(); // get_token makes an unget
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 5477610bb05..5b9f8ea441d 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -526,8 +526,8 @@ static bool write_execute_load_query_log_event(THD *thd,
{
Execute_load_query_log_event
e(thd, thd->query, thd->query_length,
- (char*)thd->lex->fname_start - (char*)thd->query,
- (char*)thd->lex->fname_end - (char*)thd->query,
+ (uint) ((char*)thd->lex->fname_start - (char*)thd->query),
+ (uint) ((char*)thd->lex->fname_end - (char*)thd->query),
(duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE :
(ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR),
transactional_table, FALSE, killed_err_arg);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 1d3632fd468..2297283c92d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -250,7 +250,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
USER_RESOURCES *mqh)
{
int return_val= 0;
- uint temp_len, user_len;
+ size_t temp_len, user_len;
char temp_user[USER_HOST_BUFF_SIZE];
struct user_conn *uc;
@@ -261,7 +261,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1;
(void) pthread_mutex_lock(&LOCK_user_conn);
if (!(uc = (struct user_conn *) hash_search(&hash_user_connections,
- (byte*) temp_user, temp_len)))
+ (byte*) temp_user, (uint) temp_len)))
{
/* First connection for user; Create a user connection object */
if (!(uc= ((struct user_conn*)
@@ -275,7 +275,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
uc->user=(char*) (uc+1);
memcpy(uc->user,temp_user,temp_len+1);
uc->host= uc->user + user_len + 1;
- uc->len= temp_len;
+ uc->len= (uint) temp_len;
uc->connections= uc->questions= uc->updates= uc->conn_per_hour= 0;
uc->user_resources= *mqh;
uc->intime= thd->thr_create_time;
@@ -328,7 +328,7 @@ int check_user(THD *thd, enum enum_server_command command,
bool check_count)
{
DBUG_ENTER("check_user");
- LEX_STRING db_str= { (char *) db, db ? strlen(db) : 0 };
+ LEX_STRING db_str= { (char *) db, db ? (uint) strlen(db) : 0 };
#ifdef NO_EMBEDDED_ACCESS_CHECKS
thd->main_security_ctx.master_access= GLOBAL_ACLS; // Full rights
@@ -1036,7 +1036,7 @@ static int check_connection(THD *thd)
char *user= end;
char *passwd= strend(user)+1;
- uint user_len= passwd - user - 1;
+ size_t user_len= passwd - user - 1;
char *db= passwd;
char db_buff[NAME_LEN + 1]; // buffer to store db in utf8
char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
@@ -1051,10 +1051,10 @@ static int check_connection(THD *thd)
*passwd > 127 and become 2**32-127 after casting to uint.
*/
uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
- (uchar)(*passwd++) : strlen(passwd);
+ (uchar)(*passwd++) : (uint) strlen(passwd);
db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
db + passwd_len + 1 : 0;
- uint db_len= db ? strlen(db) : 0;
+ size_t db_len= db ? strlen(db) : 0;
if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len)
{
@@ -1067,13 +1067,13 @@ static int check_connection(THD *thd)
{
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
system_charset_info,
- db, db_len,
+ db, (uint) db_len,
thd->charset(), &dummy_errors)]= 0;
db= db_buff;
}
user_buff[user_len= copy_and_convert(user_buff, sizeof(user_buff)-1,
- system_charset_info, user, user_len,
+ system_charset_info, user, (uint) user_len,
thd->charset(), &dummy_errors)]= '\0';
user= user_buff;
@@ -1769,7 +1769,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment(thd->status_var.com_stat[SQLCOM_CHANGE_DB],
&LOCK_status);
thd->convert_string(&tmp, system_charset_info,
- packet, strlen(packet), thd->charset());
+ packet, (uint) strlen(packet), thd->charset());
if (!mysql_change_db(thd, &tmp, FALSE))
{
mysql_log.write(thd,command,"%s",thd->db);
@@ -1832,7 +1832,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
*/
char db_buff[NAME_LEN+1]; // buffer to store db in utf8
char *db= passwd;
- uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
+ size_t passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
(uchar)(*passwd++) : strlen(passwd);
db+= passwd_len + 1;
#ifndef EMBEDDED_LIBRARY
@@ -1846,7 +1846,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Convert database name to utf8 */
uint dummy_errors;
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
- system_charset_info, db, strlen(db),
+ system_charset_info, db, (uint) strlen(db),
thd->charset(), &dummy_errors)]= 0;
db= db_buff;
@@ -1865,7 +1865,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
/* Clear variables that are allocated */
thd->user_connect= 0;
- int res= check_user(thd, COM_CHANGE_USER, passwd, passwd_len, db, FALSE);
+ int res= check_user(thd, COM_CHANGE_USER, passwd, (uint) passwd_len, db, FALSE);
if (res)
{
@@ -2011,7 +2011,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
table_list.schema_table= schema_table;
}
- thd->query_length= strlen(packet); // for simplicity: don't optimize
+ thd->query_length= (uint) strlen(packet); // for simplicity: don't optimize
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
break;
mysql_log.write(thd,command,"%s %s",table_list.table_name, fields);
@@ -2584,6 +2584,10 @@ mysql_execute_command(THD *thd)
TABLE_LIST *all_tables;
/* most outer SELECT_LEX_UNIT of query */
SELECT_LEX_UNIT *unit= &lex->unit;
+#ifdef HAVE_REPLICATION
+ /* have table map for update for multi-update statement (BUG#37051) */
+ bool have_table_map_for_update= FALSE;
+#endif
/* Saved variable value */
DBUG_ENTER("mysql_execute_command");
thd->net.no_send_error= 0;
@@ -2663,6 +2667,48 @@ mysql_execute_command(THD *thd)
// force searching in slave.cc:tables_ok()
all_tables->updating= 1;
}
+
+ /*
+ For fix of BUG#37051, the master stores the table map for update
+ in the Query_log_event, and the value is assigned to
+ thd->variables.table_map_for_update before executing the update
+ query.
+
+ If thd->variables.table_map_for_update is set, then we are
+ replicating from a new master, we can use this value to apply
+ filter rules without opening all the tables. However If
+ thd->variables.table_map_for_update is not set, then we are
+ replicating from an old master, so we just skip this and
+ continue with the old method. And of course, the bug would still
+ exist for old masters.
+ */
+ if (lex->sql_command == SQLCOM_UPDATE_MULTI &&
+ thd->table_map_for_update)
+ {
+ have_table_map_for_update= TRUE;
+ table_map table_map_for_update= thd->table_map_for_update;
+ uint nr= 0;
+ TABLE_LIST *table;
+ for (table=all_tables; table; table=table->next_global, nr++)
+ {
+ if (table_map_for_update & ((table_map)1 << nr))
+ table->updating= TRUE;
+ else
+ table->updating= FALSE;
+ }
+
+ if (all_tables_not_ok(thd, all_tables))
+ {
+ /* we warn the slave SQL thread */
+ my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
+ if (thd->one_shot_set)
+ reset_one_shot_variables(thd);
+ DBUG_RETURN(0);
+ }
+
+ for (table=all_tables; table; table=table->next_global)
+ table->updating= TRUE;
+ }
/*
Check if statment should be skipped because of slave filtering
@@ -3608,7 +3654,7 @@ end_with_restore_list:
#ifdef HAVE_REPLICATION
/* Check slave filtering rules */
- if (unlikely(thd->slave_thread))
+ if (unlikely(thd->slave_thread && !have_table_map_for_update))
{
if (all_tables_not_ok(thd, all_tables))
{
@@ -3917,7 +3963,7 @@ end_with_restore_list:
#endif
case SQLCOM_CHANGE_DB:
{
- LEX_STRING db_str= { (char *) select_lex->db, strlen(select_lex->db) };
+ LEX_STRING db_str= { (char *) select_lex->db, (uint) strlen(select_lex->db) };
if (!mysql_change_db(thd, &db_str, FALSE))
send_ok(thd);
@@ -6148,7 +6194,7 @@ void create_select_for_variable(const char *var_name)
mysql_init_select(lex);
lex->sql_command= SQLCOM_SELECT;
tmp.str= (char*) var_name;
- tmp.length=strlen(var_name);
+ tmp.length=(uint) strlen(var_name);
bzero((char*) &null_lex_string.str, sizeof(null_lex_string));
/*
We set the name of Item to @@session.var_name because that then is used
@@ -6157,7 +6203,7 @@ void create_select_for_variable(const char *var_name)
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string)))
{
end= strxmov(buff, "@@session.", var_name, NullS);
- var->set_name(buff, end-buff, system_charset_info);
+ var->set_name(buff, (uint) (end - buff), system_charset_info);
add_item_to_list(thd, var);
}
DBUG_VOID_RETURN;
@@ -7900,10 +7946,10 @@ void get_default_definer(THD *thd, LEX_USER *definer)
const Security_context *sctx= thd->security_ctx;
definer->user.str= (char *) sctx->priv_user;
- definer->user.length= strlen(definer->user.str);
+ definer->user.length= (uint) strlen(definer->user.str);
definer->host.str= (char *) sctx->priv_host;
- definer->host.length= strlen(definer->host.str);
+ definer->host.length= (uint) strlen(definer->host.str);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 9e144f5ae9b..a07fcc37856 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -726,13 +726,13 @@ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array,
Item_param *param= *it;
if (param->state != Item_param::LONG_DATA_VALUE)
{
- if (is_param_null(null_array, it - begin))
+ if (is_param_null(null_array, (uint) (it - begin)))
param->set_null();
else
{
if (read_pos >= data_end)
DBUG_RETURN(1);
- param->set_param_func(param, &read_pos, data_end - read_pos);
+ param->set_param_func(param, &read_pos, (uint) (data_end - read_pos));
if (param->state == Item_param::NO_VALUE)
DBUG_RETURN(1);
}
@@ -764,13 +764,13 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array,
Item_param *param= *it;
if (param->state != Item_param::LONG_DATA_VALUE)
{
- if (is_param_null(null_array, it - begin))
+ if (is_param_null(null_array, (uint) (it - begin)))
param->set_null();
else
{
if (read_pos >= data_end)
DBUG_RETURN(1);
- param->set_param_func(param, &read_pos, data_end - read_pos);
+ param->set_param_func(param, &read_pos, (uint) (data_end - read_pos));
if (param->state == Item_param::NO_VALUE)
DBUG_RETURN(1);
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 5bbff69f197..5966176012f 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -202,7 +202,7 @@ void adjust_linfo_offsets(my_off_t purge_offset)
bool log_in_use(const char* log_name)
{
- int log_name_len = strlen(log_name) + 1;
+ size_t log_name_len = strlen(log_name) + 1;
THD *tmp;
bool result = 0;
@@ -1284,8 +1284,8 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2)
{
int res;
- uint log_file_name1_len= strlen(log_file_name1);
- uint log_file_name2_len= strlen(log_file_name2);
+ size_t log_file_name1_len= strlen(log_file_name1);
+ size_t log_file_name2_len= strlen(log_file_name2);
// We assume that both log names match up to '.'
if (log_file_name1_len == log_file_name2_len)
@@ -1580,7 +1580,7 @@ int log_loaded_block(IO_CACHE* file)
lf_info->last_pos_in_file >= my_b_get_pos_in_file(file))
DBUG_RETURN(0);
- for (block_len= my_b_get_bytes_in_buffer(file); block_len > 0;
+ for (block_len= (uint) (my_b_get_bytes_in_buffer(file)); block_len > 0;
buffer += min(block_len, max_event_size),
block_len -= min(block_len, max_event_size))
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index a341cf5e0e9..3b4668a3925 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2373,11 +2373,12 @@ typedef struct st_sargable_param
*/
static bool
-make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
+make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
DYNAMIC_ARRAY *keyuse_array)
{
int error;
TABLE *table;
+ TABLE_LIST *tables= tables_arg;
uint i,table_count,const_count,key;
table_map found_const_table_map, all_table_map, found_ref, refs;
key_map const_ref, eq_part;
@@ -2415,10 +2416,10 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
table_vector[i]=s->table=table=tables->table;
table->pos_in_table_list= tables;
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
- if(error)
+ if (error)
{
- table->file->print_error(error, MYF(0));
- DBUG_RETURN(1);
+ table->file->print_error(error, MYF(0));
+ goto error;
}
table->quick_keys.clear_all();
table->reginfo.join_tab=s;
@@ -2503,7 +2504,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
{
join->tables=0; // Don't use join->table
my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0));
- DBUG_RETURN(1);
+ goto error;
}
s->key_dependent= s->dependent;
}
@@ -2513,7 +2514,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if (update_ref_and_keys(join->thd, keyuse_array, stat, join->tables,
conds, join->cond_equal,
~outer_join, join->select_lex, &sargables))
- DBUG_RETURN(1);
+ goto error;
/* Read tables with 0 or 1 rows (system tables) */
join->const_table_map= 0;
@@ -2529,7 +2530,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if ((tmp=join_read_const_table(s, p_pos)))
{
if (tmp > 0)
- DBUG_RETURN(1); // Fatal error
+ goto error; // Fatal error
}
else
found_const_table_map|= s->table->map;
@@ -2601,7 +2602,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if ((tmp= join_read_const_table(s, join->positions+const_count-1)))
{
if (tmp > 0)
- DBUG_RETURN(1); // Fatal error
+ goto error; // Fatal error
}
else
found_const_table_map|= table->map;
@@ -2650,12 +2651,12 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
set_position(join,const_count++,s,start_keyuse);
if (create_ref_for_key(join, s, start_keyuse,
found_const_table_map))
- DBUG_RETURN(1);
+ goto error;
if ((tmp=join_read_const_table(s,
join->positions+const_count-1)))
{
if (tmp > 0)
- DBUG_RETURN(1); // Fatal error
+ goto error; // Fatal error
}
else
found_const_table_map|= table->map;
@@ -2732,7 +2733,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
*s->on_expr_ref ? *s->on_expr_ref : conds,
1, &error);
if (!select)
- DBUG_RETURN(1);
+ goto error;
records= get_quick_record_count(join->thd, select, s->table,
&s->const_keys, join->row_limit);
s->quick=select->quick;
@@ -2778,7 +2779,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
{
optimize_keyuse(join, keyuse_array);
if (choose_plan(join, all_table_map & ~join->const_table_map))
- DBUG_RETURN(TRUE);
+ goto error;
}
else
{
@@ -2788,6 +2789,17 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
}
/* Generate an execution plan from the found optimal join order. */
DBUG_RETURN(join->thd->killed || get_best_combination(join));
+
+error:
+ /*
+ Need to clean up join_tab from TABLEs in case of error.
+ They won't get cleaned up by JOIN::cleanup() because JOIN::join_tab
+ may not be assigned yet by this function (which is building join_tab).
+ Dangling TABLE::reginfo.join_tab may cause part_of_refkey to choke.
+ */
+ for (tables= tables_arg; tables; tables= tables->next_leaf)
+ tables->table->reginfo.join_tab= NULL;
+ DBUG_RETURN (1);
}
@@ -7605,7 +7617,7 @@ static int compare_fields_by_table_order(Item_field *field1,
if (outer_ref)
return cmp;
JOIN_TAB **idx= (JOIN_TAB **) table_join_idx;
- cmp= idx[field2->field->table->tablenr]-idx[field1->field->table->tablenr];
+ cmp= (uint) (idx[field2->field->table->tablenr] - idx[field1->field->table->tablenr]);
return cmp < 0 ? -1 : (cmp ? 1 : 0);
}
@@ -9632,7 +9644,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->s->default_values= table->record[1]+alloc_length;
}
copy_func[0]=0; // End marker
- param->func_count= copy_func - param->items_to_copy;
+ param->func_count= (uint) (copy_func - param->items_to_copy);
recinfo=param->start_recinfo;
null_flags=(uchar*) table->record[0];
@@ -15205,10 +15217,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(new Item_int((int32)
join->select_lex->select_number));
item_list.push_back(new Item_string(join->select_lex->type,
- strlen(join->select_lex->type), cs));
+ (uint) strlen(join->select_lex->type), cs));
for (uint i=0 ; i < 7; i++)
item_list.push_back(item_null);
- item_list.push_back(new Item_string(message,strlen(message),cs));
+ item_list.push_back(new Item_string(message,(uint) strlen(message),cs));
if (result->send_data(item_list))
join->error= 1;
}
@@ -15227,7 +15239,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
item_list.push_back(new Item_null);
/* select_type */
item_list.push_back(new Item_string(join->select_lex->type,
- strlen(join->select_lex->type),
+ (uint) strlen(join->select_lex->type),
cs));
/* table */
{
@@ -15254,7 +15266,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
/* type */
item_list.push_back(new Item_string(join_type_str[JT_ALL],
- strlen(join_type_str[JT_ALL]),
+ (uint) strlen(join_type_str[JT_ALL]),
cs));
/* possible_keys */
item_list.push_back(item_null);
@@ -15303,7 +15315,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
join->select_lex->select_number));
/* select_type */
item_list.push_back(new Item_string(join->select_lex->type,
- strlen(join->select_lex->type),
+ (uint) strlen(join->select_lex->type),
cs));
if (tab->type == JT_ALL && tab->select && tab->select->quick)
{
@@ -15328,12 +15340,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
TABLE_LIST *real_table= table->pos_in_table_list;
item_list.push_back(new Item_string(real_table->alias,
- strlen(real_table->alias),
+ (uint) strlen(real_table->alias),
cs));
}
/* type */
item_list.push_back(new Item_string(join_type_str[tab->type],
- strlen(join_type_str[tab->type]),
+ (uint) strlen(join_type_str[tab->type]),
cs));
/* Build "possible_keys" value and add it to item_list */
if (!tab->keys.is_clear_all())
@@ -15346,7 +15358,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if (tmp1.length())
tmp1.append(',');
tmp1.append(table->key_info[j].name,
- strlen(table->key_info[j].name),
+ (uint) strlen(table->key_info[j].name),
system_charset_info);
}
}
@@ -15362,17 +15374,17 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
KEY *key_info=table->key_info+ tab->ref.key;
register uint length;
item_list.push_back(new Item_string(key_info->name,
- strlen(key_info->name),
+ (uint) strlen(key_info->name),
system_charset_info));
- length= longlong2str(tab->ref.key_length, keylen_str_buf, 10) -
- keylen_str_buf;
+ length= (uint) (longlong2str(tab->ref.key_length, keylen_str_buf, 10) -
+ keylen_str_buf);
item_list.push_back(new Item_string(keylen_str_buf, length,
system_charset_info));
for (store_key **ref=tab->ref.key_copy ; *ref ; ref++)
{
if (tmp2.length())
tmp2.append(',');
- tmp2.append((*ref)->name(), strlen((*ref)->name()),
+ tmp2.append((*ref)->name(), (uint) strlen((*ref)->name()),
system_charset_info);
}
item_list.push_back(new Item_string(tmp2.ptr(),tmp2.length(),cs));
@@ -15382,9 +15394,9 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
KEY *key_info=table->key_info+ tab->index;
register uint length;
item_list.push_back(new Item_string(key_info->name,
- strlen(key_info->name),cs));
- length= longlong2str(key_info->key_length, keylen_str_buf, 10) -
- keylen_str_buf;
+ (uint) strlen(key_info->name),cs));
+ length= (uint) (longlong2str(key_info->key_length, keylen_str_buf, 10) -
+ keylen_str_buf);
item_list.push_back(new Item_string(keylen_str_buf,
length,
system_charset_info));
@@ -15417,7 +15429,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
key_read=1;
if (tab->info)
- item_list.push_back(new Item_string(tab->info,strlen(tab->info),cs));
+ item_list.push_back(new Item_string(tab->info,(uint) strlen(tab->info),cs));
else if (tab->packed_info & TAB_INFO_HAVE_VALUE)
{
if (tab->packed_info & TAB_INFO_USING_INDEX)
@@ -15741,7 +15753,7 @@ void TABLE_LIST::print(THD *thd, String *str)
if (schema_table)
{
append_identifier(thd, str, schema_table_name,
- strlen(schema_table_name));
+ (uint) strlen(schema_table_name));
cmp_name= schema_table_name;
}
else
@@ -15766,7 +15778,7 @@ void TABLE_LIST::print(THD *thd, String *str)
}
}
- append_identifier(thd, str, t_alias, strlen(t_alias));
+ append_identifier(thd, str, t_alias, (uint) strlen(t_alias));
}
if (use_index)
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index d6bb3427fe4..34e3193378f 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -106,7 +106,7 @@ static struct show_privileges_st sys_privileges[]=
{"Alter", "Tables", "To alter the table"},
{"Alter routine", "Functions,Procedures", "To alter or drop stored functions/procedures"},
{"Create", "Databases,Tables,Indexes", "To create new databases and tables"},
- {"Create routine","Functions,Procedures","To use CREATE FUNCTION/PROCEDURE"},
+ {"Create routine","Databases","To use CREATE FUNCTION/PROCEDURE"},
{"Create temporary tables","Databases","To use CREATE TEMPORARY TABLE"},
{"Create view", "Tables", "To create new views"},
{"Create user", "Server Admin", "To create new users"},
@@ -287,11 +287,18 @@ find_files(THD *thd, List<char> *files, const char *db,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access=thd->col_access;
#endif
+ uint wild_length= 0;
TABLE_LIST table_list;
DBUG_ENTER("find_files");
- if (wild && !wild[0])
- wild=0;
+ if (wild)
+ {
+ if (!wild[0])
+ wild= 0;
+ else
+ wild_length= strlen(wild);
+ }
+
bzero((char*) &table_list,sizeof(table_list));
@@ -340,8 +347,11 @@ find_files(THD *thd, List<char> *files, const char *db,
{
if (lower_case_table_names)
{
- if (wild_case_compare(files_charset_info, file->name, wild))
- continue;
+ if (my_wildcmp(files_charset_info,
+ file->name, file->name + strlen(file->name),
+ wild, wild + wild_length,
+ wild_prefix, wild_one,wild_many))
+ continue;
}
else if (wild_compare(file->name,wild,0))
continue;
@@ -352,9 +362,9 @@ find_files(THD *thd, List<char> *files, const char *db,
if (db && !(col_access & TABLE_ACLS))
{
table_list.db= (char*) db;
- table_list.db_length= strlen(db);
+ table_list.db_length= (uint) strlen(db);
table_list.table_name= file->name;
- table_list.table_name_length= strlen(file->name);
+ table_list.table_name_length= (uint) strlen(file->name);
table_list.grant.privilege=col_access;
if (check_grant(thd, TABLE_ACLS, &table_list, 1, 1, 1))
continue;
@@ -520,12 +530,12 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
DBUG_RETURN(TRUE);
protocol->prepare_for_resend();
- protocol->store(dbname, strlen(dbname), system_charset_info);
+ protocol->store(dbname, (uint) strlen(dbname), system_charset_info);
buffer.length(0);
buffer.append(STRING_WITH_LEN("CREATE DATABASE "));
if (create_options & HA_LEX_CREATE_IF_NOT_EXISTS)
buffer.append(STRING_WITH_LEN("/*!32312 IF NOT EXISTS*/ "));
- append_identifier(thd, &buffer, dbname, strlen(dbname));
+ append_identifier(thd, &buffer, dbname, (uint) strlen(dbname));
if (create.default_table_charset)
{
@@ -897,7 +907,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
else
alias= (lower_case_table_names == 2 ? table->alias :
share->table_name);
- append_identifier(thd, packet, alias, strlen(alias));
+ append_identifier(thd, packet, alias, (uint) strlen(alias));
packet->append(STRING_WITH_LEN(" (\n"));
for (ptr=table->field ; (field= *ptr); ptr++)
@@ -908,7 +918,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet->append(STRING_WITH_LEN(",\n"));
packet->append(STRING_WITH_LEN(" "));
- append_identifier(thd,packet,field->field_name, strlen(field->field_name));
+ append_identifier(thd,packet,field->field_name, (uint) strlen(field->field_name));
packet->append(' ');
// check for surprises from the previous call to Field::sql_type()
if (type.ptr() != tmp)
@@ -995,7 +1005,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet->append(STRING_WITH_LEN("KEY "));
if (!found_primary)
- append_identifier(thd, packet, key_info->name, strlen(key_info->name));
+ append_identifier(thd, packet, key_info->name, (uint) strlen(key_info->name));
if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) &&
!limited_mysql_mode && !foreign_db_mode)
@@ -1022,7 +1032,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if (key_part->field)
append_identifier(thd,packet,key_part->field->field_name,
- strlen(key_part->field->field_name));
+ (uint) strlen(key_part->field->field_name));
if (key_part->field &&
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&
@@ -1046,7 +1056,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
if ((for_str= file->get_foreign_key_create_info()))
{
- packet->append(for_str, strlen(for_str));
+ packet->append(for_str, (uint) strlen(for_str));
file->free_foreign_key_create_info(for_str);
}
@@ -1222,21 +1232,25 @@ void append_definer(THD *thd, String *buffer, const LEX_STRING *definer_user,
static int
view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
{
+ my_bool compact_view_name= TRUE;
my_bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
MODE_ORACLE |
MODE_MSSQL |
MODE_DB2 |
MODE_MAXDB |
MODE_ANSI)) != 0;
- /*
- Compact output format for view can be used
- - if user has db of this view as current db
- - if this view only references table inside it's own db
- */
+
if (!thd->db || strcmp(thd->db, table->view_db.str))
- table->compact_view_format= FALSE;
+ /*
+ print compact view name if the view belongs to the current database
+ */
+ compact_view_name= table->compact_view_format= FALSE;
else
{
+ /*
+ Compact output format for view body can be used
+ if this view only references table inside it's own db
+ */
TABLE_LIST *tbl;
table->compact_view_format= TRUE;
for (tbl= thd->lex->query_tables;
@@ -1257,7 +1271,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
view_store_options(thd, table, buff);
}
buff->append(STRING_WITH_LEN("VIEW "));
- if (!table->compact_view_format)
+ if (!compact_view_name)
{
append_identifier(thd, buff, table->view_db.str, table->view_db.length);
buff->append('.');
@@ -1324,7 +1338,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
field_list.push_back(field=new Item_empty_string("db",NAME_LEN));
field->maybe_null=1;
field_list.push_back(new Item_empty_string("Command",16));
- field_list.push_back(new Item_return_int("Time",7, FIELD_TYPE_LONG));
+ field_list.push_back(field= new Item_return_int("Time",7, FIELD_TYPE_LONG));
+ field->unsigned_flag= 0;
field_list.push_back(field=new Item_empty_string("State",30));
field->maybe_null=1;
field_list.push_back(field=new Item_empty_string("Info",max_query_length));
@@ -1425,7 +1440,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
else
protocol->store(command_name[thd_info->command], system_charset_info);
if (thd_info->start_time)
- protocol->store((uint32) (now - thd_info->start_time));
+ protocol->store_long ((longlong) (now - thd_info->start_time));
else
protocol->store_null();
protocol->store(thd_info->state_info, system_charset_info);
@@ -1451,7 +1466,7 @@ static bool show_status_array(THD *thd, const char *wild,
char buff[1024], *prefix_end;
/* the variable name should not be longer then 80 characters */
char name_buffer[80];
- int len;
+ size_t len;
LEX_STRING null_lex_str;
CHARSET_INFO *charset= system_charset_info;
DBUG_ENTER("show_status_array");
@@ -1460,11 +1475,11 @@ static bool show_status_array(THD *thd, const char *wild,
null_lex_str.length= 0;
prefix_end=strnmov(name_buffer, prefix, sizeof(name_buffer)-1);
- len=name_buffer + sizeof(name_buffer) - prefix_end;
+ len= name_buffer + sizeof(name_buffer) - prefix_end;
for (; variables->name; variables++)
{
- strnmov(prefix_end, variables->name, len);
+ strnmov(prefix_end, variables->name, (uint) len);
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
SHOW_TYPE show_type=variables->type;
if (show_type == SHOW_VARS)
@@ -1780,7 +1795,7 @@ static bool show_status_array(THD *thd, const char *wild,
const char *p= SSL_get_cipher_list((SSL*) thd->net.vio->ssl_arg,i);
if (p == NULL)
break;
- to= strnmov(to, p, buff_end-to-1);
+ to= strnmov(to, p, (uint) (buff_end-to-1));
*to++= ':';
}
if (to != buff)
@@ -1809,7 +1824,7 @@ static bool show_status_array(THD *thd, const char *wild,
break;
}
restore_record(table, s->default_values);
- table->field[0]->store(name_buffer, strlen(name_buffer),
+ table->field[0]->store(name_buffer, (uint) strlen(name_buffer),
system_charset_info);
table->field[1]->store(pos, (uint32) (end - pos), charset);
if (schema_table_store_record(thd, table))
@@ -1928,9 +1943,9 @@ int make_table_list(THD *thd, SELECT_LEX *sel,
Table_ident *table_ident;
LEX_STRING ident_db, ident_table;
ident_db.str= db;
- ident_db.length= strlen(db);
+ ident_db.length= (uint) strlen(db);
ident_table.str= table;
- ident_table.length= strlen(table);
+ ident_table.length= (uint) strlen(table);
table_ident= new Table_ident(thd, ident_db, ident_table, 1);
sel->init_query();
if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ,
@@ -1960,12 +1975,12 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
const char *field_name1= schema_table->idx_field1 >= 0 ? field_info[schema_table->idx_field1].field_name : "";
const char *field_name2= schema_table->idx_field2 >= 0 ? field_info[schema_table->idx_field2].field_name : "";
if (table->table != item_field->field->table ||
- (cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
+ (cs->coll->strnncollsp(cs, (uchar *) field_name1, (uint) strlen(field_name1),
(uchar *) item_field->field_name,
- strlen(item_field->field_name), 0) &&
- cs->coll->strnncollsp(cs, (uchar *) field_name2, strlen(field_name2),
+ (uint) strlen(item_field->field_name), 0) &&
+ cs->coll->strnncollsp(cs, (uchar *) field_name2, (uint) strlen(field_name2),
(uchar *) item_field->field_name,
- strlen(item_field->field_name), 0)))
+ (uint) strlen(item_field->field_name), 0)))
return 0;
}
else if (item->type() == Item::REF_ITEM)
@@ -2296,9 +2311,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{
restore_record(table, s->default_values);
table->field[schema_table->idx_field1]->
- store(base_name, strlen(base_name), system_charset_info);
+ store(base_name, (uint) strlen(base_name), system_charset_info);
table->field[schema_table->idx_field2]->
- store(file_name, strlen(file_name),system_charset_info);
+ store(file_name, (uint) strlen(file_name),system_charset_info);
if (!partial_cond || partial_cond->val_int())
{
if (schema_table_idx == SCH_TABLE_NAMES)
@@ -2406,9 +2421,9 @@ bool store_schema_shemata(THD* thd, TABLE *table, const char *db_name,
CHARSET_INFO *cs)
{
restore_record(table, s->default_values);
- table->field[1]->store(db_name, strlen(db_name), system_charset_info);
- table->field[2]->store(cs->csname, strlen(cs->csname), system_charset_info);
- table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);
+ table->field[1]->store(db_name, (uint) strlen(db_name), system_charset_info);
+ table->field[2]->store(cs->csname, (uint) strlen(cs->csname), system_charset_info);
+ table->field[3]->store(cs->name, (uint) strlen(cs->name), system_charset_info);
return schema_table_store_record(thd, table);
}
@@ -2474,8 +2489,8 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
DBUG_ENTER("get_schema_tables_record");
restore_record(table, s->default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(file_name, strlen(file_name), cs);
+ table->field[1]->store(base_name, (uint) strlen(base_name), cs);
+ table->field[2]->store(file_name, (uint) strlen(file_name), cs);
if (res)
{
/*
@@ -2488,7 +2503,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else
table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs);
- table->field[20]->store(error, strlen(error), cs);
+ table->field[20]->store(error, (uint) strlen(error), cs);
thd->clear_error();
}
else if (tables->view)
@@ -2518,7 +2533,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
table->field[i]->set_notnull();
}
tmp_buff= file->table_type();
- table->field[4]->store(tmp_buff, strlen(tmp_buff), cs);
+ table->field[4]->store(tmp_buff, (uint) strlen(tmp_buff), cs);
table->field[5]->store((longlong) share->frm_version, TRUE);
enum row_type row_type = file->get_row_type();
switch (row_type) {
@@ -2545,7 +2560,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
tmp_buff= "Compact";
break;
}
- table->field[6]->store(tmp_buff, strlen(tmp_buff), cs);
+ table->field[6]->store(tmp_buff, (uint) strlen(tmp_buff), cs);
if (!tables->schema_table)
{
table->field[7]->store((longlong) file->records, TRUE);
@@ -2587,7 +2602,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
}
tmp_buff= (share->table_charset ?
share->table_charset->name : "default");
- table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
+ table->field[17]->store(tmp_buff, (uint) strlen(tmp_buff), cs);
if (file->table_flags() & (ulong) HA_HAS_CHECKSUM)
{
table->field[18]->store((longlong) file->checksum(), TRUE);
@@ -2643,7 +2658,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
table->field[20]->store(comment,
(comment == share->comment.str ?
share->comment.length :
- strlen(comment)), cs);
+ (uint) strlen(comment)), cs);
if (comment != share->comment.str)
my_free(comment, MYF(0));
}
@@ -2689,8 +2704,8 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
count= 0;
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
restore_record(show_table, s->default_values);
- base_name_length= strlen(base_name);
- file_name_length= strlen(file_name);
+ base_name_length= (uint) strlen(base_name);
+ file_name_length= (uint) strlen(file_name);
for (ptr=show_table->field; (field= *ptr) ; ptr++)
{
@@ -2735,13 +2750,13 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
#endif
table->field[1]->store(base_name, base_name_length, cs);
table->field[2]->store(file_name, file_name_length, cs);
- table->field[3]->store(field->field_name, strlen(field->field_name),
+ table->field[3]->store(field->field_name, (uint) strlen(field->field_name),
cs);
table->field[4]->store((longlong) count, TRUE);
field->sql_type(type);
table->field[14]->store(type.ptr(), type.length(), cs);
tmp_buff= strchr(type.ptr(), '(');
- table->field[7]->store(type.ptr(),
+ table->field[7]->store(type.ptr(), (uint)
(tmp_buff ? tmp_buff - type.ptr() :
type.length()), cs);
@@ -2753,7 +2768,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES");
table->field[6]->store((const char*) pos,
- strlen((const char*) pos), cs);
+ (uint) strlen((const char*) pos), cs);
is_blob= (field->type() == FIELD_TYPE_BLOB);
if (field->has_charset() || is_blob ||
field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type
@@ -2821,18 +2836,18 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
{
pos=(byte*) field->charset()->csname;
table->field[12]->store((const char*) pos,
- strlen((const char*) pos), cs);
+ (uint) strlen((const char*) pos), cs);
table->field[12]->set_notnull();
pos=(byte*) field->charset()->name;
table->field[13]->store((const char*) pos,
- strlen((const char*) pos), cs);
+ (uint) strlen((const char*) pos), cs);
table->field[13]->set_notnull();
}
pos=(byte*) ((field->flags & PRI_KEY_FLAG) ? "PRI" :
(field->flags & UNIQUE_KEY_FLAG) ? "UNI" :
(field->flags & MULTIPLE_KEY_FLAG) ? "MUL":"");
table->field[15]->store((const char*) pos,
- strlen((const char*) pos), cs);
+ (uint) strlen((const char*) pos), cs);
end= tmp;
if (field->unireg_check == Field::NEXT_NUMBER)
@@ -2865,10 +2880,10 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
{
const char *comment;
restore_record(table, s->default_values);
- table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs);
- table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
+ table->field[0]->store(tmp_cs->csname, (uint) strlen(tmp_cs->csname), scs);
+ table->field[1]->store(tmp_cs->name, (uint) strlen(tmp_cs->name), scs);
comment= tmp_cs->comment ? tmp_cs->comment : "";
- table->field[2]->store(comment, strlen(comment), scs);
+ table->field[2]->store(comment, (uint) strlen(comment), scs);
table->field[3]->store((longlong) tmp_cs->mbmaxlen, TRUE);
if (schema_table_store_record(thd, table))
return 1;
@@ -2902,13 +2917,13 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
{
const char *tmp_buff;
restore_record(table, s->default_values);
- table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
- table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
+ table->field[0]->store(tmp_cl->name, (uint) strlen(tmp_cl->name), scs);
+ table->field[1]->store(tmp_cl->csname , (uint) strlen(tmp_cl->csname), scs);
table->field[2]->store((longlong) tmp_cl->number, TRUE);
tmp_buff= (tmp_cl->state & MY_CS_PRIMARY) ? "Yes" : "";
- table->field[3]->store(tmp_buff, strlen(tmp_buff), scs);
+ table->field[3]->store(tmp_buff, (uint) strlen(tmp_buff), scs);
tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
- table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
+ table->field[4]->store(tmp_buff, (uint) strlen(tmp_buff), scs);
table->field[5]->store((longlong) tmp_cl->strxfrm_multiply, TRUE);
if (schema_table_store_record(thd, table))
return 1;
@@ -2938,8 +2953,8 @@ int fill_schema_coll_charset_app(THD *thd, TABLE_LIST *tables, COND *cond)
!my_charset_same(tmp_cs,tmp_cl))
continue;
restore_record(table, s->default_values);
- table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
- table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
+ table->field[0]->store(tmp_cl->name, (uint) strlen(tmp_cl->name), scs);
+ table->field[1]->store(tmp_cl->csname , (uint) strlen(tmp_cl->csname), scs);
if (schema_table_store_record(thd, table))
return 1;
}
@@ -3110,16 +3125,16 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
{
restore_record(table, s->default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(file_name, strlen(file_name), cs);
+ table->field[1]->store(base_name, (uint) strlen(base_name), cs);
+ table->field[2]->store(file_name, (uint) strlen(file_name), cs);
table->field[3]->store((longlong) ((key_info->flags &
HA_NOSAME) ? 0 : 1), TRUE);
- table->field[4]->store(base_name, strlen(base_name), cs);
- table->field[5]->store(key_info->name, strlen(key_info->name), cs);
+ table->field[4]->store(base_name, (uint) strlen(base_name), cs);
+ table->field[5]->store(key_info->name, (uint) strlen(key_info->name), cs);
table->field[6]->store((longlong) (j+1), TRUE);
str=(key_part->field ? key_part->field->field_name :
"?unknown field?");
- table->field[7]->store(str, strlen(str), cs);
+ table->field[7]->store(str, (uint) strlen(str), cs);
if (show_table->file->index_flags(i, j, 0) & HA_READ_ORDER)
{
table->field[8]->store(((key_part->key_part_flag &
@@ -3146,9 +3161,9 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
}
uint flags= key_part->field ? key_part->field->flags : 0;
const char *pos=(char*) ((flags & NOT_NULL_FLAG) ? "" : "YES");
- table->field[12]->store(pos, strlen(pos), cs);
+ table->field[12]->store(pos, (uint) strlen(pos), cs);
pos= show_table->file->index_type(i);
- table->field[13]->store(pos, strlen(pos), cs);
+ table->field[13]->store(pos, (uint) strlen(pos), cs);
if (!show_table->s->keys_in_use.is_set(i))
table->field[14]->store(STRING_WITH_LEN("disabled"), cs);
else
@@ -3264,7 +3279,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
table->field[5]->store(STRING_WITH_LEN("YES"), cs);
else
table->field[5]->store(STRING_WITH_LEN("NO"), cs);
- definer_len= (strxmov(definer, tables->definer.user.str, "@",
+ definer_len= (uint) (strxmov(definer, tables->definer.user.str, "@",
tables->definer.host.str, NullS) - definer);
table->field[6]->store(definer, definer_len, cs);
if (tables->view_suid)
@@ -3289,10 +3304,10 @@ bool store_constraints(THD *thd, TABLE *table, const char *db,
{
CHARSET_INFO *cs= system_charset_info;
restore_record(table, s->default_values);
- table->field[1]->store(db, strlen(db), cs);
+ table->field[1]->store(db, (uint) strlen(db), cs);
table->field[2]->store(key_name, key_len, cs);
- table->field[3]->store(db, strlen(db), cs);
- table->field[4]->store(tname, strlen(tname), cs);
+ table->field[3]->store(db, (uint) strlen(db), cs);
+ table->field[4]->store(tname, (uint) strlen(tname), cs);
table->field[5]->store(con_type, con_len, cs);
return schema_table_store_record(thd, table);
}
@@ -3329,14 +3344,14 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
if (i == primary_key && !strcmp(key_info->name, primary_key_name))
{
if (store_constraints(thd, table, base_name, file_name, key_info->name,
- strlen(key_info->name),
+ (uint) strlen(key_info->name),
STRING_WITH_LEN("PRIMARY KEY")))
DBUG_RETURN(1);
}
else if (key_info->flags & HA_NOSAME)
{
if (store_constraints(thd, table, base_name, file_name, key_info->name,
- strlen(key_info->name),
+ (uint) strlen(key_info->name),
STRING_WITH_LEN("UNIQUE")))
DBUG_RETURN(1);
}
@@ -3349,7 +3364,7 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
{
if (store_constraints(thd, table, base_name, file_name,
f_key_info->forein_id->str,
- strlen(f_key_info->forein_id->str),
+ (uint) strlen(f_key_info->forein_id->str),
"FOREIGN KEY", 11))
DBUG_RETURN(1);
}
@@ -3371,12 +3386,12 @@ static bool store_trigger(THD *thd, TABLE *table, const char *db,
ulong sql_mode_len;
restore_record(table, s->default_values);
- table->field[1]->store(db, strlen(db), cs);
+ table->field[1]->store(db, (uint) strlen(db), cs);
table->field[2]->store(trigger_name->str, trigger_name->length, cs);
table->field[3]->store(trg_event_type_names[event].str,
trg_event_type_names[event].length, cs);
- table->field[5]->store(db, strlen(db), cs);
- table->field[6]->store(tname, strlen(tname), cs);
+ table->field[5]->store(db, (uint) strlen(db), cs);
+ table->field[6]->store(tname, (uint) strlen(tname), cs);
table->field[9]->store(trigger_stmt->str, trigger_stmt->length, cs);
table->field[10]->store(STRING_WITH_LEN("ROW"), cs);
table->field[11]->store(trg_action_time_type_names[timing].str,
@@ -3460,10 +3475,10 @@ void store_key_column_usage(TABLE *table, const char*db, const char *tname,
const char *con_type, uint con_len, longlong idx)
{
CHARSET_INFO *cs= system_charset_info;
- table->field[1]->store(db, strlen(db), cs);
+ table->field[1]->store(db, (uint) strlen(db), cs);
table->field[2]->store(key_name, key_len, cs);
- table->field[4]->store(db, strlen(db), cs);
- table->field[5]->store(tname, strlen(tname), cs);
+ table->field[4]->store(db, (uint) strlen(db), cs);
+ table->field[5]->store(tname, (uint) strlen(tname), cs);
table->field[6]->store(con_type, con_len, cs);
table->field[7]->store((longlong) idx, TRUE);
}
@@ -3507,9 +3522,9 @@ static int get_schema_key_column_usage_record(THD *thd,
restore_record(table, s->default_values);
store_key_column_usage(table, base_name, file_name,
key_info->name,
- strlen(key_info->name),
+ (uint) strlen(key_info->name),
key_part->field->field_name,
- strlen(key_part->field->field_name),
+ (uint) strlen(key_part->field->field_name),
(longlong) f_idx);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
@@ -3573,8 +3588,8 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
for (; open_list ; open_list=open_list->next)
{
restore_record(table, s->default_values);
- table->field[0]->store(open_list->db, strlen(open_list->db), cs);
- table->field[1]->store(open_list->table, strlen(open_list->table), cs);
+ table->field[0]->store(open_list->db, (uint) strlen(open_list->db), cs);
+ table->field[1]->store(open_list->table, (uint) strlen(open_list->table), cs);
table->field[2]->store((longlong) open_list->in_use, TRUE);
table->field[3]->store((longlong) open_list->locked, TRUE);
if (schema_table_store_record(thd, table))
@@ -3706,7 +3721,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(0);
}
item->set_name(fields_info->field_name,
- strlen(fields_info->field_name), cs);
+ (uint) strlen(fields_info->field_name), cs);
break;
}
field_list.push_back(item);
@@ -3759,7 +3774,7 @@ int make_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
if (field)
{
field->set_name(field_info->old_name,
- strlen(field_info->old_name),
+ (uint) strlen(field_info->old_name),
system_charset_info);
if (add_item_to_list(thd, field))
return 1;
@@ -3828,7 +3843,7 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
field= new Item_field(context, NullS, NullS, field_info->field_name);
if (add_item_to_list(thd, field))
return 1;
- field->set_name(field_info->old_name, strlen(field_info->old_name),
+ field->set_name(field_info->old_name, (uint) strlen(field_info->old_name),
system_charset_info);
}
return 0;
@@ -3854,7 +3869,7 @@ int make_columns_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
if (field)
{
field->set_name(field_info->old_name,
- strlen(field_info->old_name),
+ (uint) strlen(field_info->old_name),
system_charset_info);
if (add_item_to_list(thd, field))
return 1;
@@ -3879,7 +3894,7 @@ int make_character_sets_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
if (field)
{
field->set_name(field_info->old_name,
- strlen(field_info->old_name),
+ (uint) strlen(field_info->old_name),
system_charset_info);
if (add_item_to_list(thd, field))
return 1;
@@ -3904,7 +3919,7 @@ int make_proc_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
if (field)
{
field->set_name(field_info->old_name,
- strlen(field_info->old_name),
+ (uint) strlen(field_info->old_name),
system_charset_info);
if (add_item_to_list(thd, field))
return 1;
@@ -3950,7 +3965,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
table_list->schema_table_name,
table_list->alias);
table_list->table_name= (char*) table->s->table_name;
- table_list->table_name_length= strlen(table->s->table_name);
+ table_list->table_name_length= (uint) strlen(table->s->table_name);
table_list->table= table;
table->next= thd->derived_tables;
thd->derived_tables= table;
@@ -4026,7 +4041,7 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
make_lex_string(thd, &db, INFORMATION_SCHEMA_NAME.str,
INFORMATION_SCHEMA_NAME.length, 0);
make_lex_string(thd, &table, schema_table->table_name,
- strlen(schema_table->table_name), 0);
+ (uint) strlen(schema_table->table_name), 0);
if (schema_table->old_format(thd, schema_table) || /* Handle old syntax */
!sel->add_table_to_list(thd, new Table_ident(thd, db, table, 0),
0, 0, TL_READ, (List<String> *) 0,
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 75e47dd0c8e..e536fc10d51 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -71,25 +71,22 @@ bool String::realloc(uint32 alloc_length)
char *new_ptr;
if (alloced)
{
- if ((new_ptr= (char*) my_realloc(Ptr,len,MYF(MY_WME))))
- {
- Ptr=new_ptr;
- Alloced_length=len;
- }
- else
- return TRUE; // Signal error
+ if (!(new_ptr= (char*) my_realloc(Ptr,len,MYF(MY_WME))))
+ return TRUE; // Signal error
}
else if ((new_ptr= (char*) my_malloc(len,MYF(MY_WME))))
{
+ if (str_length > len - 1)
+ str_length= 0;
if (str_length) // Avoid bugs in memcpy on AIX
memcpy(new_ptr,Ptr,str_length);
new_ptr[str_length]=0;
- Ptr=new_ptr;
- Alloced_length=len;
alloced=1;
}
else
return TRUE; // Signal error
+ Ptr= new_ptr;
+ Alloced_length= len;
}
Ptr[alloc_length]=0; // This make other funcs shorter
return FALSE;
@@ -125,7 +122,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
str_charset=cs;
if (decimals >= NOT_FIXED_DEC)
{
- uint32 len= my_sprintf(buff,(buff, "%.14g",num));// Enough for a DATETIME
+ uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
}
#ifdef HAVE_FCONVERT
@@ -468,7 +465,7 @@ bool String::append(const char *s,uint32 arg_length)
bool String::append(const char *s)
{
- return append(s, strlen(s));
+ return append(s, (uint) strlen(s));
}
@@ -677,7 +674,7 @@ void String::qs_append(const char *str, uint32 len)
void String::qs_append(double d)
{
char *buff = Ptr + str_length;
- str_length+= my_sprintf(buff, (buff, "%.14g", d));
+ str_length+= my_sprintf(buff, (buff, "%.15g", d));
}
void String::qs_append(double *d)
@@ -1003,7 +1000,7 @@ outp:
}
}
*from_end_pos= from;
- res= to - to_start;
+ res= (uint) (to - to_start);
}
return (uint32) res;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index eefe2a5596e..963a98cfb59 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -66,8 +66,8 @@ static void set_tmp_file_path(char *buf, size_t bufsize, THD *thd);
uint build_table_path(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext)
{
- strxnmov(buff, bufflen-1, mysql_data_home, "/", db, "/", table, ext,
- NullS);
+ strxnmov(buff, (uint) (bufflen - 1), mysql_data_home, "/", db, "/", table,
+ ext, NullS);
return unpack_filename(buff,buff);
}
@@ -2314,7 +2314,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
- result_code= HA_ADMIN_CORRUPT;
+ if (thd->net.last_errno == ER_NO_SUCH_TABLE)
+ /* A missing table is just issued as a failed command */
+ result_code= HA_ADMIN_FAILED;
+ else
+ /* Default failure code is corrupt table */
+ result_code= HA_ADMIN_CORRUPT;
goto send_result;
}
@@ -2537,7 +2542,7 @@ send_result_message:
case HA_ADMIN_WRONG_CHECKSUM:
{
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(ER(ER_VIEW_CHECKSUM), strlen(ER(ER_VIEW_CHECKSUM)),
+ protocol->store(ER(ER_VIEW_CHECKSUM), (uint) strlen(ER(ER_VIEW_CHECKSUM)),
system_charset_info);
break;
}
@@ -4443,7 +4448,7 @@ static bool check_engine(THD *thd, const char *table_name,
static void set_tmp_file_path(char *buf, size_t bufsize, THD *thd)
{
- char *p= strnmov(buf, mysql_tmpdir, bufsize);
+ char *p= strnmov(buf, mysql_tmpdir, (uint) bufsize);
my_snprintf(p, bufsize - (p - buf), "%s%lx_%lx_%x%s",
tmp_file_prefix, current_pid,
thd->thread_id, thd->tmp_table++, reg_ext);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index d3b5289cd68..930e3601699 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -459,12 +459,12 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", tables->db, "/", NullS);
dir.length= unpack_filename(dir_buff, dir_buff);
dir.str= dir_buff;
- file.length= strxnmov(file_buff, FN_REFLEN, tables->table_name,
- triggers_file_ext, NullS) - file_buff;
+ file.length= (uint) (strxnmov(file_buff, FN_REFLEN, tables->table_name,
+ triggers_file_ext, NullS) - file_buff);
file.str= file_buff;
- trigname_file.length= strxnmov(trigname_buff, FN_REFLEN,
+ trigname_file.length= (uint) (strxnmov(trigname_buff, FN_REFLEN,
lex->spname->m_name.str,
- trigname_file_ext, NullS) - trigname_buff;
+ trigname_file_ext, NullS) - trigname_buff);
trigname_file.str= trigname_buff;
strxnmov(trigname_path, FN_REFLEN, dir_buff, trigname_buff, NullS);
@@ -524,8 +524,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
definer_host= lex->definer->host;
trg_definer->str= trg_definer_holder;
- trg_definer->length= strxmov(trg_definer->str, definer_user.str, "@",
- definer_host.str, NullS) - trg_definer->str;
+ trg_definer->length= (uint) (strxmov(trg_definer->str, definer_user.str, "@",
+ definer_host.str, NullS) - trg_definer->str);
}
else
{
@@ -559,9 +559,9 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
}
stmt_query->append(thd->lex->stmt_definition_begin,
- (char *) thd->lex->sphead->m_body_begin -
+ (uint) ((char *) thd->lex->sphead->m_body_begin -
thd->lex->stmt_definition_begin +
- thd->lex->sphead->m_body.length);
+ thd->lex->sphead->m_body.length));
trg_def->str= stmt_query->c_ptr();
trg_def->length= stmt_query->length();
@@ -651,8 +651,8 @@ static bool save_trigger_file(Table_triggers_list *triggers, const char *db,
strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", db, "/", NullS);
dir.length= unpack_filename(dir_buff, dir_buff);
dir.str= dir_buff;
- file.length= strxnmov(file_buff, FN_REFLEN, table_name, triggers_file_ext,
- NullS) - file_buff;
+ file.length= (uint) (strxnmov(file_buff, FN_REFLEN, table_name, triggers_file_ext,
+ NullS) - file_buff);
file.str= file_buff;
return sql_create_definition_file(&dir, &file, &triggers_file_type,
@@ -960,7 +960,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
save_db.str= thd->db;
save_db.length= thd->db_length;
- thd->reset_db((char*) db, strlen(db));
+ thd->reset_db((char*) db, (uint) strlen(db));
while ((trg_create_str= it++))
{
trg_sql_mode= itm++;
@@ -1153,8 +1153,8 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event,
}
else
{
- definer->length= strxmov(definer->str, body->m_definer_user.str, "@",
- body->m_definer_host.str, NullS) - definer->str;
+ definer->length= (uint) (strxmov(definer->str, body->m_definer_user.str, "@",
+ body->m_definer_host.str, NullS) - definer->str);
}
DBUG_RETURN(0);
@@ -1350,7 +1350,7 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
/* Construct CREATE TRIGGER statement with new table name. */
buff.length(0);
- before_on_len= on_table_name->str - def->str;
+ before_on_len= (uint) (on_table_name->str - def->str);
buff.append(def->str, before_on_len);
buff.append(STRING_WITH_LEN("ON "));
append_identifier(thd, &buff, new_table_name->str, new_table_name->length);
@@ -1420,8 +1420,8 @@ Table_triggers_list::change_table_name_in_trignames(const char *db_name,
while ((trigger= it_name++) != stopper)
{
- trigname_file.length= strxnmov(trigname_buff, FN_REFLEN, trigger->str,
- trigname_file_ext, NullS) - trigname_buff;
+ trigname_file.length= (uint) (strxnmov(trigname_buff, FN_REFLEN, trigger->str,
+ trigname_file_ext, NullS) - trigname_buff);
trigname_file.str= trigname_buff;
trigname.trigger_table= *new_table_name;
@@ -1482,8 +1482,8 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
}
if (table.triggers)
{
- LEX_STRING_WITH_INIT old_table_name(old_table, strlen(old_table));
- LEX_STRING_WITH_INIT new_table_name(new_table, strlen(new_table));
+ LEX_STRING_WITH_INIT old_table_name(old_table, (uint) strlen(old_table));
+ LEX_STRING_WITH_INIT new_table_name(new_table, (uint) strlen(new_table));
/*
Since triggers should be in the same schema as their subject tables
moving table with them between two schemas raises too many questions.
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 6520c1a661e..f1b16a627ac 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -182,7 +182,7 @@ void udf_init()
DBUG_PRINT("info",("init udf record"));
LEX_STRING name;
name.str=get_field(&mem, table->field[0]);
- name.length = strlen(name.str);
+ name.length = (uint) strlen(name.str);
char *dl_name= get_field(&mem, table->field[2]);
bool new_dl=0;
Item_udftype udftype=UDFTYPE_FUNCTION;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index f15db220a3b..8a3f5bcdc26 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -775,7 +775,7 @@ reopen_tables:
DBUG_RETURN(TRUE);
}
- tables_for_update= get_table_map(fields);
+ thd->table_map_for_update= tables_for_update= get_table_map(fields);
/*
Setup timestamp handling and locking mode
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 41a638b2618..9e0fa87d5f5 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -775,11 +775,11 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
}
view->source.str= thd->query + thd->lex->create_view_select_start;
- view->source.length= (char *)skip_rear_comments(thd->charset(),
+ view->source.length= (uint) ((char *)skip_rear_comments(thd->charset(),
(char *)view->source.str,
(char *)thd->query +
thd->query_length) -
- view->source.str;
+ view->source.str);
view->file_version= 1;
view->calc_md5(md5);
if (!(view->md5.str= thd->memdup(md5, 32)))
@@ -831,10 +831,10 @@ loop_out:
mysql_data_home, view->db);
unpack_filename(dir_buff, dir_buff);
dir.str= dir_buff;
- dir.length= strlen(dir_buff);
+ dir.length= (uint) strlen(dir_buff);
file.str= file_buff;
- file.length= (strxnmov(file_buff, FN_REFLEN, view->table_name, reg_ext,
+ file.length= (uint) (strxnmov(file_buff, FN_REFLEN, view->table_name, reg_ext,
NullS) - file_buff);
/* init timestamp */
if (!view->timestamp.str)
@@ -848,7 +848,7 @@ loop_out:
path.str= path_buff;
fn_format(path_buff, file.str, dir.str, 0, MY_UNPACK_FILENAME);
- path.length= strlen(path_buff);
+ path.length= (uint) strlen(path_buff);
if (!access(path.str, F_OK))
{
@@ -1828,7 +1828,7 @@ mysql_rename_view(THD *thd,
(void) unpack_filename(view_path, view_path);
pathstr.str= (char *)view_path;
- pathstr.length= strlen(view_path);
+ pathstr.length= (uint) strlen(view_path);
if ((parser= sql_parse_prepare(&pathstr, thd->mem_root, 1)) &&
is_equal(&view_type, parser->type()))
@@ -1860,10 +1860,10 @@ mysql_rename_view(THD *thd,
(void) unpack_filename(dir_buff, dir_buff);
pathstr.str= (char*)dir_buff;
- pathstr.length= strlen(dir_buff);
+ pathstr.length= (uint) strlen(dir_buff);
file.str= file_buff;
- file.length= (strxnmov(file_buff, FN_REFLEN, new_name, reg_ext, NullS)
+ file.length= (uint) (strxnmov(file_buff, FN_REFLEN, new_name, reg_ext, NullS)
- file_buff);
if (sql_create_definition_file(&pathstr, &file, view_file_type,
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0eefe782354..51fb5dbdfe4 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7512,6 +7512,11 @@ drop:
THD *thd= YYTHD;
LEX *lex= thd->lex;
sp_name *spname;
+ if ($4.str && check_db_name($4.str))
+ {
+ my_error(ER_WRONG_DB_NAME, MYF(0), $4.str);
+ MYSQL_YYABORT;
+ }
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
diff --git a/sql/table.cc b/sql/table.cc
index 3abd2c24c94..c559b4bb7fd 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -471,7 +471,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
for (count= 0; count < interval->count; count++)
{
char *val= (char*) interval->type_names[count];
- interval->type_lengths[count]= strlen(val);
+ interval->type_lengths[count]= (uint) strlen(val);
}
interval->type_lengths[count]= 0;
}
@@ -916,7 +916,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
the correct null_bytes can now be set, since bitfields have been taken
into account
*/
- share->null_bytes= (null_pos - (uchar*) outparam->null_flags +
+ share->null_bytes= (uint) (null_pos - (uchar*) outparam->null_flags +
(null_bit_pos + 7) / 8);
share->last_null_bit_pos= null_bit_pos;
@@ -1792,11 +1792,8 @@ void st_table::reset_item_list(List<Item> *item_list) const
void TABLE_LIST::calc_md5(char *buffer)
{
- my_MD5_CTX context;
uchar digest[16];
- my_MD5Init(&context);
- my_MD5Update(&context,(uchar *) query.str, query.length);
- my_MD5Final(digest, &context);
+ MY_MD5_HASH(digest, (uchar *) query.str, query.length);
sprintf((char *) buffer,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1], digest[2], digest[3],
@@ -3000,8 +2997,8 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
/* The field belongs to a merge view or information schema table. */
Field_translator *translated_field= view_field_it.field_translator();
nj_col= new Natural_join_column(translated_field, table_ref);
- field_count= table_ref->field_translation_end -
- table_ref->field_translation;
+ field_count= (uint) (table_ref->field_translation_end -
+ table_ref->field_translation);
}
else
{
diff --git a/sql/tztime.cc b/sql/tztime.cc
index d3d952e3c1e..d73a1ca0111 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1871,6 +1871,12 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
#ifdef ABBR_ARE_USED
char chars[max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))];
#endif
+ /*
+ Used as a temporary tz_info until we decide that we actually want to
+ allocate and keep the tz info and tz name in tz_storage.
+ */
+ TIME_ZONE_INFO tmp_tz_info;
+ memset(&tmp_tz_info, 0, sizeof(TIME_ZONE_INFO));
DBUG_ENTER("tz_load_from_open_tables");
@@ -1914,7 +1920,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
Most probably user has mistyped time zone name, so no need to bark here
unless we need it for debugging.
*/
- sql_print_error("Can't find description of time zone '%s'", tz_name_buff);
+ sql_print_error("Can't find description of time zone '%.*s'",
+ tz_name->length(), tz_name->ptr());
#endif
goto end;
}
@@ -1943,8 +1950,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
/* If Uses_leap_seconds == 'Y' */
if (table->field[1]->val_int() == 1)
{
- tz_info->leapcnt= tz_leapcnt;
- tz_info->lsis= tz_lsis;
+ tmp_tz_info.leapcnt= tz_leapcnt;
+ tmp_tz_info.lsis= tz_lsis;
}
(void)table->file->ha_index_end();
@@ -1981,18 +1988,18 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
#ifdef ABBR_ARE_USED
// FIXME should we do something with duplicates here ?
table->field[4]->val_str(&abbr, &abbr);
- if (tz_info->charcnt + abbr.length() + 1 > sizeof(chars))
+ if (tmp_tz_info.charcnt + abbr.length() + 1 > sizeof(chars))
{
sql_print_error("Error while loading time zone description from "
"mysql.time_zone_transition_type table: not enough "
"room for abbreviations");
goto end;
}
- ttis[ttid].tt_abbrind= tz_info->charcnt;
- memcpy(chars + tz_info->charcnt, abbr.ptr(), abbr.length());
- tz_info->charcnt+= abbr.length();
- chars[tz_info->charcnt]= 0;
- tz_info->charcnt++;
+ ttis[ttid].tt_abbrind= tmp_tz_info.charcnt;
+ memcpy(chars + tmp_tz_info.charcnt, abbr.ptr(), abbr.length());
+ tmp_tz_info.charcnt+= abbr.length();
+ chars[tmp_tz_info.charcnt]= 0;
+ tmp_tz_info.charcnt++;
DBUG_PRINT("info",
("time_zone_transition_type table: tz_id=%u tt_id=%u tt_gmtoff=%ld "
@@ -2005,9 +2012,9 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
#endif
/* ttid is increasing because we are reading using index */
- DBUG_ASSERT(ttid >= tz_info->typecnt);
+ DBUG_ASSERT(ttid >= tmp_tz_info.typecnt);
- tz_info->typecnt= ttid + 1;
+ tmp_tz_info.typecnt= ttid + 1;
res= table->file->index_next_same(table->record[0],
(byte*)table->field[0]->ptr, 4);
@@ -2040,14 +2047,14 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
ttime= (my_time_t)table->field[1]->val_int();
ttid= (uint)table->field[2]->val_int();
- if (tz_info->timecnt + 1 > TZ_MAX_TIMES)
+ if (tmp_tz_info.timecnt + 1 > TZ_MAX_TIMES)
{
sql_print_error("Error while loading time zone description from "
"mysql.time_zone_transition table: "
"too much transitions");
goto end;
}
- if (ttid + 1 > tz_info->typecnt)
+ if (ttid + 1 > tmp_tz_info.typecnt)
{
sql_print_error("Error while loading time zone description from "
"mysql.time_zone_transition table: "
@@ -2055,9 +2062,9 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
goto end;
}
- ats[tz_info->timecnt]= ttime;
- types[tz_info->timecnt]= ttid;
- tz_info->timecnt++;
+ ats[tmp_tz_info.timecnt]= ttime;
+ types[tmp_tz_info.timecnt]= ttid;
+ tmp_tz_info.timecnt++;
DBUG_PRINT("info",
("time_zone_transition table: tz_id: %u tt_time: %lu tt_id: %u",
@@ -2082,6 +2089,34 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table= 0;
/*
+ Let us check how correct our time zone description is. We don't check for
+ tz->timecnt < 1 since it is ok for GMT.
+ */
+ if (tmp_tz_info.typecnt < 1)
+ {
+ sql_print_error("loading time zone without transition types");
+ goto end;
+ }
+
+ /* Allocate memory for the timezone info and timezone name in tz_storage. */
+ if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) +
+ tz_name->length() + 1)))
+ {
+ sql_print_error("Out of memory while loading time zone description");
+ return 0;
+ }
+
+ /* Move the temporary tz_info into the allocated area */
+ tz_info= (TIME_ZONE_INFO *)alloc_buff;
+ memcpy(tz_info, &tmp_tz_info, sizeof(TIME_ZONE_INFO));
+ tz_name_buff= alloc_buff + sizeof(TIME_ZONE_INFO);
+ /*
+ By writing zero to the end we guarantee that we can call ptr()
+ instead of c_ptr() for time zone name.
+ */
+ strmake(tz_name_buff, tz_name->ptr(), tz_name->length());
+
+ /*
Now we will allocate memory and init TIME_ZONE_INFO structure.
*/
if (!(alloc_buff= alloc_root(&tz_storage,
@@ -2112,15 +2147,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
tz_info->ttis= (TRAN_TYPE_INFO *)alloc_buff;
memcpy(tz_info->ttis, ttis, tz_info->typecnt * sizeof(TRAN_TYPE_INFO));
- /*
- Let us check how correct our time zone description and build
- reversed map. We don't check for tz->timecnt < 1 since it ok for GMT.
- */
- if (tz_info->typecnt < 1)
- {
- sql_print_error("loading time zone without transition types");
- goto end;
- }
+ /* Build reversed map. */
if (prepare_tz_info(tz_info, &tz_storage))
{
sql_print_error("Unable to build mktime map for time zone");
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 4ca6133da03..db48984eed8 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -1099,7 +1099,7 @@ char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
sprintf(result, "not const");
}
*is_null= 0;
- *length= strlen(result);
+ *length= (uint) strlen(result);
return result;
}
@@ -1133,7 +1133,7 @@ char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)),
char *is_null, char *error __attribute__((unused)))
{
strmov(result, initid->ptr);
- *length= strlen(result);
+ *length= (uint) strlen(result);
*is_null= 0;
return result;
}
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 7c197d2a2e9..a0d1beaf0f9 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -131,7 +131,7 @@ static double get_merge_buffers_cost(uint *buff_elems, uint elem_size,
total_buf_elems+= *pbuf;
*last= total_buf_elems;
- int n_buffers= last - first + 1;
+ size_t n_buffers= last - first + 1;
/* Using log2(n)=log(n)/log(2) formula */
return 2*((double)total_buf_elems*elem_size) / IO_SIZE +
diff --git a/sql/unireg.cc b/sql/unireg.cc
index d37bb09d0e8..d658365abd0 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -119,7 +119,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
/* Calculate extra data segment length */
str_db_type.str= (char *) ha_get_storage_engine(create_info->db_type);
- str_db_type.length= strlen(str_db_type.str);
+ str_db_type.length= (uint) strlen(str_db_type.str);
create_info->extra_size= (2 + str_db_type.length +
2 + create_info->connect_string.length);
diff --git a/strings/Makefile.am b/strings/Makefile.am
index ffca972459b..f0d6585dee4 100644
--- a/strings/Makefile.am
+++ b/strings/Makefile.am
@@ -52,7 +52,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \
strinstr-sparc.s strmake-sparc.s strmov-sparc.s \
strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \
- t_ctype.h CMakeLists.txt
+ t_ctype.h CMakeLists.txt CHARSET_INFO.txt
libmystrings_a_LIBADD=
conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index b370714e464..1e0523e86bc 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -37,7 +37,7 @@ uint my_caseup_str_mb(CHARSET_INFO * cs, char *str)
str++;
}
}
- return str - str_orig;
+ return (uint) (str - str_orig);
}
uint my_casedn_str_mb(CHARSET_INFO * cs, char *str)
@@ -57,7 +57,7 @@ uint my_casedn_str_mb(CHARSET_INFO * cs, char *str)
str++;
}
}
- return str - str_orig;
+ return (uint) (str - str_orig);
}
uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen,
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 99e02e02014..35f0979b461 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -193,7 +193,7 @@ uint my_caseup_str_8bit(CHARSET_INFO * cs,char *str)
char *str_orig= str;
while ((*str= (char) map[(uchar) *str]) != 0)
str++;
- return str - str_orig;
+ return (uint) (str - str_orig);
}
@@ -203,7 +203,7 @@ uint my_casedn_str_8bit(CHARSET_INFO * cs,char *str)
char *str_orig= str;
while ((*str= (char) map[(uchar) *str]) != 0)
str++;
- return str - str_orig;
+ return (uint) (str - str_orig);
}
@@ -1516,7 +1516,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
}
}
- digits= str - beg;
+ digits= (int) (str - beg);
/* Continue to accumulate into ulonglong */
for (dot= NULL, ull= ul; str < end; str++)
@@ -1553,7 +1553,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
}
else
{
- shift= dot - str;
+ shift= (int) (dot - str);
for ( ; str < end && (ch= (unsigned char) (*str - '0')) < 10; str++);
}
goto exp;
@@ -1577,7 +1577,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
/* Unknown character, exit the loop */
break;
}
- shift= dot ? dot - str : 0; /* Right shift */
+ shift= dot ? (int) (dot - str) : 0; /* Right shift */
addon= 0;
exp: /* [ E [ <sign> ] <unsigned integer> ] */
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index dd8d1395ad4..65e4182d564 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1001,7 +1001,7 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs __attribute__((unused)),
*b++= (char) wc;
}
- res= my_strntoull10rnd_8bit(cs, buf, b - buf, unsign_fl, endptr, err);
+ res= my_strntoull10rnd_8bit(cs, buf, (uint) (b - buf), unsign_fl, endptr, err);
*endptr= (char*) nptr + 2 * (uint) (*endptr- buf);
return res;
}
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 93d228a1954..c1c68b48b13 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -107,7 +107,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
char *par = va_arg(ap, char *);
DBUG_ASSERT(to <= end);
if (to + abs(width) + 1 > end)
- width= end - to - 1; /* sign doesn't matter */
+ width= (uint) (end - to - 1); /* sign doesn't matter */
memmove(to, par, abs(width));
to+= width;
continue;
diff --git a/strings/xml.c b/strings/xml.c
index 5f8283f2ea8..850d22da352 100644
--- a/strings/xml.c
+++ b/strings/xml.c
@@ -147,7 +147,7 @@ static int my_xml_enter(MY_XML_PARSER *st, const char *str, uint len)
memcpy(st->attrend,str,len);
st->attrend+=len;
st->attrend[0]='\0';
- return st->enter ? st->enter(st,st->attr,st->attrend-st->attr) : MY_XML_OK;
+ return st->enter ? st->enter(st,st->attr, (uint) (st->attrend - st->attr)) : MY_XML_OK;
}
@@ -179,7 +179,7 @@ static int my_xml_leave(MY_XML_PARSER *p, const char *str, uint slen)
return MY_XML_ERROR;
}
- rc = p->leave_xml ? p->leave_xml(p,p->attr,p->attrend-p->attr) : MY_XML_OK;
+ rc = p->leave_xml ? p->leave_xml(p,p->attr, (uint) (p->attrend - p->attr)) : MY_XML_OK;
*e='\0';
p->attrend=e;
diff --git a/tests/bug25714.c b/tests/bug25714.c
index 88485aa1962..b9c0708f352 100644
--- a/tests/bug25714.c
+++ b/tests/bug25714.c
@@ -54,14 +54,14 @@ int main (int argc, char **argv)
printf("%s\n", mysql_error(&conn));
}
- OK = mysql_real_query (&conn, query4, strlen(query4));
+ OK = mysql_real_query (&conn, query4, (uint) strlen(query4));
assert(0 == OK);
printf("%ld inserted\n",
(long) mysql_insert_id(&conn));
- OK = mysql_real_query (&conn, query5, strlen(query5));
+ OK = mysql_real_query (&conn, query5, (uint) strlen(query5));
assert(0 == OK);
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 0fddffebf82..d006a557819 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -115,6 +115,8 @@ static void client_disconnect(void);
#define DIE_UNLESS(expr) \
((void) ((expr) ? 0 : (die(__FILE__, __LINE__, #expr), 0)))
+#define DIE_IF(expr) \
+ ((void) ((expr) ? (die(__FILE__, __LINE__, #expr), 0) : 0))
#define DIE(expr) \
die(__FILE__, __LINE__, #expr)
@@ -256,7 +258,7 @@ static MYSQL_STMT *STDCALL
mysql_simple_prepare(MYSQL *mysql_arg, const char *query)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql_arg);
- if (stmt && mysql_stmt_prepare(stmt, query, strlen(query)))
+ if (stmt && mysql_stmt_prepare(stmt, query, (uint) strlen(query)))
{
mysql_stmt_close(stmt);
return 0;
@@ -436,7 +438,7 @@ static void my_print_result_metadata(MYSQL_RES *result)
for(i= 0; i< field_count; i++)
{
field= mysql_fetch_field(result);
- j= strlen(field->name);
+ j= (uint) strlen(field->name);
if (j < field->max_length)
j= field->max_length;
if (j < 4 && !IS_NOT_NULL(field->flags))
@@ -714,6 +716,7 @@ static void do_verify_prepare_field(MYSQL_RES *result,
{
MYSQL_FIELD *field;
CHARSET_INFO *cs;
+ ulonglong expected_field_length;
if (!(field= mysql_fetch_field_direct(result, no)))
{
@@ -722,6 +725,8 @@ static void do_verify_prepare_field(MYSQL_RES *result,
}
cs= get_charset(field->charsetnr, 0);
DIE_UNLESS(cs);
+ if ((expected_field_length= length * cs->mbmaxlen) > UINT_MAX32)
+ expected_field_length= UINT_MAX32;
if (!opt_silent)
{
fprintf(stdout, "\n field[%d]:", no);
@@ -736,8 +741,8 @@ static void do_verify_prepare_field(MYSQL_RES *result,
fprintf(stdout, "\n org_table:`%s`\t(expected: `%s`)",
field->org_table, org_table);
fprintf(stdout, "\n database :`%s`\t(expected: `%s`)", field->db, db);
- fprintf(stdout, "\n length :`%lu`\t(expected: `%lu`)",
- field->length, length * cs->mbmaxlen);
+ fprintf(stdout, "\n length :`%lu`\t(expected: `%llu`)",
+ field->length, expected_field_length);
fprintf(stdout, "\n maxlength:`%ld`", field->max_length);
fprintf(stdout, "\n charsetnr:`%d`", field->charsetnr);
fprintf(stdout, "\n default :`%s`\t(expected: `%s`)",
@@ -773,11 +778,11 @@ static void do_verify_prepare_field(MYSQL_RES *result,
as utf8. Field length is calculated as number of characters * maximum
number of bytes a character can occupy.
*/
- if (length && field->length != length * cs->mbmaxlen)
+ if (length && (field->length != expected_field_length))
{
- fprintf(stderr, "Expected field length: %d, got length: %d\n",
- (int) (length * cs->mbmaxlen), (int) field->length);
- DIE_UNLESS(field->length == length * cs->mbmaxlen);
+ fprintf(stderr, "Expected field length: %llu, got length: %lu\n",
+ expected_field_length, field->length);
+ DIE_UNLESS(field->length == expected_field_length);
}
if (def)
DIE_UNLESS(strcmp(field->def, def) == 0);
@@ -959,7 +964,7 @@ void stmt_fetch_init(Stmt_fetch *fetch, unsigned stmt_no_arg,
fetch->handle= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(fetch->handle, fetch->query, strlen(fetch->query));
+ rc= mysql_stmt_prepare(fetch->handle, fetch->query, (uint) strlen(fetch->query));
check_execute(fetch->handle, rc);
/*
@@ -1069,7 +1074,7 @@ my_bool fetch_n(const char **query_list, unsigned query_count,
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
{
/* Init will exit(1) in case of error */
- stmt_fetch_init(fetch, fetch - fetch_array,
+ stmt_fetch_init(fetch, (uint) (fetch - fetch_array),
query_list[fetch - fetch_array]);
}
@@ -2341,7 +2346,7 @@ static void test_ps_conj_select()
int_data= 1;
strmov(str_data, "hh");
- str_length= strlen(str_data);
+ str_length= (uint) strlen(str_data);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -2852,9 +2857,9 @@ static void test_long_data()
data= (char *)"Michael";
/* supply data in pieces */
- rc= mysql_stmt_send_long_data(stmt, 1, data, strlen(data));
+ rc= mysql_stmt_send_long_data(stmt, 1, data, (uint) strlen(data));
data= (char *)" 'Monty' Widenius";
- rc= mysql_stmt_send_long_data(stmt, 1, data, strlen(data));
+ rc= mysql_stmt_send_long_data(stmt, 1, data, (uint) strlen(data));
check_execute(stmt, rc);
rc= mysql_stmt_send_long_data(stmt, 2, "Venu (venu@mysql.com)", 4);
check_execute(stmt, rc);
@@ -8430,7 +8435,7 @@ static void test_mem_overun()
sprintf(field, "c%d int", i);
strxmov(buffer, buffer, field, ", ", NullS);
}
- length= strlen(buffer);
+ length= (uint) strlen(buffer);
buffer[length-2]= ')';
buffer[--length]= '\0';
@@ -8442,7 +8447,7 @@ static void test_mem_overun()
{
strxmov(buffer, buffer, "1, ", NullS);
}
- length= strlen(buffer);
+ length= (uint) strlen(buffer);
buffer[length-2]= ')';
buffer[--length]= '\0';
@@ -8970,7 +8975,7 @@ static void test_bug1500()
data= "Dogs";
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *) data;
- my_bind[0].buffer_length= strlen(data);
+ my_bind[0].buffer_length= (uint) strlen(data);
my_bind[0].is_null= 0;
my_bind[0].length= 0;
@@ -8995,7 +9000,7 @@ static void test_bug1500()
data= "Grave";
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *) data;
- my_bind[0].buffer_length= strlen(data);
+ my_bind[0].buffer_length= (uint) strlen(data);
rc= mysql_stmt_bind_param(stmt, my_bind);
check_execute(stmt, rc);
@@ -9026,7 +9031,7 @@ static void test_bug1946()
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
- rc= mysql_real_query(mysql, query, strlen(query));
+ rc= mysql_real_query(mysql, query, (uint) strlen(query));
DIE_UNLESS(rc != 0);
if (!opt_silent)
fprintf(stdout, "Got error (as expected):\n");
@@ -10042,7 +10047,7 @@ static void test_bug3035()
myheader("test_bug3035");
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (i8 TINYINT, ui8 TINYINT UNSIGNED, "
@@ -10050,7 +10055,7 @@ static void test_bug3035()
"i32 INT, ui32 INT UNSIGNED, "
"i64 BIGINT, ui64 BIGINT UNSIGNED, "
"id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
bzero((char*) bind_array, sizeof(bind_array));
@@ -10091,7 +10096,7 @@ static void test_bug3035()
stmt_text= "INSERT INTO t1 (i8, ui8, i16, ui16, i32, ui32, i64, ui64) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
mysql_stmt_bind_param(stmt, bind_array);
@@ -10124,7 +10129,7 @@ static void test_bug3035()
"cast(ui64 as signed), ui64, cast(ui64 as signed)"
"FROM t1 ORDER BY id ASC";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -10194,7 +10199,7 @@ static void test_bug3035()
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE t1";
- mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
}
@@ -10257,7 +10262,7 @@ static void test_bug1664()
stmt= mysql_stmt_init(mysql);
check_stmt(stmt);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
verify_param_count(stmt, 2);
@@ -10266,7 +10271,7 @@ static void test_bug1664()
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *)str_data;
- my_bind[0].buffer_length= strlen(str_data);
+ my_bind[0].buffer_length= (uint) strlen(str_data);
my_bind[1].buffer= (void *)&int_data;
my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@@ -10281,7 +10286,7 @@ static void test_bug1664()
not break following execution.
*/
data= "";
- rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data));
+ rc= mysql_stmt_send_long_data(stmt, 0, data, (uint) strlen(data));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -10295,7 +10300,7 @@ static void test_bug1664()
/* This should pass OK */
data= (char *)"Data";
- rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data));
+ rc= mysql_stmt_send_long_data(stmt, 0, data, (uint) strlen(data));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -10332,7 +10337,7 @@ static void test_bug1664()
*/
data= (char *)"SomeOtherData";
- rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data));
+ rc= mysql_stmt_send_long_data(stmt, 0, data, (uint) strlen(data));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -10350,13 +10355,13 @@ static void test_bug1664()
/* Now let us test how mysql_stmt_reset works. */
stmt= mysql_stmt_init(mysql);
check_stmt(stmt);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, my_bind);
check_execute(stmt, rc);
data= (char *)"SomeData";
- rc= mysql_stmt_send_long_data(stmt, 0, data, strlen(data));
+ rc= mysql_stmt_send_long_data(stmt, 0, data, (uint) strlen(data));
check_execute(stmt, rc);
rc= mysql_stmt_reset(stmt);
@@ -10482,7 +10487,7 @@ static void test_ps_i18n()
myheader("test_ps_i18n");
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
/*
@@ -10493,37 +10498,37 @@ static void test_ps_i18n()
stmt_text= "CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "SET CHARACTER_SET_CLIENT=koi8r, "
"CHARACTER_SET_CONNECTION=cp1251, "
"CHARACTER_SET_RESULTS=koi8r";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
bzero((char*) bind_array, sizeof(bind_array));
bind_array[0].buffer_type= MYSQL_TYPE_STRING;
bind_array[0].buffer= (void *) koi8;
- bind_array[0].buffer_length= strlen(koi8);
+ bind_array[0].buffer_length= (uint) strlen(koi8);
bind_array[1].buffer_type= MYSQL_TYPE_STRING;
bind_array[1].buffer= (void *) koi8;
- bind_array[1].buffer_length= strlen(koi8);
+ bind_array[1].buffer_length= (uint) strlen(koi8);
stmt= mysql_stmt_init(mysql);
check_stmt(stmt);
stmt_text= "INSERT INTO t1 (c1, c2) VALUES (?, ?)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
mysql_stmt_bind_param(stmt, bind_array);
- mysql_stmt_send_long_data(stmt, 0, koi8, strlen(koi8));
+ mysql_stmt_send_long_data(stmt, 0, koi8, (uint) strlen(koi8));
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -10531,7 +10536,7 @@ static void test_ps_i18n()
stmt_text= "SELECT c1, c2 FROM t1";
/* c1 and c2 are binary so no conversion will be done on select */
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -10559,7 +10564,7 @@ static void test_ps_i18n()
DIE_UNLESS(rc == MYSQL_NO_DATA);
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
/*
@@ -10572,26 +10577,26 @@ static void test_ps_i18n()
stmt_text= "CREATE TABLE t1 (c1 VARCHAR(255) CHARACTER SET cp1251, "
"c2 VARCHAR(255) CHARACTER SET cp1251)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 (c1, c2) VALUES (?, ?)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
/* this data must be converted */
bind_array[0].buffer_type= MYSQL_TYPE_STRING;
bind_array[0].buffer= (void *) koi8;
- bind_array[0].buffer_length= strlen(koi8);
+ bind_array[0].buffer_length= (uint) strlen(koi8);
bind_array[1].buffer_type= MYSQL_TYPE_STRING;
bind_array[1].buffer= (void *) koi8;
- bind_array[1].buffer_length= strlen(koi8);
+ bind_array[1].buffer_length= (uint) strlen(koi8);
mysql_stmt_bind_param(stmt, bind_array);
- mysql_stmt_send_long_data(stmt, 0, koi8, strlen(koi8));
+ mysql_stmt_send_long_data(stmt, 0, koi8, (uint) strlen(koi8));
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -10599,15 +10604,15 @@ static void test_ps_i18n()
/* this data must not be converted */
bind_array[0].buffer_type= MYSQL_TYPE_BLOB;
bind_array[0].buffer= (void *) cp1251;
- bind_array[0].buffer_length= strlen(cp1251);
+ bind_array[0].buffer_length= (uint) strlen(cp1251);
bind_array[1].buffer_type= MYSQL_TYPE_BLOB;
bind_array[1].buffer= (void *) cp1251;
- bind_array[1].buffer_length= strlen(cp1251);
+ bind_array[1].buffer_length= (uint) strlen(cp1251);
mysql_stmt_bind_param(stmt, bind_array);
- mysql_stmt_send_long_data(stmt, 0, cp1251, strlen(cp1251));
+ mysql_stmt_send_long_data(stmt, 0, cp1251, (uint) strlen(cp1251));
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -10617,7 +10622,7 @@ static void test_ps_i18n()
stmt_text= "SELECT c1, c2 FROM t1";
/* c1 and c2 are binary so no conversion will be done on select */
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -10644,10 +10649,10 @@ static void test_ps_i18n()
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "SET NAMES DEFAULT";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -10668,22 +10673,22 @@ static void test_bug3796()
/* Create and fill test table */
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a INT, b VARCHAR(30))";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES(1, 'ONE'), (2, 'TWO')";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
/* Create statement handle and prepare it with select */
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT concat(?, b) FROM t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
/* Bind input buffers */
@@ -10691,7 +10696,7 @@ static void test_bug3796()
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *) concat_arg0;
- my_bind[0].buffer_length= strlen(concat_arg0);
+ my_bind[0].buffer_length= (uint) strlen(concat_arg0);
mysql_stmt_bind_param(stmt, my_bind);
@@ -10728,7 +10733,7 @@ static void test_bug3796()
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -10750,7 +10755,7 @@ static void test_bug4026()
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT ?, ?";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
/* Bind input buffers */
@@ -10828,7 +10833,7 @@ static void test_bug4079()
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT 1 < (SELECT a FROM t1)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
/* Execute the select statement */
@@ -10867,7 +10872,7 @@ static void test_bug4236()
/* mysql_stmt_execute() of statement with statement id= 0 crashed server */
stmt_text= "SELECT 1";
/* We need to prepare statement to pass by possible check in libmysql */
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
/* Hack to check that server works OK if statement wasn't found */
backup.stmt_id= stmt->stmt_id;
@@ -10899,7 +10904,7 @@ static void test_bug4030()
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT '23:59:59.123456', '2003-12-31', "
"'2003-12-31 23:59:59.123456'";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -11010,7 +11015,7 @@ static void test_view()
myquery(rc);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
strmov(str_data, "TEST");
@@ -11064,7 +11069,7 @@ static void test_view_where()
myquery(rc);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
for (i= 0; i < 3; i++)
@@ -11146,7 +11151,7 @@ static void test_view_2where()
length[i] = 1;
}
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, my_bind);
@@ -11197,7 +11202,7 @@ static void test_view_star()
}
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, my_bind);
@@ -11245,11 +11250,11 @@ static void test_view_insert()
myquery(rc);
insert_stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(insert_stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(insert_stmt, query, (uint) strlen(query));
check_execute(insert_stmt, rc);
query= "select * from t1";
select_stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(select_stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(select_stmt, query, (uint) strlen(query));
check_execute(select_stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
@@ -11304,7 +11309,7 @@ static void test_left_join_view()
rc= mysql_query(mysql,"create view v1 (x) as select a from t1 where a > 1");
myquery(rc);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
for (i= 0; i < 3; i++)
@@ -11372,7 +11377,7 @@ static void test_view_insert_fields()
my_bind[i].length= &l[i];
}
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, my_bind);
check_execute(stmt, rc);
@@ -11383,7 +11388,7 @@ static void test_view_insert_fields()
query= "select * from t1";
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -11409,20 +11414,20 @@ static void test_bug5126()
myheader("test_bug5126");
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a mediumint, b int)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES (8386608, 1)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT a, b FROM t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -11457,20 +11462,20 @@ static void test_bug4231()
myheader("test_bug4231");
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a int)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES (1)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT a FROM t1 WHERE ? = ?";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
/* Bind input buffers */
@@ -11514,7 +11519,7 @@ static void test_bug4231()
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -11543,7 +11548,7 @@ static void test_bug5399()
{
sprintf(buff, "select %d", (int) (stmt - stmt_list));
*stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(*stmt, buff, strlen(buff));
+ rc= mysql_stmt_prepare(*stmt, buff, (uint) strlen(buff));
check_execute(*stmt, rc);
mysql_stmt_bind_result(*stmt, my_bind);
}
@@ -11620,7 +11625,7 @@ static void test_bug5194()
myheader("test_bug5194");
stmt_text= "drop table if exists t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
stmt_text= "create table if not exists t1"
"(c1 float, c2 float, c3 float, c4 float, c5 float, c6 float, "
@@ -11665,7 +11670,7 @@ static void test_bug5194()
"c235 float, c236 float, c237 float, c238 float, c239 float, c240 float, "
"c241 float, c242 float, c243 float, c244 float, c245 float, c246 float, "
"c247 float, c248 float, c249 float, c250 float)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
my_bind= (MYSQL_BIND*) malloc(MAX_PARAM_COUNT * sizeof(MYSQL_BIND));
@@ -11692,7 +11697,7 @@ static void test_bug5194()
for (i= 1; i < COLUMN_COUNT; ++i)
strcat(param_str, "?, ");
strcat(param_str, "?)");
- param_str_length= strlen(param_str);
+ param_str_length= (uint) strlen(param_str);
/* setup bind array */
bzero((char*) my_bind, MAX_PARAM_COUNT * sizeof(MYSQL_BIND));
@@ -11723,7 +11728,7 @@ static void test_bug5194()
}
*query_ptr= '\0';
- rc= mysql_stmt_prepare(stmt, query, query_ptr - query);
+ rc= mysql_stmt_prepare(stmt, query, (uint) (query_ptr - query));
if (rc && nrows * COLUMN_COUNT > uint16_max)
{
if (!opt_silent)
@@ -11752,7 +11757,7 @@ static void test_bug5194()
free(query);
free(param_str);
stmt_text= "drop table t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -11767,7 +11772,7 @@ static void test_bug5315()
stmt_text= "SELECT 1";
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
DIE_UNLESS(rc == 0);
mysql_change_user(mysql, opt_user, opt_password, current_db);
rc= mysql_stmt_execute(stmt);
@@ -11780,7 +11785,7 @@ static void test_bug5315()
/* check that connection is OK */
mysql_stmt_close(stmt);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
DIE_UNLESS(rc == 0);
rc= mysql_stmt_execute(stmt);
DIE_UNLESS(rc == 0);
@@ -11803,13 +11808,13 @@ static void test_bug6049()
stmt_text= "SELECT MAKETIME(-25, 12, 12)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -11852,13 +11857,13 @@ static void test_bug6058()
stmt_text= "SELECT CAST('0000-00-00' AS DATE)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -11896,7 +11901,7 @@ static void test_bug6059()
stmt_text= "SELECT 'foo' INTO OUTFILE 'x.3'";
stmt= mysql_stmt_init(mysql);
- (void) mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ (void) mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
DIE_UNLESS(mysql_stmt_field_count(stmt) == 0);
mysql_stmt_close(stmt);
}
@@ -11913,13 +11918,13 @@ static void test_bug6046()
myheader("test_bug6046");
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a int, b int)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES (1,1),(2,2),(3,1),(4,2)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
@@ -11927,7 +11932,7 @@ static void test_bug6046()
stmt_text= "SELECT t1.a FROM t1 NATURAL JOIN t1 as X1 "
"WHERE t1.b > ? ORDER BY t1.a";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
b= 1;
@@ -12063,7 +12068,7 @@ static void test_bug6096()
myheader("test_bug6096");
stmt_text= "drop table if exists t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
mysql_query(mysql, "set sql_mode=''");
@@ -12073,24 +12078,24 @@ static void test_bug6096()
" c_double double, c_varchar varchar(20), "
" c_char char(20), c_time time, c_date date, "
" c_datetime datetime)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "insert into t1 values (-100, -20000, 30000000, 4, 8, 1.0, "
"2.0, 'abc', 'def', now(), now(), now())";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "select * from t1";
/* Run select in prepared and non-prepared mode and compare metadata */
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
query_result= mysql_store_result(mysql);
query_field_list= mysql_fetch_fields(query_result);
query_field_count= mysql_num_fields(query_result);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -12147,7 +12152,7 @@ static void test_bug6096()
mysql_free_result(query_result);
mysql_free_result(stmt_metadata);
stmt_text= "drop table t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -12168,12 +12173,12 @@ static void test_datetime_ranges()
myheader("test_datetime_ranges");
stmt_text= "drop table if exists t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "create table t1 (year datetime, month datetime, day datetime, "
"hour datetime, min datetime, sec datetime)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_simple_prepare(mysql,
@@ -12212,7 +12217,7 @@ static void test_datetime_ranges()
mysql_stmt_close(stmt);
stmt_text= "delete from t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 (year, month, day) "
@@ -12240,11 +12245,11 @@ static void test_datetime_ranges()
mysql_stmt_close(stmt);
stmt_text= "drop table t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "create table t1 (day_ovfl time, day time, hour time, min time, sec time)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_simple_prepare(mysql,
@@ -12281,7 +12286,7 @@ static void test_datetime_ranges()
mysql_stmt_close(stmt);
stmt_text= "drop table t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -12307,7 +12312,7 @@ static void test_bug4172()
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT f, d, e FROM t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -12332,7 +12337,7 @@ static void test_bug4172()
rc= mysql_stmt_fetch(stmt);
check_execute(stmt, rc);
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
@@ -12363,20 +12368,20 @@ static void test_conversion()
myheader("test_conversion");
stmt_text= "DROP TABLE IF EXISTS t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a TEXT) DEFAULT CHARSET latin1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "SET character_set_connection=utf8, character_set_client=utf8, "
" character_set_results=latin1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "INSERT INTO t1 (a) VALUES (?)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
@@ -12394,7 +12399,7 @@ static void test_conversion()
check_execute(stmt, rc);
stmt_text= "SELECT a FROM t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -12411,10 +12416,10 @@ static void test_conversion()
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "SET NAMES DEFAULT";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -12430,16 +12435,16 @@ static void test_rewind(void)
myheader("test_rewind");
stmt_text= "CREATE TABLE t1 (a int)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES(2),(3),(4)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT * FROM t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
bzero((char*) &my_bind, sizeof(MYSQL_BIND));
@@ -12474,7 +12479,7 @@ static void test_rewind(void)
DIE_UNLESS(rc == MYSQL_NO_DATA);
stmt_text= "DROP TABLE t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
rc= mysql_stmt_free_result(stmt);
rc= mysql_stmt_close(stmt);
@@ -12502,7 +12507,7 @@ static void test_truncation()
"d double, d_1 double, ch char(30), ch_1 char(30), "
"tx text, tx_1 text, ch_2 char(30) "
")";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "insert into t1 VALUES ("
"-10, " /* i8 */
@@ -12520,7 +12525,7 @@ static void test_truncation()
"'12345.67 ', " /* tx_1 */
"'12345.67abc'" /* ch_2 */
")";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "select i8 c1, i8 c2, ui8 c3, i16_1 c4, ui16 c5, "
@@ -12530,7 +12535,7 @@ static void test_truncation()
"from t1";
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -12738,7 +12743,7 @@ static void test_truncation_option()
stmt_text= "select -1";
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -12784,7 +12789,7 @@ static void test_bug6761(void)
myheader("test_bug6761");
stmt_text= "CREATE TABLE t1 (a int, b char(255), c decimal)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
res= mysql_list_fields(mysql, "t1", "%");
@@ -12792,7 +12797,7 @@ static void test_bug6761(void)
mysql_free_result(res);
stmt_text= "DROP TABLE t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -12812,17 +12817,17 @@ static void test_bug8330()
stmt_text= "drop table if exists t1";
/* in case some previos test failed */
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "create table t1 (a int, b int)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
bzero((char*) my_bind, sizeof(my_bind));
for (i=0; i < 2; i++)
{
stmt[i]= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt[i], query, strlen(query));
+ rc= mysql_stmt_prepare(stmt[i], query, (uint) strlen(query));
check_execute(stmt[i], rc);
my_bind[i].buffer_type= MYSQL_TYPE_LONG;
@@ -12843,7 +12848,7 @@ static void test_bug8330()
mysql_stmt_close(stmt[1]);
stmt_text= "drop table t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -13028,7 +13033,7 @@ static void test_bug8378()
sprintf(buf, "SELECT '%s'", out);
- rc=mysql_real_query(lmysql, buf, strlen(buf));
+ rc=mysql_real_query(lmysql, buf, (uint) strlen(buf));
myquery(rc);
mysql_close(lmysql);
@@ -13045,19 +13050,19 @@ static void test_bug8722()
myheader("test_bug8722");
/* Prepare test data */
stmt_text= "drop table if exists t1, v1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (c1 varchar(10), c2 varchar(10), c3 varchar(10),"
" c4 varchar(10), c5 varchar(10), c6 varchar(10),"
" c7 varchar(10), c8 varchar(10), c9 varchar(10),"
"c10 varchar(10))";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE VIEW v1 AS SELECT * FROM t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
/* Note: if you uncomment following block everything works fine */
/*
@@ -13068,11 +13073,11 @@ static void test_bug8722()
stmt= mysql_stmt_init(mysql);
stmt_text= "select * from v1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
mysql_stmt_close(stmt);
stmt_text= "drop table if exists t1, v1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
}
@@ -13083,7 +13088,7 @@ MYSQL_STMT *open_cursor(const char *query)
const ulong type= (ulong)CURSOR_TYPE_READ_ONLY;
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type);
@@ -13134,7 +13139,7 @@ static void test_bug9159()
myquery(rc);
stmt= mysql_stmt_init(mysql);
- mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void *)&type);
mysql_stmt_execute(stmt);
@@ -13376,7 +13381,7 @@ static void test_bug9643()
(void*) &prefetch_rows);
check_execute(stmt, rc);
stmt_text= "select * from t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
@@ -13432,7 +13437,7 @@ static void test_bug11111()
stmt= mysql_stmt_init(mysql);
- mysql_stmt_prepare(stmt, query, strlen(query));
+ mysql_stmt_prepare(stmt, query, (uint) strlen(query));
mysql_stmt_execute(stmt);
bzero((char*) my_bind, sizeof(my_bind));
@@ -13490,7 +13495,7 @@ static void test_bug10729()
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type);
check_execute(stmt, rc);
stmt_text= "select name from t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
@@ -13600,7 +13605,7 @@ static void test_bug10736()
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type);
check_execute(stmt, rc);
stmt_text= "select name from t1 where name=(select name from t1 where id=2)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
@@ -13650,7 +13655,7 @@ static void test_bug10794()
"name varchar(20) not null)");
stmt= mysql_stmt_init(mysql);
stmt_text= "insert into t1 (id, name) values (?, ?)";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
bzero((char*) my_bind, sizeof(my_bind));
my_bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -13664,12 +13669,12 @@ static void test_bug10794()
{
id_val= (i+1)*10;
sprintf(a, "a%d", i);
- a_len= strlen(a); /* safety against broken sprintf */
+ a_len= (uint) strlen(a); /* safety against broken sprintf */
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
}
stmt_text= "select name from t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
type= (ulong) CURSOR_TYPE_READ_ONLY;
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
stmt1= mysql_stmt_init(mysql);
@@ -13691,7 +13696,7 @@ static void test_bug10794()
mysql_stmt_free_result(stmt);
mysql_stmt_reset(stmt);
stmt_text= "select name from t1 where id=10";
- rc= mysql_stmt_prepare(stmt1, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt1, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt1, rc);
rc= mysql_stmt_bind_result(stmt1, my_bind);
check_execute(stmt1, rc);
@@ -13741,7 +13746,7 @@ static void test_bug11172()
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT id, hired FROM t1 WHERE hired=?";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
type= (ulong) CURSOR_TYPE_READ_ONLY;
@@ -13813,7 +13818,7 @@ static void test_bug11656()
stmt_text= "select distinct test_kind, test_id from t1 "
"where server in (?, ?)";
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
type= (ulong) CURSOR_TYPE_READ_ONLY;
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
@@ -13825,7 +13830,7 @@ static void test_bug11656()
{
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
my_bind[i].buffer= (gptr *)&buf[i];
- my_bind[i].buffer_length= strlen(buf[i]);
+ my_bind[i].buffer_length= (uint) strlen(buf[i]);
}
mysql_stmt_bind_param(stmt, my_bind);
@@ -13930,7 +13935,7 @@ static void test_bug11183()
stmt= mysql_stmt_init(mysql);
DIE_UNLESS(stmt != 0);
- rc= mysql_stmt_prepare(stmt, bug_statement, strlen(bug_statement));
+ rc= mysql_stmt_prepare(stmt, bug_statement, (uint) strlen(bug_statement));
check_execute(stmt, rc);
rc= mysql_query(mysql, "drop table t1");
@@ -13976,7 +13981,7 @@ static void test_bug11037()
stmt_text= "select id FROM t1";
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
/* expected error */
rc = mysql_stmt_fetch(stmt);
@@ -14044,7 +14049,7 @@ static void test_bug10760()
con1: insert into t1 (id) values (1)
*/
stmt_text= "select id from t1 order by 1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
@@ -14077,7 +14082,7 @@ static void test_bug10760()
else
{
stmt_text= "select id from t1 order by 1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_query(mysql, "alter table t1 engine=InnoDB");
@@ -14180,7 +14185,7 @@ static void test_bug11909()
myheader("test_bug11909");
stmt_text= "drop table if exists t1";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "create table t1 ("
@@ -14189,7 +14194,7 @@ static void test_bug11909()
" workdept varchar(6) not null, salary double not null,"
" bonus float not null, primary key (empno)"
") default charset=latin1 collate=latin1_bin";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "insert into t1 values "
@@ -14198,7 +14203,7 @@ static void test_bug11909()
"(30, 'SALLY', 'A', 'KWAN', 'C01', 38250, 800),"
"(50, 'JOHN', 'B', 'GEYER', 'E01', 40175, 800), "
"(60, 'IRVING', 'F', 'STERN', 'D11', 32250, 500)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
/* ****** Begin of trace ****** */
@@ -14296,7 +14301,7 @@ static void test_bug11901()
myheader("test_bug11901");
stmt_text= "drop table if exists t1, t2";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "create table t1 ("
@@ -14306,7 +14311,7 @@ static void test_bug11901()
" bonus float not null, primary key (empno), "
" unique key (workdept, empno) "
") default charset=latin1 collate=latin1_bin";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "insert into t1 values "
@@ -14343,7 +14348,7 @@ static void test_bug11901()
"(330, 'WING', '', 'LEE', 'E21', 25370, 500), "
"(340, 'JASON', 'R', 'GOUNOT', 'E21', 23840, 500)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "create table t2 ("
@@ -14352,7 +14357,7 @@ static void test_bug11901()
" admrdept varchar(6) not null, refcntd int(11) not null,"
" refcntu int(11) not null, primary key (deptno)"
") default charset=latin1 collate=latin1_bin";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
stmt_text= "insert into t2 values "
@@ -14365,7 +14370,7 @@ static void test_bug11901()
"('E01', 'SUPPORT SERVICES', 50, '', 'A00', 0, 0), "
"('E11', 'OPERATIONS', 90, '', 'E01', 0, 0), "
"('E21', 'SOFTWARE SUPPORT', 100,'', 'E01', 0, 0)";
- rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
+ rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
/* ****** Begin of trace ****** */
@@ -14435,7 +14440,7 @@ static void test_bug11904()
stmt_text= "SELECT id, MIN(name) FROM bug11904b GROUP BY id";
- rc= mysql_stmt_prepare(stmt1, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt1, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt1, rc);
memset(my_bind, 0, sizeof(my_bind));
@@ -14511,14 +14516,14 @@ static void test_bug12243()
stmt_text= "select a from t1";
- rc= mysql_stmt_prepare(stmt1, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt1, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt1, rc);
rc= mysql_stmt_execute(stmt1);
check_execute(stmt1, rc);
rc= mysql_stmt_fetch(stmt1);
check_execute(stmt1, rc);
- rc= mysql_stmt_prepare(stmt2, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt2, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt2, rc);
rc= mysql_stmt_execute(stmt2);
check_execute(stmt2, rc);
@@ -14624,7 +14629,7 @@ static void test_bug14210()
stmt_text= "select a from t1";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
while ((rc= mysql_stmt_fetch(stmt)) == 0)
@@ -14678,7 +14683,7 @@ static void test_bug13488()
rc= mysql_stmt_attr_set(stmt1,STMT_ATTR_CURSOR_TYPE, (const void *)&type);
check_execute(stmt1, rc);
- rc= mysql_stmt_prepare(stmt1, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt1, query, (uint) strlen(query));
check_execute(stmt1, rc);
rc= mysql_stmt_execute(stmt1);
@@ -14733,7 +14738,7 @@ static void test_bug13524()
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
check_execute(stmt, rc);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -14792,7 +14797,7 @@ static void test_bug14845()
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type);
check_execute(stmt, rc);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -14828,7 +14833,7 @@ static void test_bug15510()
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -15000,7 +15005,7 @@ static void test_bug15613()
/* II. Check SELECT metadata */
stmt_text= ("select t, tt, mt, lt, vl, vb, vu from t1");
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
metadata= mysql_stmt_result_metadata(stmt);
field= mysql_fetch_fields(metadata);
if (!opt_silent)
@@ -15194,7 +15199,7 @@ static void test_bug14169()
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "select f2,group_concat(f1) from t1 group by f2";
- rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
+ rc= mysql_stmt_prepare(stmt, stmt_text, (uint) strlen(stmt_text));
myquery(rc);
res= mysql_stmt_result_metadata(stmt);
field= mysql_fetch_fields(res);
@@ -15437,7 +15442,7 @@ static void test_bug20152()
myquery(rc);
stmt= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ rc= mysql_stmt_prepare(stmt, query, (uint) strlen(query));
check_execute(stmt, rc);
rc= mysql_stmt_bind_param(stmt, my_bind);
check_execute(stmt, rc);
@@ -15482,11 +15487,11 @@ static void test_bug15752()
printf("Unable connect to MySQL server: %s\n", mysql_error(&mysql_local));
DIE_UNLESS(0);
}
- rc= mysql_real_query(&mysql_local, query, strlen(query));
+ rc= mysql_real_query(&mysql_local, query, (uint) strlen(query));
myquery(rc);
mysql_free_result(mysql_store_result(&mysql_local));
- rc= mysql_real_query(&mysql_local, query, strlen(query));
+ rc= mysql_real_query(&mysql_local, query, (uint) strlen(query));
DIE_UNLESS(rc && mysql_errno(&mysql_local) == CR_COMMANDS_OUT_OF_SYNC);
if (! opt_silent)
@@ -15501,7 +15506,7 @@ static void test_bug15752()
/* The second problem is not reproducible: add the test case */
for (i = 0; i < ITERATION_COUNT; i++)
{
- if (mysql_real_query(&mysql_local, query, strlen(query)))
+ if (mysql_real_query(&mysql_local, query, (uint) strlen(query)))
{
printf("\ni=%d %s failed: %s\n", i, query, mysql_error(&mysql_local));
break;
@@ -15548,7 +15553,7 @@ static void test_bug21206()
for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
{
/* Init will exit(1) in case of error */
- stmt_fetch_init(fetch, fetch - fetch_array, query);
+ stmt_fetch_init(fetch, (uint) (fetch - fetch_array), query);
}
for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
@@ -15643,7 +15648,7 @@ static void test_bug23383()
stmt= mysql_stmt_init(mysql);
DIE_UNLESS(stmt != 0);
- rc= mysql_stmt_prepare(stmt, insert_query, strlen(insert_query));
+ rc= mysql_stmt_prepare(stmt, insert_query, (uint) strlen(insert_query));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -15656,7 +15661,7 @@ static void test_bug23383()
row_count= mysql_stmt_affected_rows(stmt);
DIE_UNLESS(row_count == (my_ulonglong)-1);
- rc= mysql_stmt_prepare(stmt, update_query, strlen(update_query));
+ rc= mysql_stmt_prepare(stmt, update_query, (uint) strlen(update_query));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
@@ -15722,7 +15727,7 @@ static void test_bug21635()
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
myquery(rc);
- rc= mysql_real_query(mysql, query, query_end - query);
+ rc= mysql_real_query(mysql, query, (uint) (query_end - query));
myquery(rc);
result= mysql_use_result(mysql);
@@ -16273,6 +16278,176 @@ static void test_bug38486(void)
DBUG_VOID_RETURN;
}
+static void bug20023_change_user(MYSQL *con)
+{
+ DIE_IF(mysql_change_user(con,
+ opt_user,
+ opt_password,
+ opt_db ? opt_db : "test"));
+}
+
+static void bug20023_query_int_variable(MYSQL *con,
+ const char *var_name,
+ int *var_value)
+{
+ MYSQL_RES *rs;
+ MYSQL_ROW row;
+
+ char query_buffer[MAX_TEST_QUERY_LENGTH];
+
+ my_snprintf(query_buffer,
+ sizeof (query_buffer),
+ "SELECT @@%s",
+ (const char *) var_name);
+
+ DIE_IF(mysql_query(con, query_buffer));
+ DIE_UNLESS(rs= mysql_store_result(con));
+ DIE_UNLESS(row= mysql_fetch_row(rs));
+ *var_value= atoi(row[0]);
+ mysql_free_result(rs);
+}
+
+static void test_bug20023()
+{
+ MYSQL con;
+
+ int sql_big_selects_orig;
+ int max_join_size_orig;
+
+ int sql_big_selects_2;
+ int sql_big_selects_3;
+ int sql_big_selects_4;
+ int sql_big_selects_5;
+
+ char query_buffer[MAX_TEST_QUERY_LENGTH];
+
+ /* Create a new connection. */
+
+ DIE_UNLESS(mysql_init(&con));
+
+ DIE_UNLESS(mysql_real_connect(&con,
+ opt_host,
+ opt_user,
+ opt_password,
+ opt_db ? opt_db : "test",
+ opt_port,
+ opt_unix_socket,
+ CLIENT_FOUND_ROWS));
+
+ /***********************************************************************
+ Remember original SQL_BIG_SELECTS, MAX_JOIN_SIZE values.
+ ***********************************************************************/
+
+ bug20023_query_int_variable(&con,
+ "session.sql_big_selects",
+ &sql_big_selects_orig);
+
+ bug20023_query_int_variable(&con,
+ "global.max_join_size",
+ &max_join_size_orig);
+
+ /***********************************************************************
+ Test that COM_CHANGE_USER resets the SQL_BIG_SELECTS to the initial value.
+ ***********************************************************************/
+
+ /* Issue COM_CHANGE_USER. */
+
+ bug20023_change_user(&con);
+
+ /* Query SQL_BIG_SELECTS. */
+
+ bug20023_query_int_variable(&con,
+ "session.sql_big_selects",
+ &sql_big_selects_2);
+
+ /* Check that SQL_BIG_SELECTS is reset properly. */
+
+ DIE_UNLESS(sql_big_selects_orig == sql_big_selects_2);
+
+ /***********************************************************************
+ Test that if MAX_JOIN_SIZE set to non-default value,
+ SQL_BIG_SELECTS will be 0.
+ ***********************************************************************/
+
+ /* Set MAX_JOIN_SIZE to some non-default value. */
+
+ DIE_IF(mysql_query(&con, "SET @@global.max_join_size = 10000"));
+ DIE_IF(mysql_query(&con, "SET @@session.max_join_size = default"));
+
+ /* Issue COM_CHANGE_USER. */
+
+ bug20023_change_user(&con);
+
+ /* Query SQL_BIG_SELECTS. */
+
+ bug20023_query_int_variable(&con,
+ "session.sql_big_selects",
+ &sql_big_selects_3);
+
+ /* Check that SQL_BIG_SELECTS is 0. */
+
+ DIE_UNLESS(sql_big_selects_3 == 0);
+
+ /***********************************************************************
+ Test that if MAX_JOIN_SIZE set to default value,
+ SQL_BIG_SELECTS will be 1.
+ ***********************************************************************/
+
+ /* Set MAX_JOIN_SIZE to the default value (-1). */
+
+ DIE_IF(mysql_query(&con, "SET @@global.max_join_size = -1"));
+ DIE_IF(mysql_query(&con, "SET @@session.max_join_size = default"));
+
+ /* Issue COM_CHANGE_USER. */
+
+ bug20023_change_user(&con);
+
+ /* Query SQL_BIG_SELECTS. */
+
+ bug20023_query_int_variable(&con,
+ "session.sql_big_selects",
+ &sql_big_selects_4);
+
+ /* Check that SQL_BIG_SELECTS is 1. */
+
+ DIE_UNLESS(sql_big_selects_4 == 1);
+
+ /***********************************************************************
+ Restore MAX_JOIN_SIZE.
+ Check that SQL_BIG_SELECTS will be the original one.
+ ***********************************************************************/
+
+ /* Restore MAX_JOIN_SIZE. */
+
+ my_snprintf(query_buffer,
+ sizeof (query_buffer),
+ "SET @@global.max_join_size = %d",
+ (int) max_join_size_orig);
+
+ DIE_IF(mysql_query(&con, query_buffer));
+ DIE_IF(mysql_query(&con, "SET @@session.max_join_size = default"));
+
+ /* Issue COM_CHANGE_USER. */
+
+ bug20023_change_user(&con);
+
+ /* Query SQL_BIG_SELECTS. */
+
+ bug20023_query_int_variable(&con,
+ "session.sql_big_selects",
+ &sql_big_selects_5);
+
+ /* Check that SQL_BIG_SELECTS is 1. */
+
+ DIE_UNLESS(sql_big_selects_5 == sql_big_selects_orig);
+
+ /***********************************************************************
+ That's it. Cleanup.
+ ***********************************************************************/
+
+ mysql_close(&con);
+}
+
static void test_bug40365(void)
{
uint rc, i;
@@ -16410,6 +16585,69 @@ static void test_bug36326()
#endif
+/**
+ Bug#41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch() returns short
+ string value.
+*/
+
+static void test_bug41078(void)
+{
+ uint rc;
+ MYSQL_STMT *stmt= 0;
+ MYSQL_BIND param, result;
+ ulong cursor_type= CURSOR_TYPE_READ_ONLY;
+ ulong len;
+ char str[64];
+ const char param_str[]= "abcdefghijklmn";
+ my_bool is_null, error;
+
+ DBUG_ENTER("test_bug41078");
+
+ rc= mysql_query(mysql, "SET NAMES UTF8");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "SELECT ?");
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor_type);
+ check_execute(stmt, rc);
+
+ bzero(&param, sizeof(param));
+ param.buffer_type= MYSQL_TYPE_STRING;
+ param.buffer= (void *) param_str;
+ len= sizeof(param_str) - 1;
+ param.length= &len;
+
+ rc= mysql_stmt_bind_param(stmt, &param);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ bzero(&result, sizeof(result));
+ result.buffer_type= MYSQL_TYPE_STRING;
+ result.buffer= str;
+ result.buffer_length= sizeof(str);
+ result.is_null= &is_null;
+ result.length= &len;
+ result.error= &error;
+
+ rc= mysql_stmt_bind_result(stmt, &result);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_fetch(stmt);
+ check_execute(stmt, rc);
+
+ DIE_UNLESS(len == sizeof(param_str) - 1 && !strcmp(str, param_str));
+
+ mysql_stmt_close(stmt);
+
+ DBUG_VOID_RETURN;
+}
/*
Read and parse arguments and MySQL options from my.cnf
@@ -16713,6 +16951,8 @@ static struct my_tests_st my_tests[]= {
#ifdef HAVE_QUERY_CACHE
{ "test_bug36326", test_bug36326 },
#endif
+ { "test_bug41078", test_bug41078 },
+ { "test_bug20023", test_bug20023 },
{ 0, 0 }
};
diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c
index faed9addf60..36f2b8eff9d 100644
--- a/tools/mysqlmanager.c
+++ b/tools/mysqlmanager.c
@@ -992,7 +992,6 @@ end:
static int authenticate(struct manager_thd* thd)
{
char* buf_end,*buf,*p,*p_end;
- my_MD5_CTX context;
uchar digest[MD5_LEN];
struct manager_user* u;
char c;
@@ -1018,9 +1017,7 @@ static int authenticate(struct manager_thd* thd)
return 1;
for (;my_isspace(cs,*buf) && buf<buf_end;buf++) /* empty */;
- my_MD5Init(&context);
- my_MD5Update(&context,(uchar*) buf,(uint)(buf_end-buf));
- my_MD5Final(digest,&context);
+ MY_MD5_HASH (digest, (uchar*) buf,(uint)(buf_end-buf));
if (memcmp(u->md5_pass,digest,MD5_LEN))
return 1;
client_msg(&thd->net,MANAGER_OK,"OK");
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 84fdd6f57e4..13fbf5d98d8 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -67,7 +67,7 @@ int vio_read_buff(Vio *vio, gptr buf, int size)
if (vio->read_pos < vio->read_end)
{
- rc= min(vio->read_end - vio->read_pos, size);
+ rc= min((int) (vio->read_end - vio->read_pos), size);
memcpy(buf, vio->read_pos, rc);
vio->read_pos+= rc;
/*