diff --git a/VERSION b/VERSION index f85cac84d7e..17335ff3fc5 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=9 +MYSQL_VERSION_PATCH=10 MYSQL_VERSION_EXTRA= diff --git a/client/client_priv.h b/client/client_priv.h index 1a81768adc4..cc589e55d52 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -85,6 +85,7 @@ enum options_client OPT_WRITE_BINLOG, OPT_DUMP_DATE, OPT_INIT_COMMAND, OPT_PLUGIN_DIR, + OPT_DEFAULT_AUTH, OPT_DEFAULT_PLUGIN, OPT_MAX_CLIENT_OPTION }; diff --git a/client/mysql.cc b/client/mysql.cc index 241cca49a5d..8fea1b054f3 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -162,7 +162,7 @@ static int wait_time = 5; static STATUS status; static ulong select_limit,max_join_size,opt_connect_timeout=0; static char mysql_charsets_dir[FN_REFLEN+1]; -static char *opt_plugin_dir= 0, *opt_default_auth; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; static const char *xmlmeta[] = { "&", "&", "<", "<", @@ -1564,7 +1564,7 @@ static struct my_option my_long_options[] = {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_PLUGIN_DIR, + {"default_auth", OPT_DEFAULT_AUTH, "Default authentication client-side plugin to use.", (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 4fbf08102bd..b364acd5e61 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -45,6 +45,8 @@ static DYNAMIC_STRING ds_args; static DYNAMIC_STRING conn_args; static char *opt_password= 0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; + static my_bool tty_password= 0; static char opt_tmpdir[FN_REFLEN] = ""; @@ -88,6 +90,10 @@ static struct my_option my_long_options[]= {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade " "has already been executed for the current version of MySQL.", &opt_force, &opt_force, 0, @@ -102,6 +108,9 @@ static struct my_option my_long_options[]= {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -283,6 +292,8 @@ get_one_option(int optid, const struct my_option *opt, case 'S': /* --socket */ case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */ + case OPT_PLUGIN_DIR: /* --plugin-dir */ + case OPT_DEFAULT_AUTH: /* --default-auth */ add_one_option(&conn_args, opt, argument); break; } diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 4c4747c25de..580caa38c0d 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ #include "client_priv.h" #include -#ifdef THREAD #include /* because of signal() */ -#endif #include #include #include @@ -44,7 +42,7 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations; static uint opt_count_iterations= 0, my_end_arg; static ulong opt_connect_timeout, opt_shutdown_timeout; static char * unix_port=0; -static char *opt_plugin_dir= 0, *opt_default_auth; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; @@ -210,7 +208,7 @@ static struct my_option my_long_options[] = {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_PLUGIN_DIR, + {"default_auth", OPT_DEFAULT_AUTH, "Default authentication client-side plugin to use.", (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -415,6 +413,9 @@ int main(int argc,char *argv[]) if (interval) /* --sleep=interval given */ { + if (opt_count_iterations && --nr_iterations == 0) + break; + /* If connection was dropped (unintentionally, or due to SHUTDOWN), re-establish it if --wait ("retry-connect") was given and user diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index bf4920c6f77..91b075a8970 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -79,6 +79,8 @@ static char* host = 0; static int port= 0; static uint my_end_arg; static const char* sock= 0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; + #ifdef HAVE_SMEM static char *shared_memory_base_name= 0; #endif @@ -1039,6 +1041,10 @@ static struct my_option my_long_options[] = {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"disable-log-bin", 'D', "Disable binary log. This is useful, if you " "enabled --to-last-log and are sending the output to the same MySQL server. " "This way you could avoid an endless loop. You would also like to use it " @@ -1064,6 +1070,9 @@ static struct my_option my_long_options[] = 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to connect to remote server.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -1381,6 +1390,12 @@ static Exit_status safe_connect() return ERROR_STOP; } + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + if (opt_protocol) mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); #ifdef HAVE_SMEM diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 7b188d7ce18..f38d674ae8d 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -40,6 +40,7 @@ static int my_end_arg; static char * opt_mysql_unix_port = 0; static char *opt_password = 0, *current_user = 0, *default_charset= 0, *current_host= 0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; static int first_error = 0; DYNAMIC_ARRAY tables4repair; #ifdef HAVE_SMEM @@ -99,6 +100,10 @@ static struct my_option my_long_options[] = {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"fast",'F', "Check only tables that haven't been closed properly.", &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -136,6 +141,9 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -796,6 +804,13 @@ static int dbConnect(char *host, char *user, char *passwd) if (shared_memory_base_name) mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth); + mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, NULL, opt_mysql_port, opt_mysql_unix_port, 0))) diff --git a/client/mysqldump.c b/client/mysqldump.c index 2d38e94f0fb..66f0c2801f5 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -137,7 +137,7 @@ FILE *stderror_file=0; static char *shared_memory_base_name=0; #endif static uint opt_protocol= 0; -static char *opt_plugin_dir= 0, *opt_default_auth; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; /* Dynamic_string wrapper functions. In this file use these @@ -503,7 +503,7 @@ static struct my_option my_long_options[] = {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default_auth", OPT_PLUGIN_DIR, + {"default_auth", OPT_DEFAULT_AUTH, "Default authentication client-side plugin to use.", (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -2237,6 +2237,15 @@ static uint get_table_structure(char *table, char *db, char *table_type, const char *insert_option; char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH]; + const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, " + "`COLUMN_TYPE` AS `Type`, " + "`IS_NULLABLE` AS `Null`, " + "`COLUMN_KEY` AS `Key`, " + "`COLUMN_DEFAULT` AS `Default`, " + "`EXTRA` AS `Extra`, " + "`COLUMN_COMMENT` AS `Comment` " + "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " + "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'"; FILE *sql_file= md_result_file; int len; MYSQL_RES *result; @@ -2504,8 +2513,8 @@ static uint get_table_structure(char *table, char *db, char *table_type, verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", my_progname, mysql_error(mysql)); - my_snprintf(query_buff, sizeof(query_buff), "show fields from %s", - result_table); + my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table); + if (mysql_query_with_error_report(mysql, &result, query_buff)) DBUG_RETURN(0); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index aea1cb79e74..7966766c1eb 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -60,6 +60,7 @@ static char *opt_password=0, *current_user=0, *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; static uint opt_mysql_port= 0, opt_protocol= 0; static char * opt_mysql_unix_port=0; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; static longlong opt_ignore_lines= -1; #include @@ -90,6 +91,10 @@ static struct my_option my_long_options[] = {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delete", 'd', "First delete all rows from table.", &opt_delete, &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"fields-terminated-by", OPT_FTB, @@ -139,6 +144,9 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 @@ -429,6 +437,13 @@ static MYSQL *db_connect(char *host, char *database, if (shared_memory_base_name) mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (!(mysql_real_connect(mysql,host,user,passwd, database,opt_mysql_port,opt_mysql_unix_port, diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 8cd70db1424..f8a32aae2c0 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -34,6 +34,7 @@ static my_bool debug_info_flag= 0, debug_check_flag= 0; static uint my_end_arg= 0; static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; @@ -124,6 +125,12 @@ int main(int argc, char **argv) #endif mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + if (!(mysql_real_connect(&mysql,host,user,opt_password, (first_argument_uses_wildcards) ? "" : argv[0],opt_mysql_port,opt_mysql_unix_port, @@ -182,6 +189,10 @@ static struct my_option my_long_options[] = {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, @@ -195,6 +206,9 @@ static struct my_option my_long_options[] = "Password to use when connecting to server. If password is not given, it's " "solicited on the tty.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection or 0 for default to, in " "order of preference, my.cnf, $MYSQL_TCP_PORT, " #if MYSQL_PORT_DEFAULT == 0 diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 4e8e4f1aa67..237fa18c226 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -122,6 +122,7 @@ static char *host= NULL, *opt_password= NULL, *user= NULL, *pre_system= NULL, *post_system= NULL, *opt_mysql_unix_port= NULL; +static char *opt_plugin_dir= 0, *opt_default_auth= 0; const char *delimiter= "\n"; @@ -338,6 +339,12 @@ int main(int argc, char **argv) #endif mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (opt_plugin_dir && *opt_plugin_dir) + mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir); + + if (opt_default_auth && *opt_default_auth) + mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); + if (!opt_only_print) { if (!(mysql_real_connect(&mysql, host, user, opt_password, @@ -581,6 +588,10 @@ static struct my_option my_long_options[] = GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"default_auth", OPT_DEFAULT_AUTH, + "Default authentication client-side plugin to use.", + (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"delimiter", 'F', "Delimiter to use in SQL statements supplied in file or command line.", &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG, @@ -620,6 +631,9 @@ static struct my_option my_long_options[] = {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", + (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Port number to use for connection.", &opt_mysql_port, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, @@ -1507,7 +1521,12 @@ generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt) exit(1); } - result= mysql_store_result(mysql); + if (!(result= mysql_store_result(mysql))) + { + fprintf(stderr, "%s: Error when storing result: %d %s\n", + my_progname, mysql_errno(mysql), mysql_error(mysql)); + exit(1); + } primary_keys_number_of= mysql_num_rows(result); /* So why check this? Blackhole :) */ @@ -1879,10 +1898,15 @@ limit_not_met: { if (mysql_field_count(mysql)) { - result= mysql_store_result(mysql); - while ((row = mysql_fetch_row(result))) - counter++; - mysql_free_result(result); + if (!(result= mysql_store_result(mysql))) + fprintf(stderr, "%s: Error when storing result: %d %s\n", + my_progname, mysql_errno(mysql), mysql_error(mysql)); + else + { + while ((row= mysql_fetch_row(result))) + counter++; + mysql_free_result(result); + } } } while(mysql_next_result(mysql) == 0); queries++; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index f266197116b..5d33f293a28 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* mysqltest @@ -468,6 +468,8 @@ TYPELIB command_typelib= {array_elements(command_names),"", command_names, 0}; DYNAMIC_STRING ds_res; +/* Points to ds_warning in run_query, so it can be freed */ +DYNAMIC_STRING *ds_warn= 0; char builtin_echo[FN_REFLEN]; @@ -488,7 +490,7 @@ VAR* var_init(VAR* v, const char *name, int name_len, const char *val, VAR* var_get(const char *var_name, const char** var_name_end, my_bool raw, my_bool ignore_not_existing); void eval_expr(VAR* v, const char *p, const char** p_end, - bool open_end=false, bool backtick=true); + bool open_end=false, bool do_eval=true); my_bool match_delimiter(int c, const char *delim, uint length); void dump_result_to_reject_file(char *buf, int size); void dump_warning_messages(); @@ -1275,6 +1277,8 @@ void free_used_memory() my_free(embedded_server_args[--embedded_server_arg_count]); delete_dynamic(&q_lines); dynstr_free(&ds_res); + if (ds_warn) + dynstr_free(ds_warn); free_all_replace(); my_free(opt_pass); free_defaults(default_argv); @@ -1318,6 +1322,17 @@ static void cleanup_and_exit(int exit_code) exit(exit_code); } +void print_file_stack() +{ + for (struct st_test_file* err_file= cur_file; + err_file != file_stack; + err_file--) + { + fprintf(stderr, "included from %s at line %d:\n", + err_file->file_name, err_file->lineno); + } +} + void die(const char *fmt, ...) { static int dying= 0; @@ -1337,8 +1352,12 @@ void die(const char *fmt, ...) /* Print the error message */ fprintf(stderr, "mysqltest: "); if (cur_file && cur_file != file_stack) - fprintf(stderr, "In included file \"%s\": ", + { + fprintf(stderr, "In included file \"%s\": \n", cur_file->file_name); + print_file_stack(); + } + if (start_lineno > 0) fprintf(stderr, "At line %u: ", start_lineno); if (fmt) @@ -1368,20 +1387,14 @@ void die(const char *fmt, ...) void abort_not_supported_test(const char *fmt, ...) { va_list args; - struct st_test_file* err_file= cur_file; DBUG_ENTER("abort_not_supported_test"); /* Print include filestack */ fprintf(stderr, "The test '%s' is not supported by this installation\n", file_stack->file_name); fprintf(stderr, "Detected in file %s at line %d\n", - err_file->file_name, err_file->lineno); - while (err_file != file_stack) - { - err_file--; - fprintf(stderr, "included from %s at line %d\n", - err_file->file_name, err_file->lineno); - } + cur_file->file_name, cur_file->lineno); + print_file_stack(); /* Print error message */ va_start(args, fmt); @@ -2519,7 +2532,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var) break; } } - eval_expr(var, value, 0); + eval_expr(var, value, 0, false, false); } dynstr_free(&ds_query); mysql_free_result(res); @@ -2551,12 +2564,16 @@ void var_copy(VAR *dest, VAR *src) void eval_expr(VAR *v, const char *p, const char **p_end, - bool open_end, bool backtick) + bool open_end, bool do_eval) { DBUG_ENTER("eval_expr"); DBUG_PRINT("enter", ("p: '%s'", p)); + /* Skip to treat as pure string if no evaluation */ + if (! do_eval) + goto NO_EVAL; + if (*p == '$') { VAR *vp; @@ -2576,7 +2593,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, DBUG_VOID_RETURN; } - if (*p == '`' && backtick) + if (*p == '`') { var_query_set(v, p, p_end); DBUG_VOID_RETURN; @@ -2599,6 +2616,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, } } + NO_EVAL: { int new_val_len = (p_end && *p_end) ? (int) (*p_end - p) : (int) strlen(p); @@ -7679,6 +7697,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) die ("Cannot reap on a connection without pending send"); init_dynamic_string(&ds_warnings, NULL, 0, 256); + ds_warn= &ds_warnings; + /* Evaluate query if this is an eval command */ @@ -7836,6 +7856,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) ds, &ds_warnings); dynstr_free(&ds_warnings); + ds_warn= 0; if (command->type == Q_EVAL || command->type == Q_SEND_EVAL) dynstr_free(&eval_query); diff --git a/cmake/character_sets.cmake b/cmake/character_sets.cmake index d51444ec433..1cf63ed1462 100644 --- a/cmake/character_sets.cmake +++ b/cmake/character_sets.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,17 +13,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#Charsets and collations +# Charsets and collations IF(NOT DEFAULT_CHARSET) -SET(DEFAULT_CHARSET "latin1") + SET(DEFAULT_CHARSET "latin1") ENDIF() -IF(NOT DEFAULT_COLLATIONS) -SET(DEFAULT_COLLATION "latin1_swedish_ci") +IF(NOT DEFAULT_COLLATION) + SET(DEFAULT_COLLATION "latin1_swedish_ci") ENDIF() SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4) -SET(CHARSETS_COMPLEX big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) +SET(CHARSETS_COMPLEX + big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 + sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) SET(CHARSETS_AVAILABLE binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257 diff --git a/cmd-line-utils/readline/CMakeLists.txt b/cmd-line-utils/readline/CMakeLists.txt index ed6a6b902ea..be84f22f210 100644 --- a/cmd-line-utils/readline/CMakeLists.txt +++ b/cmd-line-utils/readline/CMakeLists.txt @@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/cmd-line-utils) -ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR -DMYSQL_CLIENT_NO_THREADS) +ADD_DEFINITIONS(-DHAVE_CONFIG_H -DNO_KILL_INTR) INCLUDE_DIRECTORIES(${CURSES_INCLUDE_PATH}) diff --git a/config.h.cmake b/config.h.cmake index fc582da337f..65ebd077da6 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -470,9 +470,6 @@ #cmakedefine STACK_DIRECTION @STACK_DIRECTION@ -#define THREAD 1 -#define THREAD_SAFE_CLIENT 1 - #define SYSTEM_TYPE "@SYSTEM_TYPE@" #define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@" #cmakedefine HAVE_DTRACE 1 @@ -518,8 +515,8 @@ #cmakedefine CYBOZU 1 /* Character sets and collations */ -#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "latin1" -#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci" +#cmakedefine MYSQL_DEFAULT_CHARSET_NAME "@MYSQL_DEFAULT_CHARSET_NAME@" +#cmakedefine MYSQL_DEFAULT_COLLATION_NAME "@MYSQL_DEFAULT_COLLATION_NAME@" #cmakedefine USE_MB 1 #cmakedefine USE_MB_IDENT 1 diff --git a/dbug/dbug.c b/dbug/dbug.c index 74568f55fe0..2c06eeff95a 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -319,15 +319,6 @@ static void DbugExit(const char *why); static const char *DbugStrTok(const char *s); static void DbugVfprintf(FILE *stream, const char* format, va_list args); -#ifndef THREAD - /* Open profile output stream */ -static FILE *OpenProfile(CODE_STATE *cs, const char *name); - /* Profile if asked for it */ -static BOOLEAN DoProfile(CODE_STATE *); - /* Return current user time (ms) */ -static unsigned long Clock(void); -#endif - /* * Miscellaneous printf format strings. */ @@ -355,7 +346,6 @@ static unsigned long Clock(void); ** Macros to allow dbugging with threads */ -#ifdef THREAD #include static pthread_mutex_t THR_LOCK_dbug; @@ -394,30 +384,6 @@ static CODE_STATE *code_state(void) return cs; } -#else /* !THREAD */ - -static CODE_STATE static_code_state= -{ - "dbug", "?func", "?file", NULL, &init_settings, - NullS, NullS, 0,0,0,0,0,NullS -}; - -static CODE_STATE *code_state(void) -{ - if (!init_done) - { - bzero(&init_settings, sizeof(init_settings)); - init_settings.out_file=stderr; - init_settings.flags=OPEN_APPEND; - init_done=TRUE; - } - return &static_code_state; -} - -#define pthread_mutex_lock(A) {} -#define pthread_mutex_unlock(A) {} -#endif - /* * Translate some calls among different systems. */ @@ -601,15 +567,6 @@ int DbugParse(CODE_STATE *cs, const char *control) else stack->flags |= PID_ON; break; -#ifndef THREAD - case 'g': - if (OpenProfile(cs, PROF_FILE)) - { - stack->flags |= PROFILE_ON; - stack->p_functions= ListAdd(stack->p_functions, control, end); - } - break; -#endif case 'L': if (sign < 0) stack->flags &= ~LINE_ON; @@ -1154,23 +1111,7 @@ void _db_enter_(const char *_func_, const char *_file_, _stack_frame_->prev= cs->framep; _stack_frame_->level= ++cs->level | framep_trace_flag(cs, cs->framep); cs->framep= _stack_frame_; -#ifndef THREAD - if (DoProfile(cs)) - { - long stackused; - if (cs->framep->prev == NULL) - stackused= 0; - else - { - stackused= (char*)(cs->framep->prev) - (char*)(cs->framep); - stackused= stackused > 0 ? stackused : -stackused; - } - (void) fprintf(cs->stack->prof_file, PROF_EFMT , Clock(), cs->func); - (void) fprintf(cs->stack->prof_file, PROF_SFMT, (ulong) cs->framep, stackused, - AUTOS_REVERSE ? _stack_frame_->func : cs->func); - (void) fflush(cs->stack->prof_file); - } -#endif + switch (DoTrace(cs)) { case ENABLE_TRACE: cs->framep->level|= TRACE_ON; @@ -1229,10 +1170,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_) my_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func); DbugExit(buf); } -#ifndef THREAD - if (DoProfile(cs)) - (void) fprintf(cs->stack->prof_file, PROF_XFMT, Clock(), cs->func); -#endif + if (DoTrace(cs) & DO_TRACE) { if (TRACING) @@ -1744,36 +1682,6 @@ static int DoTrace(CODE_STATE *cs) return DONT_TRACE; } - -/* - * FUNCTION - * - * DoProfile check to see if profiling is current enabled - * - * SYNOPSIS - * - * static BOOLEAN DoProfile() - * - * DESCRIPTION - * - * Checks to see if profiling is enabled based on whether the - * user has specified profiling, the maximum trace depth has - * not yet been reached, the current function is selected, - * and the current process is selected. Returns TRUE if - * profiling is enabled, FALSE otherwise. - * - */ - -#ifndef THREAD -static BOOLEAN DoProfile(CODE_STATE *cs) -{ - return PROFILING && - cs->level <= cs->stack->maxdepth && - InList(cs->stack->p_functions, cs->func) & (INCLUDE|MATCHED) && - InList(cs->stack->processes, cs->process) & (INCLUDE|MATCHED); -} -#endif - FILE *_db_fp_(void) { CODE_STATE *cs; @@ -1900,11 +1808,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_) cs->lineno++; if (cs->stack->flags & PID_ON) { -#ifdef THREAD (void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name()); -#else - (void) fprintf(cs->stack->out_file, "%5d: ", (int) getpid()); -#endif } if (cs->stack->flags & NUMBER_ON) (void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno); @@ -2014,63 +1918,6 @@ static void DBUGOpenFile(CODE_STATE *cs, } } - -/* - * FUNCTION - * - * OpenProfile open new output stream for profiler output - * - * SYNOPSIS - * - * static FILE *OpenProfile(name) - * char *name; - * - * DESCRIPTION - * - * Given name of a new file, opens the file - * and sets the profiler output stream to the new file. - * - * It is currently unclear whether the prefered behavior is - * to truncate any existing file, or simply append to it. - * The latter behavior would be desirable for collecting - * accumulated runtime history over a number of separate - * runs. It might take some changes to the analyzer program - * though, and the notes that Binayak sent with the profiling - * diffs indicated that append was the normal mode, but this - * does not appear to agree with the actual code. I haven't - * investigated at this time [fnf; 24-Jul-87]. - */ - -#ifndef THREAD -static FILE *OpenProfile(CODE_STATE *cs, const char *name) -{ - REGISTER FILE *fp; - REGISTER BOOLEAN newfile; - - fp=0; - if (!Writable(name)) - { - (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); - perror(""); - (void) Delay(cs->stack->delay); - } - else - { - newfile= !EXISTS(name); - if (!(fp= fopen(name, "w"))) - { - (void) fprintf(cs->stack->out_file, ERR_OPEN, cs->process, name); - perror(""); - } - else - { - cs->stack->prof_file= fp; - } - } - return fp; -} -#endif - /* * FUNCTION * @@ -2419,80 +2266,6 @@ const char* _db_get_func_(void) return cs->func; } -/* - * Here we need the definitions of the clock routine. Add your - * own for whatever system that you have. - */ - -#ifndef THREAD -#if defined(HAVE_GETRUSAGE) - -#include -#include - -/* extern int getrusage(int, struct rusage *); */ - -/* - * Returns the user time in milliseconds used by this process so - * far. - */ - -static unsigned long Clock() -{ - struct rusage ru; - - (void) getrusage(RUSAGE_SELF, &ru); - return ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; -} - -#elif defined(__WIN__) - -static ulong Clock() -{ - return clock()*(1000/CLOCKS_PER_SEC); -} -#elif defined(amiga) - -struct DateStamp { /* Yes, this is a hack, but doing it right */ - long ds_Days; /* is incredibly ugly without splitting this */ - long ds_Minute; /* off into a separate file */ - long ds_Tick; -}; - -static int first_clock= TRUE; -static struct DateStamp begin; -static struct DateStamp elapsed; - -static unsigned long Clock() -{ - register struct DateStamp *now; - register unsigned long millisec= 0; - extern VOID *AllocMem(); - - now= (struct DateStamp *) AllocMem((long) sizeof(struct DateStamp), 0L); - if (now != NULL) - { - if (first_clock == TRUE) - { - first_clock= FALSE; - (void) DateStamp(now); - begin= *now; - } - (void) DateStamp(now); - millisec= 24 * 3600 * (1000 / HZ) * (now->ds_Days - begin.ds_Days); - millisec += 60 * (1000 / HZ) * (now->ds_Minute - begin.ds_Minute); - millisec += (1000 / HZ) * (now->ds_Tick - begin.ds_Tick); - (void) FreeMem(now, (long) sizeof(struct DateStamp)); - } - return millisec; -} -#else -static unsigned long Clock() -{ - return 0; -} -#endif /* RUSAGE */ -#endif /* THREADS */ #else diff --git a/dbug/dbug_analyze.c b/dbug/dbug_analyze.c index 1ebe8bfd77e..3d5713758ae 100644 --- a/dbug/dbug_analyze.c +++ b/dbug/dbug_analyze.c @@ -571,12 +571,10 @@ int main (int argc, char **argv) FILE *infile; FILE *outfile = {stdout}; -#ifdef THREAD #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif - my_thread_global_init(); -#endif /* THREAD */ + my_thread_global_init(); { DBUG_ENTER ("main"); DBUG_PROCESS (argv[0]); diff --git a/dbug/my_main.c b/dbug/my_main.c index 31c15aa67aa..48d092ca10a 100644 --- a/dbug/my_main.c +++ b/dbug/my_main.c @@ -16,12 +16,11 @@ char *argv[]; { register int result, ix; extern int factorial(int); -#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) +#if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif -#ifdef THREAD my_thread_global_init(); -#endif + { DBUG_ENTER ("main"); DBUG_PROCESS (argv[0]); diff --git a/dbug/tests.c b/dbug/tests.c index d76266d34a3..837a477aef3 100644 --- a/dbug/tests.c +++ b/dbug/tests.c @@ -44,12 +44,11 @@ int main (int argc, char *argv[]) if (argc == 1) return 0; -#if defined(HAVE_PTHREAD_INIT) && defined(THREAD) +#if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif -#ifdef THREAD my_thread_global_init(); -#endif + dup2(1, 2); for (i = 1; i < argc; i++) { diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 89fd4104c6f..25ec8beb59f 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -193,7 +193,7 @@ int main(int argc, char **argv) } for (argument= arguments+1 ; *argument ; argument++) - if (*argument != args_separator) /* skip arguments separator */ + if (!my_getopt_is_args_separator(*argument)) /* skip arguments separator */ puts(*argument); my_free(load_default_groups); free_defaults(arguments); diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index e89929d159d..d8bac7532cc 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -40,7 +40,6 @@ SET(HEADERS my_xml.h mysql_embed.h my_pthread.h - my_no_pthread.h decimal.h errmsg.h my_global.h diff --git a/include/heap.h b/include/heap.h index a585371e18f..755a1aa3fed 100644 --- a/include/heap.h +++ b/include/heap.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2004 MySQL AB, 2009 Sun Microsystems, Inc +/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights + reserved This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,10 +26,9 @@ extern "C" { #ifndef _my_base_h #include #endif -#ifdef THREAD + #include #include -#endif #include "my_handler.h" #include "my_tree.h" @@ -146,10 +146,8 @@ typedef struct st_heap_share uint open_count; uchar *del_link; /* Link to next block with del. rec */ char * name; /* Name of "memory-file" */ -#ifdef THREAD THR_LOCK lock; mysql_mutex_t intern_lock; /* Locking for use with _locking */ -#endif my_bool delete_on_close; LIST open_list; uint auto_key; @@ -175,9 +173,7 @@ typedef struct st_heap_info TREE_ELEMENT **last_pos; uint lastkey_len; my_bool implicit_emptied; -#ifdef THREAD THR_LOCK_DATA lock; -#endif LIST open_list; } HP_INFO; diff --git a/include/my_base.h b/include/my_base.h index 83b02bfd833..347bda01bef 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights + reserved This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,9 +31,6 @@ #define EOVERFLOW 84 #endif -#if !defined(USE_MY_FUNC) && !defined(THREAD) -#include /* For faster code, after test */ -#endif /* USE_MY_FUNC */ #endif /* stdin */ #include diff --git a/include/my_bitmap.h b/include/my_bitmap.h index 548eec14d6e..78b33b09a51 100644 --- a/include/my_bitmap.h +++ b/include/my_bitmap.h @@ -33,9 +33,7 @@ typedef struct st_bitmap thread_safe flag in bitmap_init was set. Otherwise, we optimize by not acquiring the mutex */ -#ifdef THREAD mysql_mutex_t *mutex; -#endif } MY_BITMAP; #ifdef __cplusplus diff --git a/include/my_global.h b/include/my_global.h index a411ab8a118..c1ae8a6d6bc 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -212,13 +212,6 @@ #include #endif -/* The client defines this to avoid all thread code */ -#if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK) -#undef THREAD -#undef HAVE_LINUXTHREADS -#undef HAVE_NPTL -#endif - #ifdef HAVE_THREADS_WITHOUT_SOCKETS /* MIT pthreads does not work with unix sockets */ #undef HAVE_SYS_UN_H @@ -261,7 +254,7 @@ #endif #endif -#if defined(THREAD) && !defined(__WIN__) +#if !defined(__WIN__) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #endif @@ -282,7 +275,7 @@ C_MODE_END #if !defined(SCO) && !defined(_REENTRANT) #define _REENTRANT 1 /* Threads requires reentrant code */ #endif -#endif /* THREAD */ +#endif /* !defined(__WIN__) */ /* Go around some bugs in different OS and compilers */ #ifdef _AIX /* By soren@t.dk */ @@ -415,7 +408,7 @@ C_MODE_END #include /* HPUX 10.20 defines ulong here. UGLY !!! */ #define HAVE_ULONG #endif -#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) +#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) /* Fix bug in setrlimit */ #undef setrlimit #define setrlimit cma_setrlimit64 @@ -1342,17 +1335,6 @@ do { doubleget_union _tmp; \ #endif /* WORDS_BIGENDIAN */ -#ifndef THREAD -#define thread_safe_increment(V,L) (V)++ -#define thread_safe_decrement(V,L) (V)-- -#define thread_safe_add(V,C,L) (V)+=(C) -#define thread_safe_sub(V,C,L) (V)-=(C) -#define statistic_increment(V,L) (V)++ -#define statistic_decrement(V,L) (V)-- -#define statistic_add(V,C,L) (V)+=(C) -#define statistic_sub(V,C,L) (V)-=(C) -#endif - #ifdef HAVE_CHARSET_utf8 #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" #else diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h deleted file mode 100644 index 633a5b94a6c..00000000000 --- a/include/my_no_pthread.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef MY_NO_PTHREAD_INCLUDED -#define MY_NO_PTHREAD_INCLUDED - -/* Copyright (C) 2000 MySQL AB, 2008-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 - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - - -#ifndef THREAD - -/* - This block is to access some thread-related type definitions - even in builds which do not need thread functions, - as some variables (based on these types) are declared - even in non-threaded builds. - Case in point: 'mf_keycache.c' -*/ -#if defined(__WIN__) -#else /* Normal threads */ -#include - -#endif /* defined(__WIN__) */ - - -/* - This undefs some pthread mutex locks when one isn't using threads - to make thread safe code, that should also work in single thread - environment, easier to use. -*/ -#define pthread_mutex_init(A,B) -#define pthread_mutex_lock(A) -#define pthread_mutex_unlock(A) -#define pthread_mutex_destroy(A) -#define my_rwlock_init(A,B) -#define rw_rdlock(A) -#define rw_wrlock(A) -#define rw_unlock(A) -#define rwlock_destroy(A) -#define safe_mutex_assert_owner(mp) - -#define mysql_mutex_init(A, B, C) do {} while (0) -#define mysql_mutex_lock(A) do {} while (0) -#define mysql_mutex_unlock(A) do {} while (0) -#define mysql_mutex_destroy(A) do {} while (0) - -#define mysql_rwlock_init(A, B, C) do {} while (0) -#define mysql_rwlock_rdlock(A) do {} while (0) -#define mysql_rwlock_wrlock(A) do {} while (0) -#define mysql_rwlock_unlock(A) do {} while (0) -#define mysql_rwlock_destroy(A) do {} while (0) - -typedef int my_pthread_once_t; -#define MY_PTHREAD_ONCE_INIT 0 -#define MY_PTHREAD_ONCE_DONE 1 - -#define my_pthread_once(C,F) do { \ - if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \ - } while(0) - -#endif -#endif /* MY_NO_PTHREAD_INCLUDED */ diff --git a/include/my_pthread.h b/include/my_pthread.h index c71ad9bf321..f1636cad136 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -881,12 +881,6 @@ extern uint thd_lib_detected; to use my_atomic operations instead. */ -/* - Warning: - When compiling without threads, this file is not included. - See the *other* declarations of thread_safe_xxx in include/my_global.h -*/ -#ifdef THREAD #ifndef thread_safe_increment #ifdef _WIN32 #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) @@ -910,7 +904,7 @@ extern uint thd_lib_detected; (mysql_mutex_lock((L)), (V)-=(C), mysql_mutex_unlock((L))) #endif #endif -#endif + /* statistics_xxx functions are for non critical statistic, diff --git a/include/my_sys.h b/include/my_sys.h index 6e2cbd4c0b3..484dc684b03 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -41,11 +41,7 @@ typedef struct my_aio_result { # define MEM_CHECK_DEFINED(a,len) ((void) 0) #endif /* HAVE_VALGRIND */ -#ifndef THREAD -extern int my_errno; /* Last error in mysys */ -#else #include -#endif #include /* for CHARSET_INFO */ #include @@ -314,7 +310,7 @@ struct st_my_file_info int oflag; /* open flags, e.g O_APPEND */ #endif enum file_type type; -#if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32) +#if !defined(HAVE_PREAD) && !defined(_WIN32) mysql_mutex_t mutex; #endif }; @@ -334,9 +330,7 @@ typedef struct st_my_tmpdir DYNAMIC_ARRAY full_list; char **list; uint cur, max; -#ifdef THREAD mysql_mutex_t mutex; -#endif } MY_TMPDIR; typedef struct st_dynamic_string @@ -348,7 +342,6 @@ typedef struct st_dynamic_string struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); -#ifdef THREAD typedef struct st_io_cache_share { mysql_mutex_t mutex; /* To sync on reads into buffer. */ @@ -368,7 +361,6 @@ typedef struct st_io_cache_share my_bool alloced; #endif } IO_CACHE_SHARE; -#endif typedef struct st_io_cache /* Used when cacheing files */ { @@ -409,7 +401,7 @@ typedef struct st_io_cache /* Used when cacheing files */ WRITE_CACHE, and &read_pos and &read_end respectively otherwise */ uchar **current_pos, **current_end; -#ifdef THREAD + /* The lock is for append buffer used in SEQ_READ_APPEND cache need mutex copying from append buffer to read buffer. @@ -423,7 +415,7 @@ typedef struct st_io_cache /* Used when cacheing files */ READ_CACHE mode is supported. */ IO_CACHE_SHARE *share; -#endif + /* A caller will use my_b_read() macro to read from the cache if the data is already in cache, it will be simply copied with @@ -631,6 +623,7 @@ extern const char** get_global_errmsgs(); 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 FILE *my_freopen(const char *path, const char *mode, FILE *stream); extern int my_fclose(FILE *fd,myf MyFlags); extern File my_fileno(FILE *fd); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); @@ -655,14 +648,6 @@ extern int my_redel(const char *from, const char *to, int MyFlags); extern int my_copystat(const char *from, const char *to, int MyFlags); extern char * my_filename(File fd); -#ifndef THREAD -extern void dont_break(void); -extern void allow_break(void); -#else -#define dont_break() -#define allow_break() -#endif - #ifdef EXTRA_DEBUG void my_print_open_files(void); #else @@ -735,12 +720,10 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, pbool clear_cache); extern void setup_io_cache(IO_CACHE* info); extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count); -#ifdef THREAD extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count); extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads); extern void remove_io_thread(IO_CACHE *info); -#endif extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_get(IO_CACHE *info); @@ -834,7 +817,8 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); extern int get_defaults_options(int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix); -extern const char *args_separator; +extern my_bool my_getopt_use_args_separator; +extern my_bool my_getopt_is_args_separator(const char* arg); extern int my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, const char ***); extern int load_defaults(const char *conf_file, const char **groups, diff --git a/include/myisam.h b/include/myisam.h index c4076ead403..cb641e12e8e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -433,10 +433,8 @@ typedef struct st_mi_check_param const char *db_name, *table_name; const char *op_name; enum_mi_stats_method stats_method; -#ifdef THREAD mysql_mutex_t print_msg_mutex; my_bool need_print_msg_lock; -#endif } MI_CHECK; typedef struct st_sort_ft_buf @@ -460,10 +458,8 @@ typedef struct st_sort_info SORT_FT_BUF *ft_buf; /* sync things */ uint got_error, threads_running; -#ifdef THREAD mysql_mutex_t mutex; mysql_cond_t cond; -#endif } SORT_INFO; /* functions in mi_check */ diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 8d7f5bcdee0..8c91fc0b899 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -41,7 +41,7 @@ typedef struct st_alarm_info void thr_alarm_info(ALARM_INFO *info); -#if defined(DONT_USE_THR_ALARM) || !defined(THREAD) +#if defined(DONT_USE_THR_ALARM) #define USE_ALARM_THREAD #undef USE_ONE_SIGNAL_HAND diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index 5204d03e5af..c5a08ce1fcc 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -35,21 +35,6 @@ sig_handler my_pipe_sig_handler(int sig); void read_user_name(char *name); my_bool handle_local_infile(MYSQL *mysql, const char *net_filename); -/* - Let the user specify that we don't want SIGPIPE; This doesn't however work - with threaded applications as we can have multiple read in progress. -*/ - -#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD) -#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0; -#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE, my_pipe_sig_handler) -#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler); -#else -#define init_sigpipe_variables -#define set_sigpipe(mysql) -#define reset_sigpipe(mysql) -#endif - void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group); void mysql_detach_stmt_list(LIST **stmt_list, const char *func_name); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index c498ed0f089..f802387cf9a 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -51,7 +51,7 @@ #ifdef HAVE_SYS_UN_H #include #endif -#if defined(THREAD) && !defined(__WIN__) +#if !defined(__WIN__) #include /* because of signal() */ #endif #ifndef INADDR_NONE @@ -172,10 +172,8 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), result= init_embedded_server(argc, argv, groups); #endif } -#ifdef THREAD else result= (int)my_thread_init(); /* Init if new thread */ -#endif return result; } @@ -229,18 +227,12 @@ MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void) my_bool STDCALL mysql_thread_init() { -#ifdef THREAD return my_thread_init(); -#else - return 0; -#endif } void STDCALL mysql_thread_end() { -#ifdef THREAD my_thread_end(); -#endif } @@ -1092,11 +1084,7 @@ void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *csinfo) uint STDCALL mysql_thread_safe(void) { -#ifdef THREAD return 1; -#else - return 0; -#endif } diff --git a/mysql-test/collections/README.experimental b/mysql-test/collections/README.experimental index 2f5ee7b00ab..924e062b76a 100644 --- a/mysql-test/collections/README.experimental +++ b/mysql-test/collections/README.experimental @@ -15,9 +15,13 @@ The syntax is as follows: and any subsequent characters are ignored. 4) The full test case name including the suite and execution mode - must be specified, for example: + may be specified, for example: main.alias 'row' # bug#00000 +4b) Now, combinations will also be covered if only the test name is + specified, for example: + rpl.rpl_ps # Covers 'row', 'mix' and 'stmt' + 5) As an exception to item 4, the last character of the test case specification may be an asterisk (*). In that case, all test cases that start with the same characters up to the last letter before the asterisk diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index b723b59eeff..7ffc88745ea 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -10,12 +10,8 @@ innodb.innodb_information_schema # Bug#48883 2010-05-11 alik Test "innod main.func_math @freebsd # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2 main.gis # Bug#52208 2010-11-24 alik gis fails on some platforms (Solaris, HP-UX, Linux) main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server -main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically -main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10 -main.lowercase_table2 @darwin # Bug#55509 2010-07-26 alik main.lowercase_table2 fails on Mac OSX (again) main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible) -main.show_check # Bug#58414 2010-11-24 alik Race condition in show_check.test main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server @@ -23,7 +19,7 @@ main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeou rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically -rpl.rpl_innodb_bug28430* # Bug#46029 +rpl.rpl_innodb_bug28430 # Bug#46029 sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun sys_vars.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure diff --git a/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc new file mode 100644 index 00000000000..4530f8c639a --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc @@ -0,0 +1,17 @@ +# Include file for rpl_show_relaylog_events.inc + +--let $log_type= BINLOG +if ($is_relay_log) { + --let $log_type= RELAYLOG +} +--let $args= +if ($binlog_file != '') { + --let $args= IN +} +if ($binlog_limit) { + --let $args= $args LIMIT $binlog_limit +} +--echo ******** [$CURRENT_CONNECTION] SHOW $log_type EVENTS $args ******** +--source include/show_events.inc + + diff --git a/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc new file mode 100644 index 00000000000..411f388aaf3 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc @@ -0,0 +1,11 @@ +# Include file for rpl_show_log_events.inc + +--let $binlog_limit= +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= 1 +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= 1,3 +--source extra/rpl_tests/rpl_show_binlog_events.inc +--let $binlog_limit= +--let $binlog_file= +--source extra/rpl_tests/rpl_show_binlog_events.inc diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc index d32dd485e19..a56e08ece42 100644 --- a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc +++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -1,103 +1,62 @@ +-- connection master +-- source include/rpl_reset.inc + -- connection master CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); -INSERT INTO t1 VALUES (4); -INSERT INTO t1 VALUES (5); -INSERT INTO t1 VALUES (6); --- echo [MASTER] ********* SOW BINLOG EVENTS IN ... ********* --- source include/show_binlog_events.inc +# PART I +# +# SHOWs contents of binary logs on the master and both, binary and +# relay logs, on the slave. +# --- echo [MASTER] ********* SOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc +--let $is_relay_log= 0 +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* -let $binlog_limit= 3; --- source include/show_binlog_events.inc +--sync_slave_with_master +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* -let $binlog_limit= 1,4; --- source include/show_binlog_events.inc +--let $is_relay_log= 1 +--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc -# clear show_binlog_event/show_relaylog_events parameters -let $binlog_limit= ; - --- sync_slave_with_master - --- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... ********* --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* -let $binlog_limit= 3; --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* -let $binlog_limit= 1,4; --- source include/show_binlog_events.inc - -# clear show_binlog_event/show_relaylog_events parameters -let $binlog_limit= ; - --- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); --- source include/show_relaylog_events.inc - --- echo [SLAVE] ********* SOW RELAYLOG EVENTS ********* -let $binlog_file= ; --- source include/show_relaylog_events.inc - --- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); -let $binlog_limit= 3; --- source include/show_relaylog_events.inc - --- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* -let $binlog_limit= 1,3; --- source include/show_relaylog_events.inc +# +# PART II +# +# Although this second part of the test may seem redudant it is +# actually needed to assert that SHOW RELAYLOG EVENTS works properly +# with respect to the ordering of the relay log in relay-log.index. +# +# If no file is specified with "IN" then first relay log file in +# relay-log.index (ie, the oldest one) should be picked and its +# contents displayed. The same happens for SHOW BINLOG EVENTS, so we +# show them both. All in all, this is the reason for re-assert after +# MASTER and SLAVE's FLUSH LOGS operations. +# FLUSH LOGS; -let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); - -- connection master FLUSH LOGS; DROP TABLE t1; -# clear show_binlog_event/show_relaylog_events parameters -let $binlog_file= ; -let $binlog_limit= ; +--let $is_relay_log= 0 +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SOW BINLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); --- source include/show_binlog_events.inc +--sync_slave_with_master +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- echo [MASTER] ********* SOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc +--let $is_relay_log= 1 +--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) +--source extra/rpl_tests/rpl_show_log_events_with_varying_options.inc --- sync_slave_with_master - --- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... ********* -let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SOW BINLOG EVENTS ********* -let $binlog_file= ; --- source include/show_binlog_events.inc - --- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* --- source include/show_relaylog_events.inc - --- echo [SLAVE] ********* SOW RELAYLOG EVENTS ********* -let $binlog_file= ; --- source include/show_relaylog_events.inc # clear show_binlog_event/show_relaylog_events parameters let $binlog_file= ; diff --git a/mysql-test/include/plugin.defs b/mysql-test/include/plugin.defs new file mode 100644 index 00000000000..4da03dc2cc9 --- /dev/null +++ b/mysql-test/include/plugin.defs @@ -0,0 +1,41 @@ +# Definition file for plugins. +# +# [,...] +# +# The following variables will be set for a plugin, where PLUGVAR +# represents the variable name given as the 3rd item +# +# PLUGVAR: name of plugin file including extension .so or .dll +# PLUGVAR_DIR: name of directory where plugin was found +# PLUGVAR_OPT: mysqld option --plugin_dir=.... +# PLUGVAR_LOAD: option --plugin_load=.... if the 4th element is present +# +# If a listed plugin is not found, the corresponding variables will be +# set to empty, they will not be unset. +# +# The PLUGVAR variable is not quoted, so you must remember to quote it +# when using it in an INSTALL PLUGIN command. +# +# The envorinment variables can be used in tests. If adding a new plugin, +# you are free to pick your variable name, but please keep it upper +# case for consistency. +# +# The _LOAD variable will have a form +# +# --plugin_load==;=..... +# +# with name1, name2 etc from the comma separated list of plugin names +# in the optional 4th argument. + +auth_test_plugin plugin/auth PLUGIN_AUTH test_plugin_server +qa_auth_interface plugin/auth PLUGIN_AUTH_INTERFACE qa_auth_interface +qa_auth_server plugin/auth PLUGIN_AUTH_SERVER qa_auth_server +qa_auth_client plugin/auth PLUGIN_AUTH_CLIENT qa_auth_client +udf_example sql UDF_EXAMPLE_LIB +ha_example storage/example EXAMPLE_PLUGIN EXAMPLE +semisync_master plugin/semisync SEMISYNC_MASTER_PLUGIN +semisync_slave plugin/semisync SEMISYNC_SLAVE_PLUGIN +ha_archive storage/archive ARCHIVE_PLUGIN +ha_blackhole storage/blackhole BLACKHOLE_PLUGIN +ha_federated storage/federated FEDERATED_PLUGIN +mypluglib plugin/fulltext SIMPLE_PARSER diff --git a/mysql-test/include/restart_slave_sql.inc b/mysql-test/include/restart_slave_sql.inc new file mode 100644 index 00000000000..ee6c6d7ced6 --- /dev/null +++ b/mysql-test/include/restart_slave_sql.inc @@ -0,0 +1,43 @@ +# ==== Purpose ==== +# +# Provide a earier way to restart SQL thread when you want to stop sql thread +# and then start it immediately. +# +# Sources stop_slave_sql.inc to stop SQL thread on the current connection. +# Then issues START SLAVE SQL_THREAD and then waits until +# the SQL threads have started, or until a timeout is reached. +# +# Please use this instead of 'STOP|START SLAVE SQL_THREAD', to reduce the risk of +# test case bugs. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/restart_slave_sql.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= restart_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + +source include/stop_slave_sql.inc; +START SLAVE SQL_THREAD; +source include/wait_for_slave_sql_to_start.inc; + + +--let $include_filename= restart_slave.inc +--source include/end_include_file.inc \ No newline at end of file diff --git a/mysql-test/include/rpl_connection_master.inc b/mysql-test/include/rpl_connection_master.inc new file mode 100644 index 00000000000..e54e34071c8 --- /dev/null +++ b/mysql-test/include/rpl_connection_master.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= master; +source include/rpl_connection.inc; \ No newline at end of file diff --git a/mysql-test/include/rpl_connection_slave.inc b/mysql-test/include/rpl_connection_slave.inc new file mode 100644 index 00000000000..ef3876394d6 --- /dev/null +++ b/mysql-test/include/rpl_connection_slave.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= slave; +source include/rpl_connection.inc; \ No newline at end of file diff --git a/mysql-test/include/rpl_connection_slave1.inc b/mysql-test/include/rpl_connection_slave1.inc new file mode 100644 index 00000000000..8aee6defbdd --- /dev/null +++ b/mysql-test/include/rpl_connection_slave1.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= slave1; +source include/rpl_connection.inc; \ No newline at end of file diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index da3ce8e6038..4f1d4f6f162 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -74,6 +74,7 @@ let $_fake_relay_index= $_fake_datadir/$_fake_filename.index; let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; RESET SLAVE; +let $_orphan_relay_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); # Create relay log file. --copy_file $fake_relay_log $_fake_relay_log @@ -102,6 +103,8 @@ RESET SLAVE; # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; +# remove the orphan log file (became spurious) +-- remove_file $_fake_datadir/$_orphan_relay_file --let $include_filename= setup_fake_relay_log.inc --source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc index 9f4962aeaed..5c68254f00e 100644 --- a/mysql-test/include/wait_for_status_var.inc +++ b/mysql-test/include/wait_for_status_var.inc @@ -50,8 +50,23 @@ if (!$_status_var_comparsion) let $_status_var_comparsion= =; } +# Get type of variable +let $_is_number= 0; +if (`SELECT '$status_var_value' REGEXP '^[\+\-]*[0-9]+(\.[0-9]+)*\$'`) +{ + let $_is_number= 1; +} + let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1); -while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value')`) + +# Set way of comparing +let $_query= SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value'); +if ($is_number) +{ + let $_query= SELECT NOT($_show_status_value $_status_var_comparsion $status_var_value); +} + +while (`$_query`) { if (!$_status_timeout_counter) { @@ -65,4 +80,9 @@ while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_va dec $_status_timeout_counter; sleep 0.1; let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1); + let $_query= SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value'); + if ($is_number) + { + let $_query= SELECT NOT($_show_status_value $_status_var_comparsion $status_var_value); + } } diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 19c3ee4d5d8..6ba23754890 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -1,4 +1,20 @@ # -*- cperl -*- +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + package My::ConfigFactory; use strict; diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm index 3ac9e385070..c0f6535b96e 100644 --- a/mysql-test/lib/My/CoreDump.pm +++ b/mysql-test/lib/My/CoreDump.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 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 diff --git a/mysql-test/lib/My/File/Path.pm b/mysql-test/lib/My/File/Path.pm index 25a26568eee..d1ac2b432ac 100644 --- a/mysql-test/lib/My/File/Path.pm +++ b/mysql-test/lib/My/File/Path.pm @@ -1,4 +1,19 @@ # -*- cperl -*- +# Copyright (C) 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + package My::File::Path; use strict; diff --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm index b2fec0d77b8..a44c9a7508c 100644 --- a/mysql-test/lib/My/Find.pm +++ b/mysql-test/lib/My/Find.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 2008 MySQL AB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm index 3bfbe1fc90e..dcd934084e2 100644 --- a/mysql-test/lib/My/Options.pm +++ b/mysql-test/lib/My/Options.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 2008 MySQL AB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 371120ab644..cbe8f929d71 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 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 diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index 461897b56f0..f87b7b60bd6 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -1,14 +1,15 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software diff --git a/mysql-test/lib/My/SafeProcess/Base.pm b/mysql-test/lib/My/SafeProcess/Base.pm index 9a6871264b8..c0c70e48082 100644 --- a/mysql-test/lib/My/SafeProcess/Base.pm +++ b/mysql-test/lib/My/SafeProcess/Base.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 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 diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc index f72b851d0b6..72fe874e621 100644 --- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (C) 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 diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc index 1c778362975..477beca0ada 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008 MySQL AB +/* Copyright (C) 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 diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index 8fffede0b62..50e16ff25d4 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (C) 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 diff --git a/mysql-test/lib/My/SysInfo.pm b/mysql-test/lib/My/SysInfo.pm index f1ba5fb610f..b8569e415e8 100644 --- a/mysql-test/lib/My/SysInfo.pm +++ b/mysql-test/lib/My/SysInfo.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 2008 MySQL AB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-test/lib/My/Test.pm b/mysql-test/lib/My/Test.pm index 68b100f91af..c756a677052 100644 --- a/mysql-test/lib/My/Test.pm +++ b/mysql-test/lib/My/Test.pm @@ -1,4 +1,18 @@ # -*- cperl -*- +# Copyright (C) 2008 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index f1f1ac35dcd..c3dd43c12ca 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -229,8 +229,11 @@ sub collect_test_cases ($$$$) { sub split_testname { my ($test_name)= @_; - # Get rid of directory part and split name on .'s - my @parts= split(/\./, basename($test_name)); + # If .test file name is used, get rid of directory part + $test_name= basename($test_name) if $test_name =~ /\.test$/; + + # Now split name on .'s + my @parts= split(/\./, $test_name); if (@parts == 1){ # Only testname given, ex: alias diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl index f531889b08d..d8fb1c0a07d 100644 --- a/mysql-test/lib/mtr_gcov.pl +++ b/mysql-test/lib/mtr_gcov.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004, 2006 MySQL AB +# Copyright (C) 2004, 2006 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 diff --git a/mysql-test/lib/mtr_gprof.pl b/mysql-test/lib/mtr_gprof.pl index 5820a4007b8..a5e05b28723 100644 --- a/mysql-test/lib/mtr_gprof.pl +++ b/mysql-test/lib/mtr_gprof.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004 MySQL AB +# Copyright (C) 2004 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 diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl index 21581798ddc..6a6b3a3d028 100644 --- a/mysql-test/lib/mtr_io.pl +++ b/mysql-test/lib/mtr_io.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 2004-2007 MySQL AB, 2008 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 diff --git a/mysql-test/lib/mtr_match.pm b/mysql-test/lib/mtr_match.pm index 40afd4e0336..6fc9832ac43 100644 --- a/mysql-test/lib/mtr_match.pm +++ b/mysql-test/lib/mtr_match.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB +# Copyright (C) 2004-2008 MySQL AB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index dc9928d37c5..678d3829226 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -1,15 +1,16 @@ # -*- cperl -*- -# Copyright (C) 2004-2006 MySQL AB -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# +# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index af75178473d..f86be0d4c68 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -129,7 +129,8 @@ sub mtr_report_test ($) { # Find out if this test case is an experimental one, so we can treat # the failure as an expected failure instead of a regression. for my $exp ( @$::experimental_test_cases ) { - if ( $exp ne $test_name ) { + # Include pattern match for combinations + if ( $exp ne $test_name && $test_name !~ /^$exp / ) { # if the expression is not the name of this test case, but has # an asterisk at the end, determine if the characters up to # but excluding the asterisk are the same @@ -395,7 +396,7 @@ sub mtr_report_stats ($$;$) { ############################################################################## sub mtr_print_line () { - print '-' x 60 . "\n"; + print '-' x 74 . "\n"; } @@ -405,13 +406,18 @@ sub mtr_print_thick_line { } -sub mtr_print_header () { +sub mtr_print_header ($) { + my ($wid) = @_; print "\n"; printf "TEST"; - print " " x 38; + if ($wid) { + print " " x 34 . "WORKER "; + } else { + print " " x 38; + } print "RESULT "; - print "TIME (ms)" if $timer; - print "\n"; + print "TIME (ms) or " if $timer; + print "COMMENT\n"; mtr_print_line(); print "\n"; } diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl index 702bc178ae5..ab4214791d0 100644 --- a/mysql-test/lib/mtr_stress.pl +++ b/mysql-test/lib/mtr_stress.pl @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2006 MySQL AB +# Copyright (C) 2004-2007 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 diff --git a/mysql-test/lib/mtr_unique.pm b/mysql-test/lib/mtr_unique.pm index 6b60157422d..506af448266 100644 --- a/mysql-test/lib/mtr_unique.pm +++ b/mysql-test/lib/mtr_unique.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (C) 2006 MySQL AB +# Copyright (C) 2006-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 diff --git a/mysql-test/mysql-stress-test.pl b/mysql-test/mysql-stress-test.pl index bca7731d8a7..f2471d169d1 100755 --- a/mysql-test/mysql-stress-test.pl +++ b/mysql-test/mysql-stress-test.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright (C) 2005, 2006 MySQL AB +# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -12,10 +12,9 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # -# You should have received a copy of the GNU Library General Public -# License along with this library; if not, write to the Free -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ====================================================================== # MySQL server stress test system diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a7683b8d807..1eac4cc0527 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- cperl -*- -# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ############################################################################## @@ -131,10 +131,6 @@ my $opt_start_dirty; my $opt_start_exit; my $start_only; -my $auth_interface_fn; # the name of qa_auth_interface plugin -my $auth_server_fn; # the name of qa_auth_server plugin -my $auth_client_fn; # the name of qa_auth_client plugin -my $auth_filename; # the name of the authentication test plugin my $auth_plugin; # the path to the authentication test plugin END { @@ -295,8 +291,10 @@ our $opt_include_ndbcluster= 0; our $opt_skip_ndbcluster= 1; my $exe_ndbd; +my $exe_ndbmtd; my $exe_ndb_mgmd; my $exe_ndb_waiter; +my $exe_ndb_mgm; our $debug_compiled_binaries; @@ -442,7 +440,7 @@ sub main { mtr_report(); mtr_print_thick_line(); - mtr_print_header(); + mtr_print_header($opt_parallel > 1); mark_time_used('init'); @@ -509,8 +507,8 @@ sub run_test_server ($$$) { my $num_failed_test= 0; # Number of tests failed so far # Scheduler variables - my $max_ndb= $childs / 2; - $max_ndb = 4 if $max_ndb > 4; + my $max_ndb= $ENV{MTR_MAX_NDB} || $childs / 2; + $max_ndb = $childs if $max_ndb > $childs; $max_ndb = 1 if $max_ndb < 1; my $num_ndb_tests= 0; @@ -1124,27 +1122,7 @@ sub command_line_setup { "$basedir/sql/share/charsets", "$basedir/share/charsets"); - # Look for auth test plugins - if (IS_WINDOWS) - { - $auth_filename = "auth_test_plugin.dll"; - $auth_interface_fn = "qa_auth_interface.dll"; - $auth_server_fn = "qa_auth_server.dll"; - $auth_client_fn = "qa_auth_client.dll"; - } - else - { - $auth_filename = "auth_test_plugin.so"; - $auth_interface_fn = "qa_auth_interface.so"; - $auth_server_fn = "qa_auth_server.so"; - $auth_client_fn = "qa_auth_client.so"; - } - $auth_plugin= - mtr_file_exists(vs_config_dirs('plugin/auth/',$auth_filename), - "$basedir/plugin/auth/.libs/" . $auth_filename, - "$basedir/lib/mysql/plugin/" . $auth_filename, - "$basedir/lib/plugin/" . $auth_filename); - + ($auth_plugin)= find_plugin("auth_test_plugin", "plugin/auth"); if (using_extern()) { @@ -1831,16 +1809,42 @@ sub executable_setup () { if ( ! $opt_skip_ndbcluster ) { + # Look for single threaded NDB $exe_ndbd= my_find_bin($bindir, ["storage/ndb/src/kernel", "libexec", "sbin", "bin"], "ndbd"); + # Look for multi threaded NDB + $exe_ndbmtd= + my_find_bin($bindir, + ["storage/ndb/src/kernel", "libexec", "sbin", "bin"], + "ndbmtd", NOT_REQUIRED); + if ($exe_ndbmtd) + { + my $mtr_ndbmtd = $ENV{MTR_NDBMTD}; + if ($mtr_ndbmtd) + { + mtr_report(" - multi threaded ndbd found, will be used always"); + $exe_ndbd = $exe_ndbmtd; + } + else + { + mtr_report(" - multi threaded ndbd found, will be ". + "used \"round robin\""); + } + } + $exe_ndb_mgmd= my_find_bin($bindir, ["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"], "ndb_mgmd"); + $exe_ndb_mgm= + my_find_bin($bindir, + ["storage/ndb/src/mgmclient", "bin"], + "ndb_mgm"); + $exe_ndb_waiter= my_find_bin($bindir, ["storage/ndb/tools/", "bin"], @@ -1983,6 +1987,53 @@ sub find_plugin($$) return $lib_example_plugin; } +# +# Read plugin defintions file +# + +sub read_plugin_defs($) +{ + my ($defs_file)= @_; + + open(PLUGDEF, '<', $defs_file) + or mtr_error("Can't read plugin defintions file $defs_file"); + + while () { + next if /^#/; + my ($plug_file, $plug_loc, $plug_var, $plug_names)= split; + # Allow empty lines + next unless $plug_file; + mtr_error("Lines in $defs_file must have 3 or 4 items") unless $plug_var; + + my ($plugin)= find_plugin($plug_file, $plug_loc); + + # Set env. variables that tests may use, set to empty if plugin + # listed in def. file but not found. + + if ($plugin) { + $ENV{$plug_var}= basename($plugin); + $ENV{$plug_var.'_DIR'}= dirname($plugin); + $ENV{$plug_var.'_OPT'}= "--plugin-dir=".dirname($plugin); + if ($plug_names) { + my $lib_name= basename($plugin); + my $load_var= "--plugin_load="; + my $semi= ''; + foreach my $plug_name (split (',', $plug_names)) { + $load_var .= $semi . "$plug_name=$lib_name"; + $semi= ';'; + } + $ENV{$plug_var.'_LOAD'}= $load_var; + } + } else { + $ENV{$plug_var}= ""; + $ENV{$plug_var.'_DIR'}= ""; + $ENV{$plug_var.'_OPT'}= ""; + $ENV{$plug_var.'_LOAD'}= "" if $plug_names; + } + } + close PLUGDEF; +} + sub environment_setup { umask(022); @@ -2019,127 +2070,16 @@ sub environment_setup { } # -------------------------------------------------------------------------- - # Add the path where mysqld will find udf_example.so + # Read definitions from include/plugin.defs + # + # Plugin settings should no longer be added here, instead + # place definitions in include/plugin.defs. + # See comment in that file for details. # -------------------------------------------------------------------------- - my $udf_example_filename; - if (IS_WINDOWS) - { - $udf_example_filename = "udf_example.dll"; - } - else - { - $udf_example_filename = "udf_example.so"; - } - my $lib_udf_example= - mtr_file_exists(vs_config_dirs('sql', $udf_example_filename), - "$basedir/sql/.libs/$udf_example_filename",); + read_plugin_defs("include/plugin.defs"); - if ( $lib_udf_example ) - { - push(@ld_library_paths, dirname($lib_udf_example)); - } - - $ENV{'UDF_EXAMPLE_LIB'}= - ($lib_udf_example ? basename($lib_udf_example) : ""); - $ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=". - ($lib_udf_example ? dirname($lib_udf_example) : ""); - - # -------------------------------------------------------------------------- - # Add the path where mysqld will find the auth test plugin (dialog.so/dll) - # -------------------------------------------------------------------------- - if ($auth_plugin) - { - $ENV{'PLUGIN_AUTH'}= basename($auth_plugin); - $ENV{'PLUGIN_AUTH_OPT'}= "--plugin-dir=".dirname($auth_plugin); - - $ENV{'PLUGIN_AUTH_LOAD'}="--plugin_load=test_plugin_server=".$auth_filename; - $ENV{'PLUGIN_AUTH_INTERFACE'}="--plugin_load=qa_auth_interface=".$auth_interface_fn; - $ENV{'PLUGIN_AUTH_SERVER'}="--plugin_load=qa_auth_server=".$auth_server_fn; - $ENV{'PLUGIN_AUTH_CLIENT'}="--plugin_load=qa_auth_client=".$auth_client_fn; - } - else - { - $ENV{'PLUGIN_AUTH'}= ""; - $ENV{'PLUGIN_AUTH_OPT'}="--plugin-dir="; - $ENV{'PLUGIN_AUTH_LOAD'}=""; - $ENV{'PLUGIN_AUTH_INTERFACE'}=""; - $ENV{'PLUGIN_AUTH_SERVER'}=""; - $ENV{'PLUGIN_AUTH_CLIENT'}=""; - } - - - # -------------------------------------------------------------------------- - # Add the path where mysqld will find ha_example.so - # -------------------------------------------------------------------------- - if ($mysql_version_id >= 50100) { - my ($lib_example_plugin) = find_plugin("ha_example", "storage/example"); - - if($lib_example_plugin) - { - $ENV{'EXAMPLE_PLUGIN'}= - ($lib_example_plugin ? basename($lib_example_plugin) : ""); - $ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=". - ($lib_example_plugin ? dirname($lib_example_plugin) : ""); - - $ENV{'HA_EXAMPLE_SO'}="'".basename($lib_example_plugin)."'"; - $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".basename($lib_example_plugin); - } - else - { - # Some ".opt" files use some of these variables, so they must be defined - $ENV{'EXAMPLE_PLUGIN'}= ""; - $ENV{'EXAMPLE_PLUGIN_OPT'}= ""; - $ENV{'HA_EXAMPLE_SO'}= ""; - $ENV{'EXAMPLE_PLUGIN_LOAD'}= ""; - } - } - - - # -------------------------------------------------------------------------- - # Add the path where mysqld will find semisync plugins - # -------------------------------------------------------------------------- - if (!$opt_embedded_server) { - - - my ($lib_semisync_master_plugin) = find_plugin("semisync_master", "plugin/semisync"); - my ($lib_semisync_slave_plugin) = find_plugin("semisync_slave", "plugin/semisync"); - - - if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin) - { - $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin); - $ENV{'SEMISYNC_SLAVE_PLUGIN'}= basename($lib_semisync_slave_plugin); - $ENV{'SEMISYNC_PLUGIN_OPT'}= "--plugin-dir=".dirname($lib_semisync_master_plugin); - } - else - { - $ENV{'SEMISYNC_MASTER_PLUGIN'}= ""; - $ENV{'SEMISYNC_SLAVE_PLUGIN'}= ""; - $ENV{'SEMISYNC_PLUGIN_OPT'}="--plugin-dir="; - } - } - - # ---------------------------------------------------- - # Add the paths where mysqld will find archive/blackhole/federated plugins. - # ---------------------------------------------------- - $ENV{'ARCHIVE_PLUGIN_DIR'} = - dirname(find_plugin("ha_archive", "storage/archive")); - $ENV{'BLACKHOLE_PLUGIN_DIR'} = - dirname(find_plugin("ha_blackhole", "storage/blackhole")); - $ENV{'FEDERATED_PLUGIN_DIR'} = - dirname(find_plugin("ha_federated", "storage/federated")); - - # ---------------------------------------------------- - # Add the path where mysqld will find mypluglib.so - # ---------------------------------------------------- - - my ($lib_simple_parser) = find_plugin("mypluglib", "plugin/fulltext"); - - $ENV{'MYPLUGLIB_SO'}="'".basename($lib_simple_parser)."'"; - $ENV{'SIMPLE_PARSER'}= - ($lib_simple_parser ? basename($lib_simple_parser) : ""); - $ENV{'SIMPLE_PARSER_OPT'}= "--plugin-dir=". - ($lib_simple_parser ? dirname($lib_simple_parser) : ""); + # Simplify reference to semisync plugins + $ENV{'SEMISYNC_PLUGIN_OPT'}= $ENV{'SEMISYNC_MASTER_PLUGIN_OPT'}; # -------------------------------------------------------------------------- # Valgrind need to be run with debug libraries otherwise it's almost @@ -2710,6 +2650,27 @@ sub ndb_mgmd_wait_started($) { return 1; } +sub ndb_mgmd_stop{ + my $ndb_mgmd= shift or die "usage: ndb_mgmd_stop()"; + + my $host=$ndb_mgmd->value('HostName'); + my $port=$ndb_mgmd->value('PortNumber'); + mtr_verbose("Stopping cluster '$host:$port'"); + + my $args; + mtr_init_args(\$args); + mtr_add_arg($args, "--ndb-connectstring=%s:%s", $host,$port); + mtr_add_arg($args, "-e"); + mtr_add_arg($args, "shutdown"); + + My::SafeProcess->run + ( + name => "ndb_mgm shutdown $host:$port", + path => $exe_ndb_mgm, + args => \$args, + output => "/dev/null", + ); +} sub ndb_mgmd_start ($$) { my ($cluster, $ndb_mgmd)= @_; @@ -2737,6 +2698,7 @@ sub ndb_mgmd_start ($$) { error => $path_ndb_mgmd_log, append => 1, verbose => $opt_verbose, + shutdown => sub { ndb_mgmd_stop($ndb_mgmd) }, ); mtr_verbose("Started $ndb_mgmd->{proc}"); @@ -2752,6 +2714,12 @@ sub ndb_mgmd_start ($$) { return 0; } +sub ndbd_stop { + # Intentionally left empty, ndbd nodes will be shutdown + # by sending "shutdown" to ndb_mgmd +} + +my $exe_ndbmtd_counter= 0; sub ndbd_start { my ($cluster, $ndbd)= @_; @@ -2769,17 +2737,24 @@ sub ndbd_start { # > 5.0 { 'character-sets-dir' => \&fix_charset_dir }, + my $exe= $exe_ndbd; + if ($exe_ndbmtd and ($exe_ndbmtd_counter++ % 2) == 0) + { + # Use ndbmtd every other time + $exe= $exe_ndbmtd; + } my $path_ndbd_log= "$dir/ndbd.log"; my $proc= My::SafeProcess->new ( name => $ndbd->after('cluster_config.'), - path => $exe_ndbd, + path => $exe, args => \$args, output => $path_ndbd_log, error => $path_ndbd_log, append => 1, verbose => $opt_verbose, + shutdown => sub { ndbd_stop($ndbd) }, ); mtr_verbose("Started $proc"); diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result index aa4bdb2bd61..7f74a092af7 100644 --- a/mysql-test/r/client_xml.result +++ b/mysql-test/r/client_xml.result @@ -21,9 +21,9 @@ insert into t1 values (1, 2, 'a&b ab'); - - - + + + diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 0b061f507a7..4ea5efab159 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1684,6 +1684,21 @@ ARMENIAN CAPIT ECH 2 ARMENIAN CAPIT ZA 2 DROP TABLE t1; # +# Start of 5.1 tests +# +# +# Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function +# +SET NAMES latin1; +DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) +AS BINARY(0)) USING utf8); +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'Zpq' +Warning 1292 Truncated incorrect BINARY(0) value: '1.' +# +# End of 5.1 tests +# +# # Start of 5.5 tests # # diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 552ff564a89..39590eb1c99 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -182,4 +182,9 @@ INSERT INTO t2 VALUES (1), (2), (3); SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a; 1 DROP TABLE t1, t2; +# +# Bug#59149 valgrind warnings with "like .. escape .." function +# +SELECT '' LIKE '1' ESCAPE COUNT(1); +ERROR HY000: Incorrect arguments to ESCAPE End of 5.1 tests diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 31648aae7b0..3149a2a3344 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -641,3 +641,18 @@ INSERT INTO t1 (SELECT -pi()); Warnings: Warning 1265 Data truncated for column 'a' at row 1 DROP TABLE t1; +# +# Bug #59241 invalid memory read +# in do_div_mod with doubly assigned variables +# +SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))); +((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))) +NULL +Warnings: +Warning 1366 Incorrect decimal value: '' for column '' at row -1 +# +# Bug #59498 div function broken in mysql-trunk +# +SELECT 1 div null; +1 div null +NULL diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 41fe9c096b0..81fe2413725 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -2615,6 +2615,22 @@ CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)) 1 Warnings: Warning 1292 Truncated incorrect DECIMAL value: '' +# +# Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail +# and other crashes +# +CREATE TABLE t1 ( a TEXT ); +SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'bug58165.txt'; +SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); +insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ) +x +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'b' +LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1; +SELECT * FROM t1; +a +aaaaaaaaaaaaaa +DROP TABLE t1; End of 5.1 tests Start of 5.4 tests SELECT format(12345678901234567890.123, 3); diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 5663f167d00..7939d01beff 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1014,6 +1014,14 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; SET @a=POLYFROMWKB(@a); +create table t1(a polygon NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +p +NULL +NULL +drop table t1; End of 5.1 tests CREATE TABLE t1( col0 BINARY NOT NULL, diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result index 43a98829d4e..d0ba7b0f2e9 100644 --- a/mysql-test/r/innodb_mysql_sync.result +++ b/mysql-test/r/innodb_mysql_sync.result @@ -66,3 +66,27 @@ SELECT ((@id := id) - id) FROM t2; KILL @id; SET DEBUG_SYNC= "now SIGNAL killed"; DROP TABLE t1, t2; +SET DEBUG_SYNC= "RESET"; +# +# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing +# OPTIMIZE TABLE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1), (2); +# Connection con1 +SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed'; +# Sending: +OPTIMIZE TABLE t1; +# Connection default +SET DEBUG_SYNC= 'now WAIT_FOR waiting'; +KILL QUERY ID; +SET DEBUG_SYNC= 'now SIGNAL killed'; +# Connection con1 +# Reaping: OPTIMIZE TABLE t1 +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize status Operation failed +# Connection default +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 99ca9f05535..ecd53003513 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1432,4 +1432,74 @@ WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL GROUP BY t2.f1, t2.f2; f1 f1 f2 DROP TABLE t1,t2; +# +# Bug#57034 incorrect OUTER JOIN result when joined on unique key +# +CREATE TABLE t1 (pk INT PRIMARY KEY, +col_int INT, +col_int_unique INT UNIQUE KEY); +INSERT INTO t1 VALUES (1,NULL,2), (2,0,0); +CREATE TABLE t2 (pk INT PRIMARY KEY, +col_int INT, +col_int_unique INT UNIQUE KEY); +INSERT INTO t2 VALUES (1,0,1), (2,0,2); +EXPLAIN +SELECT * FROM t1 LEFT JOIN t2 +ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int +WHERE t1.pk=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 +1 SIMPLE t2 const col_int_unique col_int_unique 5 const 1 +SELECT * FROM t1 LEFT JOIN t2 +ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int +WHERE t1.pk=1; +pk col_int col_int_unique pk col_int col_int_unique +1 NULL 2 NULL NULL NULL +DROP TABLE t1,t2; +# +# Bug#48046 Server incorrectly processing JOINs on NULL values +# +CREATE TABLE `BB` ( +`pk` int(11) NOT NULL AUTO_INCREMENT, +`time_key` time DEFAULT NULL, +`varchar_key` varchar(1) DEFAULT NULL, +`varchar_nokey` varchar(1) DEFAULT NULL, +PRIMARY KEY (`pk`), +KEY `time_key` (`time_key`), +KEY `varchar_key` (`varchar_key`) +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; +INSERT INTO `BB` VALUES (10,'18:27:58',NULL,NULL); +SELECT table1.time_key AS field1, table2.pk +FROM BB table1 LEFT JOIN BB table2 +ON table2.varchar_nokey = table1.varchar_key +HAVING field1; +field1 pk +18:27:58 NULL +DROP TABLE BB; +# +# Bug#49600 Server incorrectly processing RIGHT JOIN with +# constant WHERE clause and no index +# +CREATE TABLE `BB` ( +`col_datetime_key` datetime DEFAULT NULL, +`col_varchar_key` varchar(1) DEFAULT NULL, +`col_varchar_nokey` varchar(1) DEFAULT NULL, +KEY `col_datetime_key` (`col_datetime_key`), +KEY `col_varchar_key` (`col_varchar_key`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `BB` VALUES ('1900-01-01 00:00:00',NULL,NULL); +SELECT table1.col_datetime_key +FROM BB table1 RIGHT JOIN BB table2 +ON table2 .col_varchar_nokey = table1.col_varchar_key +WHERE 7; +col_datetime_key +NULL +ALTER TABLE BB DISABLE KEYS; +SELECT table1.col_datetime_key +FROM BB table1 RIGHT JOIN BB table2 +ON table2 .col_varchar_nokey = table1.col_varchar_key +WHERE 7; +col_datetime_key +NULL +DROP TABLE BB; End of 5.1 tests diff --git a/mysql-test/r/mysqladmin.result b/mysql-test/r/mysqladmin.result index 57927f8aa67..748152bffcc 100644 --- a/mysql-test/r/mysqladmin.result +++ b/mysql-test/r/mysqladmin.result @@ -2,3 +2,11 @@ mysqld is alive mysqladmin: unknown variable 'database=db1' Warning: mysqladmin: unknown variable 'loose-database=db2' mysqld is alive +# +# Bug#58221 : mysqladmin --sleep=x --count=x keeps looping +# +# Executing mysqladmin with --sleep=1 and --count=2. +# Done. +# Displaying the output : +mysqld is alive +mysqld is alive diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result index 46fa0dc79cd..0bdbfdcee3a 100644 --- a/mysql-test/r/mysqlbinlog_row_big.result +++ b/mysql-test/r/mysqlbinlog_row_big.result @@ -36,8 +36,8 @@ c1 LONGTEXT # # Insert some big rows. # -256MB -INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 16777216)); +64MB +INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304)); affected rows: 1 32MB INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152)); @@ -53,7 +53,7 @@ affected rows: 1 # Do not display the column value itself, just its length. # SELECT LENGTH(c1) FROM t1; -LENGTH(c1) 268435456 +LENGTH(c1) 67108864 LENGTH(c1) 33554432 LENGTH(c1) 4194304 LENGTH(c1) 524288 @@ -69,7 +69,7 @@ info: Rows matched: 4 Changed: 4 Warnings: 0 # Do not display the column value itself, just its length. # SELECT LENGTH(c1) FROM t1; -LENGTH(c1) 536870912 +LENGTH(c1) 134217728 LENGTH(c1) 1048576 LENGTH(c1) 67108864 LENGTH(c1) 8388608 diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result index 60ba06c8f7e..6659a291e0b 100644 --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -20,6 +20,7 @@ The following options may be given as the first argument: Offset added to Auto-increment columns. Used when auto-increment-increment != 1 --autocommit Set default value for autocommit (0 or 1) + (Defaults to on; use --skip-autocommit to disable.) --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) @@ -732,6 +733,7 @@ abort-slave-event-count 0 allow-suspicious-udfs FALSE auto-increment-increment 1 auto-increment-offset 1 +autocommit TRUE automatic-sp-privileges TRUE back-log 50 big-tables FALSE diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index dfb53937245..240c29294e2 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -20,6 +20,7 @@ The following options may be given as the first argument: Offset added to Auto-increment columns. Used when auto-increment-increment != 1 --autocommit Set default value for autocommit (0 or 1) + (Defaults to on; use --skip-autocommit to disable.) --automatic-sp-privileges Creating and dropping stored procedures alters ACLs (Defaults to on; use --skip-automatic-sp-privileges to disable.) @@ -736,6 +737,7 @@ abort-slave-event-count 0 allow-suspicious-udfs FALSE auto-increment-increment 1 auto-increment-offset 1 +autocommit TRUE automatic-sp-privileges TRUE back-log 50 big-tables FALSE diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 892501f2b28..dd3ea5e9716 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -14,7 +14,7 @@ INSERT INTO t1 VALUES (1), (2); - + @@ -150,9 +150,9 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES"); - - - + + + @@ -178,7 +178,7 @@ INSERT INTO t1 VALUES ("1\""), ("\"2"); - + @@ -1612,10 +1612,10 @@ CREATE TABLE `t2` ( - + - + @@ -1623,10 +1623,10 @@ CREATE TABLE `t2` ( - + - + @@ -3644,8 +3644,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0); - - + + @@ -4576,5 +4576,20 @@ LENGTH(a) 800 DROP TABLE t1, t2; # +# Bug #13618 : mysqldump --xml ommit comment on table field +# +CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT'; + + + + + + + + + + +DROP TABLE `comment_table`; +# # End of 5.1 tests # diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index c3b6d22ef38..9c8f49c333b 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -311,12 +311,33 @@ failing query in let create table t1 (a varchar(100)); insert into t1 values ('`select 42`'); `select 42` +insert into t1 values ('$dollar'); +$dollar +`select 42` drop table t1; mysqltest: At line 1: Error running query 'failing query': 1064 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 'failing query' at line 1 mysqltest: At line 1: Missing required argument 'filename' to command 'source' mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2 -mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep -mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1 +mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +included from MYSQLTEST_VARDIR/tmp/recursive.sql at line 1: +At line 1: Source directives are nesting too deep +mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": +included from MYSQLTEST_VARDIR/tmp/error.sql at line 1: +At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1 2 = outer loop variable after while here is the sourced script @@ -444,7 +465,9 @@ counter is 6 counter is 7 1 Testing while with not -mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply +mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": +included from MYSQLTEST_VARDIR/tmp/mysqltest_while.inc at line 65: +At line 64: Nesting too deeply mysqltest: At line 1: missing '(' in while mysqltest: At line 1: missing ')' in while mysqltest: At line 1: Missing '{' after while. Found "dec $i" @@ -493,8 +516,12 @@ mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1 mysqltest: At line 1: Illegal argument for port: 'illegal_port' mysqltest: At line 1: Illegal option to connect: SMTP 200 connects succeeded -mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool -mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists +mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": +included from MYSQLTEST_VARDIR/tmp/mysqltest.sql at line 3: +At line 3: connection 'test_con1' not found in connection pool +mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": +included from MYSQLTEST_VARDIR/tmp/mysqltest.sql at line 2: +At line 2: Connection test_con1 already exists show tables; ERROR 3D000: No database selected connect con1,localhost,root,,; diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index ce229bf3e2e..1f8fdb65407 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -7,13 +7,13 @@ slave_skip_errors OFF # # FLUSH PRIVILEGES should not implicitly unlock locked tables. # -drop table if exists t1; -create table t1 (c1 int); -lock tables t1 read; -flush privileges; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 INT); +LOCK TABLES t1 READ; +FLUSH PRIVILEGES; ERROR HY000: Table 'host' was not locked with LOCK TABLES -unlock tables; -drop table t1; +UNLOCK TABLES; +DROP TABLE t1; # # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN # @@ -28,7 +28,7 @@ CREATE FUNCTION f() RETURNS INT RETURN 1; GRANT FILE ON *.* TO 'nopriv_user'@'localhost'; FLUSH PRIVILEGES; connection: con1 -SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest'; +SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE ''; ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f' INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1; ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f' diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index a639f9e6b3b..9c8b93d9fe2 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1901,7 +1901,7 @@ c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644; select c1 from t1 group by (select c0 from t1 limit 1); diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index d41e4cb510c..1dcb2fdebb8 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,5 +1,655 @@ drop table if exists t1, t2; # +# Bug#54483: valgrind errors when making warnings for multiline inserts +# into partition +# +CREATE TABLE t1 (a VARBINARY(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a CHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +SHOW WARNINGS; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +SHOW WARNINGS; +Level Code Message +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'a' at row 2 +Warning 1264 Out of range value for column 'a' at row 3 +DROP TABLE t1; +CREATE TABLE t1 (a TIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +SHOW WARNINGS; +Level Code Message +Error 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFMONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MONTH(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFYEAR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (HOUR(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MINUTE(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (QUARTER(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (SECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (YEARWEEK(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (WEEKDAY(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# TO_SECONDS() is added in 5.5. +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_SECONDS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_SECONDS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_SECONDS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: The PARTITION function returns the wrong type +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (FROM_DAYS(a)); +ERROR HY000: The PARTITION function returns the wrong type +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MICROSECOND(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# Bug#57071 +CREATE TABLE t1 +(`date` date, +`extracted_week` int, +`yearweek` int, +`week` int, +`default_week_format` int) +PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3) +(PARTITION p0 VALUES IN (0), +PARTITION p1 VALUES IN (1), +PARTITION p2 VALUES IN (2)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 +(`date` date, +`extracted_week` int, +`yearweek` int, +`week` int, +`default_week_format` int); +SET @old_default_week_format := @@default_week_format; +SET default_week_format = 0; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 1; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 2; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 3; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 4; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 5; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 6; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 7; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SELECT * FROM t1; +date extracted_week yearweek week default_week_format +2000-01-01 0 199952 0 0 +2000-01-01 0 199952 0 1 +2000-01-01 52 199952 52 2 +2000-01-01 52 199952 52 3 +2000-01-01 0 199952 0 4 +2000-01-01 0 199952 0 5 +2000-01-01 52 199952 52 6 +2000-01-01 52 199952 52 7 +SET default_week_format = @old_default_week_format; +DROP TABLE t1; +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# EXTRACT(WEEK...) is disallowed, see bug#57071. +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATE, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b VARCHAR(10)) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +# # Bug#50036: Inconsistent errors when using TIMESTAMP # columns/expressions # 1. correct and appropriate errors in light of diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index 4280158dd16..339f2209cb3 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -13,16 +13,16 @@ EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index DROP TABLE t1; -create table t1 (a int) -partition by range (a) +create table t1 (a DATETIME) +partition by range (TO_DAYS(a)) subpartition by hash(to_seconds(a)) (partition p0 values less than (1)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL + `a` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50500 PARTITION BY RANGE (a) +/*!50500 PARTITION BY RANGE (TO_DAYS(a)) SUBPARTITION BY HASH (to_seconds(a)) (PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */ drop table t1; diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index b155b296ac1..fa6908530b7 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -319,7 +319,7 @@ Proxied_user With_grant 1 FLUSH PRIVILEGES; # -# Bug#58139 : default-auth option not recognized in MySQL standardi +# Bug#58139 : default-auth option not recognized in MySQL standard # command line clients # # Executing 'mysql' @@ -328,4 +328,6 @@ FLUSH PRIVILEGES; # Executing 'mysqladmin' mysqld is alive # Executing 'mysqldump' +# Executing 'mysql_upgrade' +The --upgrade-system-tables option was used, databases won't be touched. End of 5.5 tests diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index a345a2ae6aa..af0ef29bb53 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4867,6 +4867,70 @@ SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci; 1 1 DROP TABLE t1; +# +# Bug #58422: Incorrect result when OUTER JOIN'ing +# with an empty table +# +CREATE TABLE t_empty(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM; +CREATE TABLE t1(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM; +INSERT INTO t1 VALUES (1,1), (2,2), (3,3); +CREATE TABLE t2(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM; +INSERT INTO t2 VALUES (1,1), (2,2), (3,3); +EXPLAIN +SELECT * +FROM +t1 +LEFT OUTER JOIN +(t2 INNER JOIN t_empty ON TRUE) +ON t1.pk=t2.pk +WHERE t2.pk <> 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * +FROM +t1 +LEFT OUTER JOIN +(t2 INNER JOIN t_empty ON TRUE) +ON t1.pk=t2.pk +WHERE t2.pk <> 2; +pk i pk i pk i +EXPLAIN +SELECT * +FROM +t1 +LEFT OUTER JOIN +(t2 CROSS JOIN t_empty) +ON t1.pk=t2.pk +WHERE t2.pk <> 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * +FROM +t1 +LEFT OUTER JOIN +(t2 CROSS JOIN t_empty) +ON t1.pk=t2.pk +WHERE t2.pk <> 2; +pk i pk i pk i +EXPLAIN +SELECT * +FROM +t1 +LEFT OUTER JOIN +(t2 INNER JOIN t_empty ON t_empty.i=t2.i) +ON t1.pk=t2.pk +WHERE t2.pk <> 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +SELECT * +FROM +t1 +LEFT OUTER JOIN +(t2 INNER JOIN t_empty ON t_empty.i=t2.i) +ON t1.pk=t2.pk +WHERE t2.pk <> 2; +pk i pk i pk i +DROP TABLE t1,t2,t_empty; End of 5.1 tests # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index d42cb680112..feeba25c536 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1325,6 +1325,17 @@ Tables_in_test Table_type été BASE TABLE drop table `été`; set names latin1; +# +# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection +# Character set: Latin-1 (ISO-8859-1) +# +SET NAMES latin1; +CREATE DATABASE `ä`; +CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory; +SHOW TABLE STATUS FROM `ä` LIKE 'ä'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +ä MEMORY 10 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL +DROP DATABASE `ä`; show columns from `#mysql50#????????`; Got one of the listed errors DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 3136b5dfcc0..b516585fc37 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -5004,6 +5004,58 @@ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); SELECT * FROM t2 UNION SELECT * FROM t2 ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); DROP TABLE t1,t2; +# +# Bug #58818: Incorrect result for IN/ANY subquery +# with HAVING condition +# +CREATE TABLE t1(i INT); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE TABLE t1s(i INT); +INSERT INTO t1s VALUES (10), (20), (30); +CREATE TABLE t2s(i INT); +INSERT INTO t2s VALUES (100), (200), (300); +SELECT * FROM t1 +WHERE t1.i NOT IN +( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +); +i +1 +2 +3 +SELECT * FROM t1 +WHERE t1.I IN +( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +) IS UNKNOWN; +i +SELECT * FROM t1 +WHERE NOT t1.I = ANY +( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +); +i +1 +2 +3 +SELECT * FROM t1 +WHERE t1.i = ANY ( +SELECT STRAIGHT_JOIN t2s.i +FROM +t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i +HAVING t2s.i = 999 +) IS UNKNOWN; +i +DROP TABLE t1,t1s,t2s; End of 5.1 tests # # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index ebda4b52f10..69f038f9396 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -164,6 +164,17 @@ a b 2 NULL DROP TABLE t1, t2, t3, t4, t5; # +# Bug#58207: invalid memory reads when using default column value and +# tmptable needed +# +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +default(a) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t; +# # End of 5.1 tests. # # diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 958285d6a23..7d7acb3d8ac 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -637,6 +637,17 @@ CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7)) 20080729104251.1234560 Warnings: Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567' +# +# Bug#59173: Failure to handle DATE(TIME) values where Year, Month or +# Day is ZERO +# +CREATE TABLE t1 (dt1 DATETIME); +INSERT INTO t1 (dt1) VALUES ('0000-00-01 00:00:01'); +DELETE FROM t1 WHERE dt1 = '0000-00-01 00:00:01'; +# Should be empty +SELECT * FROM t1; +dt1 +DROP TABLE t1; End of 5.1 tests # # Start of 5.5 tests diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 10a2b47ba02..d5769bfd59a 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -540,3 +540,32 @@ a 2010-03-05 11:08:02 DROP TABLE t1; End of Bug#50888 +# +# Bug59330: Incorrect result when comparing an aggregate +# function with TIMESTAMP +# +CREATE TABLE t1 (dt DATETIME, ts TIMESTAMP); +INSERT INTO t1 VALUES('2011-01-06 12:34:30', '2011-01-06 12:34:30'); +SELECT MAX(dt), MAX(ts) FROM t1; +MAX(dt) MAX(ts) +2011-01-06 12:34:30 2011-01-06 12:34:30 +SELECT MAX(ts) < '2010-01-01 00:00:00' FROM t1; +MAX(ts) < '2010-01-01 00:00:00' +0 +SELECT MAX(dt) < '2010-01-01 00:00:00' FROM t1; +MAX(dt) < '2010-01-01 00:00:00' +0 +SELECT MAX(ts) > '2010-01-01 00:00:00' FROM t1; +MAX(ts) > '2010-01-01 00:00:00' +1 +SELECT MAX(dt) > '2010-01-01 00:00:00' FROM t1; +MAX(dt) > '2010-01-01 00:00:00' +1 +SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1; +MAX(ts) = '2011-01-06 12:34:30' +1 +SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; +MAX(dt) = '2011-01-06 12:34:30' +1 +DROP TABLE t1; +End of 5.5 tests diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 33fc4333d1c..1f3422c1767 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -1644,3 +1644,128 @@ b 2 DROP TABLE t1,t2; End of 5.1 tests +# +# Bug#57986 ORDER BY clause is not used after a UNION, +# if embedded in a SELECT +# +CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); +CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); +INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1); +INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1); +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1; +c1 c2 +t1a 1 +t1b 1 +t2a 1 +t2b 1 +t1a 2 +t1b 2 +t2a 2 +t2b 2 +t1a 3 +t2a 3 +SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1; +c1 c2 +t1a 1 +t1b 1 +t2a 1 +t2b 1 +t1a 2 +t1b 2 +t2a 2 +t2b 2 +t1a 3 +t2a 3 +SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1); +c1 c2 +t1a 1 +t1a 2 +t1a 3 +t1b 2 +t1b 1 +t2a 1 +t2a 2 +t2a 3 +t2b 2 +t2b 1 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +(SELECT c1, c2 FROM t2) +ORDER BY c2, c1 +) AS res; +c1 c2 +t1a 1 +t1b 1 +t2a 1 +t2b 1 +t1a 2 +t1b 2 +t2a 2 +t2b 2 +t1a 3 +t2a 3 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +(SELECT c1, c2 FROM t2) +ORDER BY c2 DESC, c1 LIMIT 1 +) AS res; +c1 c2 +t1a 3 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +(SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1) +) AS res; +c1 c2 +t1a 1 +t1a 2 +t1a 3 +t1b 2 +t1b 1 +t2a 3 +SELECT c1, c2 FROM ( +SELECT c1, c2 FROM t1 +UNION +SELECT c1, c2 FROM t2 +ORDER BY c2 DESC, c1 DESC LIMIT 1 +) AS res; +c1 c2 +t2a 3 +SELECT c1, c2 FROM ( +( +(SELECT c1, c2 FROM t1) +UNION +(SELECT c1, c2 FROM t2) +) +ORDER BY c2 DESC, c1 ASC LIMIT 1 +) AS res; +c1 c2 +t1a 3 +DROP TABLE t1, t2; +# +# Bug #58970 Problem Subquery (without referencing a table) +# and Order By +# +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev; +dev +0 +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev; +dev +1 +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev; +dev +0 +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; +dev +1 +SELECT(SELECT 1 AS a ORDER BY a) AS dev; +dev +1 +SELECT(SELECT 1 AS a LIMIT 1) AS dev; +dev +1 +SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; +dev +1 diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 1412df20012..9a0408bc174 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -1248,3 +1248,129 @@ Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist LOCK TABLES v1 READ; ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist DROP VIEW v1; +# +# Bug #58499 "DEFINER-security view selecting from INVOKER-security view +# access check wrong". +# +# Check that we correctly handle privileges for various combinations +# of INVOKER and DEFINER-security views using each other. +DROP DATABASE IF EXISTS mysqltest1; +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +# +# 1) DEFINER-security view uses INVOKER-security view (covers +# scenario originally described in the bug report). +CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2; +CREATE USER 'mysqluser1'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%'; +GRANT SELECT ON t1 TO 'mysqluser1'@'%'; +# To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%'; +# +# Connection 'mysqluser1'. +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +# +# Connection 'default'. +CREATE USER 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%'; +GRANT SELECT ON t2 TO 'mysqluser2'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%'; +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +# The below statement should succeed thanks to suid nature of v2_uses_t1. +SELECT * FROM v2_uses_t1; +i +1 +# The below statement should fail due to suid nature of v2_uses_t2. +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# 2) INVOKER-security view uses INVOKER-security view. +# +# Connection 'default'. +DROP VIEW v2_uses_t1, v2_uses_t2; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%'; +# +# Connection 'mysqluser1'. +# For both versions of 'v2' 'mysqluser1' privileges should be used. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# Connection 'mysqluser2'. +# And now for both versions of 'v2' 'mysqluser2' privileges should +# be used. +SELECT * FROM v2_uses_t1; +ERROR HY000: View 'mysqltest1.v2_uses_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v2_uses_t2; +j +2 +# +# 3) INVOKER-security view uses DEFINER-security view. +# +# Connection 'default'. +DROP VIEW v1_uses_t1, v1_uses_t2; +# To be able create 'v1_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +# +# Connection 'mysqluser1'. +CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2; +# +# Connection 'default'. +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +# Due to suid nature of v1_uses_t1 and v1_uses_t2 the first +# select should succeed and the second select should fail. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# 4) DEFINER-security view uses DEFINER-security view. +# +# Connection 'default'. +DROP VIEW v2_uses_t1, v2_uses_t2; +# To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +# +# Connection 'default'. +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +# +# Connection 'mysqluser2'. +# Again privileges of creator of innermost views should apply. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +USE test; +DROP DATABASE mysqltest1; +DROP USER 'mysqluser1'@'%'; +DROP USER 'mysqluser2'@'%'; diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 6b7ba57ce2e..4568775d3fd 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1113,6 +1113,17 @@ SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1); ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); ERROR 22007: Illegal double '111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' value found during parsing +# +# Bug #44332 my_xml_scan reads behind the end of buffer +# +SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1'); +UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1') +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 2: END-OF-INPUT unexpected (ident or '/' wanted)' +SELECT UPDATEXML(CONVERT(_latin1' Dumping mysqltest1 to outfile1 - --exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqltest1 > $outfile1 +# Take care that the additional session caused by MYSQL_DUMP has disappeared. +--source include/wait_until_count_sessions.inc # - Clean mysqltest1; @@ -917,9 +932,12 @@ DROP DATABASE mysqltest1; --echo --echo +--source include/count_sessions.inc --echo ---> Restoring mysqltest1... --exec $MYSQL test < $outfile1 --remove_file $outfile1 +# Take care that the additional session caused by MYSQL has disappeared. +--source include/wait_until_count_sessions.inc # - Check definition of the table. @@ -989,14 +1007,14 @@ grant select on `mysqltest`.`t1` to mysqltest_4@localhost; connect (con4,localhost,mysqltest_4,,mysqltest); connection con4; show create database mysqltest; +disconnect con4; +--source include/wait_until_disconnected.inc connection default; delete from mysql.user where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4'; delete from mysql.tables_priv where user='mysqltest_4'; flush privileges; drop database mysqltest; -connection default; -disconnect con4; # # Ensure that show plugin code is tested @@ -1048,6 +1066,17 @@ show full tables; drop table `été`; set names latin1; +--echo # +--echo # Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection +--echo # Character set: Latin-1 (ISO-8859-1) +--echo # +SET NAMES latin1; +CREATE DATABASE `ä`; +CREATE TABLE `ä`.`ä` (a int) ENGINE=Memory; +--replace_column 6 # 7 # 8 # 9 # +SHOW TABLE STATUS FROM `ä` LIKE 'ä'; +DROP DATABASE `ä`; + # # Bug#26402 Server crashes with old-style named table # @@ -1192,6 +1221,7 @@ SHOW ENGINE MYISAM STATUS; --enable_result_log disconnect conn1; +--source include/wait_until_disconnected.inc connection default; DROP USER test_u@localhost; @@ -1214,8 +1244,9 @@ CONNECTION con1; --error ER_QUERY_INTERRUPTED SHOW CREATE TABLE non_existent; -CONNECTION default; DISCONNECT con1; +--source include/wait_until_disconnected.inc +CONNECTION default; --echo End of 5.1 tests @@ -1239,9 +1270,11 @@ connection con1; --echo # This statement used to be blocked. SHOW CREATE TABLE t1; +disconnect con1; +--source include/wait_until_disconnected.inc + --echo # Switching to connection 'default'. connection default; -disconnect con1; UNLOCK TABLES; DROP TABLE t1; @@ -1317,17 +1350,16 @@ connection con1; # Should not block. ALTER TABLE t1 CHARACTER SET = utf8; +disconnect con1; +--source include/wait_until_disconnected.inc + --echo # Connection default connection default; COMMIT; DROP TRIGGER t1_bi; DROP TABLE t1; -disconnect con1; -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc - --echo # --echo # Bug#57306 SHOW PROCESSLIST does not display string literals well. --echo # @@ -1352,6 +1384,7 @@ SELECT RELEASE_LOCK('t'); --connection con1 --reap --disconnect con1 +--source include/wait_until_disconnected.inc --connection default SET NAMES latin1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index d4a995ee181..f60ee247ba7 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3945,6 +3945,55 @@ SELECT * FROM t2 UNION SELECT * FROM t2 DROP TABLE t1,t2; --enable_result_log +--echo # +--echo # Bug #58818: Incorrect result for IN/ANY subquery +--echo # with HAVING condition +--echo # + +CREATE TABLE t1(i INT); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE TABLE t1s(i INT); +INSERT INTO t1s VALUES (10), (20), (30); +CREATE TABLE t2s(i INT); +INSERT INTO t2s VALUES (100), (200), (300); + +SELECT * FROM t1 +WHERE t1.i NOT IN +( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 +); + +SELECT * FROM t1 +WHERE t1.I IN +( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 +) IS UNKNOWN; + +SELECT * FROM t1 +WHERE NOT t1.I = ANY +( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 +); + +SELECT * FROM t1 + WHERE t1.i = ANY ( + SELECT STRAIGHT_JOIN t2s.i + FROM + t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i + HAVING t2s.i = 999 + ) IS UNKNOWN; + +DROP TABLE t1,t1s,t2s; + --echo End of 5.1 tests --echo # diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 6727833eb44..f024dd2567f 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -136,6 +136,16 @@ SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); DROP TABLE t1, t2, t3, t4, t5; +--echo # +--echo # Bug#58207: invalid memory reads when using default column value and +--echo # tmptable needed +--echo # +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +DROP TABLE t; + --echo # --echo # End of 5.1 tests. diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index ca2a7804907..25d3c8f7e91 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -445,6 +445,17 @@ SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS # show we truncate microseconds from the right SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7)); +--echo # +--echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or +--echo # Day is ZERO +--echo # +CREATE TABLE t1 (dt1 DATETIME); +INSERT INTO t1 (dt1) VALUES ('0000-00-01 00:00:01'); +DELETE FROM t1 WHERE dt1 = '0000-00-01 00:00:01'; +--echo # Should be empty +SELECT * FROM t1; +DROP TABLE t1; + --echo End of 5.1 tests --echo # diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index dfac6f93b7d..76423b11b99 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -377,3 +377,21 @@ SELECT a FROM t1; DROP TABLE t1; --echo End of Bug#50888 + +--echo # +--echo # Bug59330: Incorrect result when comparing an aggregate +--echo # function with TIMESTAMP +--echo # +CREATE TABLE t1 (dt DATETIME, ts TIMESTAMP); +INSERT INTO t1 VALUES('2011-01-06 12:34:30', '2011-01-06 12:34:30'); +SELECT MAX(dt), MAX(ts) FROM t1; +SELECT MAX(ts) < '2010-01-01 00:00:00' FROM t1; +SELECT MAX(dt) < '2010-01-01 00:00:00' FROM t1; +SELECT MAX(ts) > '2010-01-01 00:00:00' FROM t1; +SELECT MAX(dt) > '2010-01-01 00:00:00' FROM t1; +SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1; +SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1; +DROP TABLE t1; + +--echo End of 5.5 tests + diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 596fc5f41ef..c6599517e90 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1117,3 +1117,70 @@ DROP TABLE t1,t2; --echo End of 5.1 tests + +--echo # +--echo # Bug#57986 ORDER BY clause is not used after a UNION, +--echo # if embedded in a SELECT +--echo # + +CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); +CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL); + + +INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1); +INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1); + +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1; +SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1; +SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1); + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + (SELECT c1, c2 FROM t2) + ORDER BY c2, c1 +) AS res; + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + (SELECT c1, c2 FROM t2) + ORDER BY c2 DESC, c1 LIMIT 1 +) AS res; + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + (SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1) +) AS res; + +SELECT c1, c2 FROM ( + SELECT c1, c2 FROM t1 + UNION + SELECT c1, c2 FROM t2 + ORDER BY c2 DESC, c1 DESC LIMIT 1 +) AS res; + +SELECT c1, c2 FROM ( + ( + (SELECT c1, c2 FROM t1) + UNION + (SELECT c1, c2 FROM t2) + ) + ORDER BY c2 DESC, c1 ASC LIMIT 1 +) AS res; + +DROP TABLE t1, t2; + +--echo # +--echo # Bug #58970 Problem Subquery (without referencing a table) +--echo # and Order By +--echo # + +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev; +SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev; +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev; +SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; +SELECT(SELECT 1 AS a ORDER BY a) AS dev; +SELECT(SELECT 1 AS a LIMIT 1) AS dev; +SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev; diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index 3ccef94d7ea..5896e25feda 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1503,8 +1503,6 @@ SHOW CREATE VIEW v1; DROP TABLE t1; DROP VIEW v1; -# Wait till we reached the initial number of concurrent sessions ---source include/wait_until_count_sessions.inc --echo # --echo # Bug #46019: ERROR 1356 When selecting from within another @@ -1546,3 +1544,145 @@ CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; --error ER_NO_SUCH_USER LOCK TABLES v1 READ; DROP VIEW v1; + + +--echo # +--echo # Bug #58499 "DEFINER-security view selecting from INVOKER-security view +--echo # access check wrong". +--echo # +--echo # Check that we correctly handle privileges for various combinations +--echo # of INVOKER and DEFINER-security views using each other. +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +--enable_warnings +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +--echo # +--echo # 1) DEFINER-security view uses INVOKER-security view (covers +--echo # scenario originally described in the bug report). +CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2; +CREATE USER 'mysqluser1'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%'; +GRANT SELECT ON t1 TO 'mysqluser1'@'%'; +--echo # To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connect (mysqluser1, localhost, mysqluser1,,mysqltest1) +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +--echo # +--echo # Connection 'default'. +--connection default +CREATE USER 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%'; +GRANT SELECT ON t2 TO 'mysqluser2'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%'; +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connect (mysqluser2, localhost, mysqluser2,,mysqltest1) +--echo # The below statement should succeed thanks to suid nature of v2_uses_t1. +SELECT * FROM v2_uses_t1; +--echo # The below statement should fail due to suid nature of v2_uses_t2. +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # 2) INVOKER-security view uses INVOKER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v2_uses_t1, v2_uses_t2; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connection mysqluser1 +--echo # For both versions of 'v2' 'mysqluser1' privileges should be used. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # And now for both versions of 'v2' 'mysqluser2' privileges should +--echo # be used. +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t1; +SELECT * FROM v2_uses_t2; +--echo # +--echo # 3) INVOKER-security view uses DEFINER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v1_uses_t1, v1_uses_t2; +--echo # To be able create 'v1_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connection mysqluser1 +CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2; +--echo # +--echo # Connection 'default'. +--connection default +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # Due to suid nature of v1_uses_t1 and v1_uses_t2 the first +--echo # select should succeed and the second select should fail. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # 4) DEFINER-security view uses DEFINER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v2_uses_t1, v2_uses_t2; +--echo # To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +--echo # +--echo # Connection 'default'. +--connection default +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # Again privileges of creator of innermost views should apply. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; + +--disconnect mysqluser1 +--disconnect mysqluser2 +--connection default +USE test; +DROP DATABASE mysqltest1; +DROP USER 'mysqluser1'@'%'; +DROP USER 'mysqluser2'@'%'; + + +# Wait till we reached the initial number of concurrent sessions +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 1dc5eadbccc..3bc580fe4e5 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -640,6 +640,11 @@ SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1); --error ER_ILLEGAL_VALUE_FOR_TYPE SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); +--echo # +--echo # Bug #44332 my_xml_scan reads behind the end of buffer +--echo # +SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1'); +SELECT UPDATEXML(CONVERT(_latin1'", 3); p->cur++) - {} - if (!memcmp(p->cur, "-->", 3)) - p->cur+=3; + for (; p->cur < p->end; p->cur++) + { + if (!my_xml_parser_prefix_cmp(p, C_STRING_WITH_LEN("-->"))) + { + p->cur+= 3; + break; + } + } a->end=p->cur; lex=MY_XML_COMMENT; } - else if (!memcmp(p->cur, "cur+= 9; for (; p->cur < p->end - 2 ; p->cur++) diff --git a/tests/thread_test.c b/tests/thread_test.c index c243a3a7321..4edfe59772c 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -15,15 +15,6 @@ #include -#ifndef THREAD - -int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) -{ - printf("This test must be compiled with multithread support to work\n"); - exit(1); -} -#else - #include #include #include "mysql.h" @@ -254,4 +245,3 @@ int main(int argc, char **argv) return 0; /* Keep some compilers happy */ } -#endif /* THREAD */