diff --git a/.bzrignore b/.bzrignore index f757e602563..409b6148125 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1140,3 +1140,7 @@ libmysqld/gcalc_tools.cc sql/share/errmsg.sys sql/share/mysql install_manifest.txt +sql/db.opt +./_CPack_Packages +./install_manifest_*.txt +typescript diff --git a/CMakeLists.txt b/CMakeLists.txt index 41ee9b199b1..3db85a0b3e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,6 @@ ENDIF() SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel") - - IF(UNIX AND NOT APPLE) # Note, that generally one should not change settings depending # on CMAKE_BUILD_TYPE, because VS and Xcode configure once (with @@ -124,18 +122,30 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel") SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS() ENDIF() +# Packaging +IF (NOT CPACK_GENERATOR) + IF(WIN32) + SET(CPACK_GENERATOR "ZIP") + ELSE() + SET(CPACK_GENERATOR "TGZ") + ENDIF(WIN32) +ENDIF(NOT CPACK_GENERATOR) + +INCLUDE(mysql_version) +INCLUDE(cpack_rpm) +INCLUDE(cpack_source_ignore_files) +INCLUDE(install_layout) + # Add macros INCLUDE(character_sets) INCLUDE(zlib) INCLUDE(ssl) INCLUDE(readline) -INCLUDE(mysql_version) INCLUDE(libutils) INCLUDE(dtrace) INCLUDE(ctest) INCLUDE(plugin) INCLUDE(install_macros) -INCLUDE(install_layout) INCLUDE(mysql_add_executable) INCLUDE(wsrep) @@ -238,8 +248,8 @@ ELSE() ENDIF() SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}") SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}") -IF(SYSCONFDIR) - SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}") +IF(INSTALL_SYSCONFDIR) + SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}") ENDIF() @@ -351,51 +361,18 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -# Packaging -IF(WIN32) - SET(CPACK_GENERATOR "ZIP") -ELSE() - SET(CPACK_GENERATOR "TGZ") -ENDIF() - - -# Create a single package with "make package" -# (see http://public.kitware.com/Bug/view.php?id=11452) -SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "") +INSTALL(FILES COPYING COPYING.LESSER LICENSE.mysql +DESTINATION ${INSTALL_DOCREADMEDIR} +COMPONENT Readme +OPTIONAL +) +INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) +INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) +IF(UNIX) + INSTALL(FILES Docs/INSTALL-BINARY Docs/README-wsrep DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) +ENDIF() INCLUDE(CPack) -IF(UNIX) - INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) -ENDIF() -# -# RPM installs documentation directly from the source tree -# -IF(NOT INSTALL_LAYOUT MATCHES "RPM") - INSTALL(FILES COPYING COPYING.LESSER LICENSE.mysql - DESTINATION ${INSTALL_DOCREADMEDIR} - COMPONENT Readme - OPTIONAL - ) - INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) - INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) - IF(UNIX) - INSTALL(FILES Docs/INSTALL-BINARY Docs/README-wsrep DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) - ENDIF() - # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory - SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied") - MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION) - INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR} - COMPONENT Documentation - PATTERN "INSTALL-BINARY" EXCLUDE - PATTERN "README-wsrep" EXCLUDE - PATTERN "Makefile.*" EXCLUDE - PATTERN "glibc*" EXCLUDE - PATTERN "linuxthreads.txt" EXCLUDE - PATTERN "myisam.txt" EXCLUDE - PATTERN "mysql.info" EXCLUDE - PATTERN "sp-imp-spec.txt" EXCLUDE - ) -ENDIF() IF(NON_DISTRIBUTABLE_WARNING) MESSAGE(WARNING " diff --git a/VERSION b/VERSION index 94796f2c7ba..0f96ceb238d 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=23 +MYSQL_VERSION_PATCH=24 MYSQL_VERSION_EXTRA= diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 3f53158572f..e4507f9c8ba 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -49,7 +49,7 @@ TARGET_LINK_LIBRARIES(mysqldump mysqlclient) MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) TARGET_LINK_LIBRARIES(mysqlimport mysqlclient) -MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c) +MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 27c26cf9b64..e3da44e2fc5 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -141,7 +141,8 @@ static my_bool opt_compress= FALSE, tty_password= FALSE, const char *auto_generate_sql_type= "mixed"; static unsigned long connect_flags= CLIENT_MULTI_RESULTS | - CLIENT_MULTI_STATEMENTS; + CLIENT_MULTI_STATEMENTS | + CLIENT_REMEMBER_OPTIONS; static int verbose, delimiter_length; static uint commit_rate; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index e6d42bc60a2..b93c9426deb 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -33,7 +33,7 @@ And many others */ -#define MTEST_VERSION "3.3" +#define MTEST_VERSION "3.4" #include "client_priv.h" #include @@ -78,6 +78,8 @@ static my_bool non_blocking_api_enabled= 0; #define MAX_DELIMITER_LENGTH 16 #define DEFAULT_MAX_CONN 64 +#define DIE_BUFF_SIZE 8192 + /* Flags controlling send and reap */ #define QUERY_SEND_FLAG 1 #define QUERY_REAP_FLAG 2 @@ -106,6 +108,7 @@ static int opt_port= 0; static int opt_max_connect_retries; static int opt_result_format_version; static int opt_max_connections= DEFAULT_MAX_CONN; +static int error_count= 0; static my_bool opt_compress= 0, silent= 0, verbose= 0; static my_bool debug_info_flag= 0, debug_check_flag= 0; static my_bool tty_password= 0; @@ -122,7 +125,7 @@ static my_bool disable_connect_log= 1; static my_bool disable_warnings= 0, disable_column_names= 0; static my_bool prepare_warnings_enabled= 0; static my_bool disable_info= 1; -static my_bool abort_on_error= 1; +static my_bool abort_on_error= 1, opt_continue_on_error= 0; static my_bool server_initialized= 0; static my_bool is_windows= 0; static char **default_argv; @@ -559,14 +562,15 @@ const char *from, int len); static void cleanup_and_exit(int exit_code) __attribute__((noreturn)); -void die(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn)); -void abort_not_supported_test(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn)); -void verbose_msg(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); -void log_msg(const char *fmt, ...) - ATTRIBUTE_FORMAT(printf, 1, 2); +void really_die(const char *msg) __attribute__((noreturn)); +void report_or_die(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); +void die(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2) + __attribute__((noreturn)); +static void make_error_message(char *buf, size_t len, const char *fmt, va_list args); +void abort_not_supported_test(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2) + __attribute__((noreturn)); +void verbose_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); +void log_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2); VAR* var_from_env(const char *, const char *); VAR* var_init(VAR* v, const char *name, int name_len, const char *val, @@ -812,6 +816,9 @@ void handle_error(struct st_command*, void handle_no_error(struct st_command*); void revert_properties(); +static void handle_no_active_connection(struct st_command* command, + struct st_connection *cn, DYNAMIC_STRING *ds); + #ifdef EMBEDDED_LIBRARY #define EMB_SEND_QUERY 1 @@ -983,7 +990,10 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query, else { if (!(v= var_get(p, &p, 0, 0))) - die("Bad variable in eval"); + { + report_or_die( "Bad variable in eval"); + return; + } dynstr_append_mem(query_eval, v->str_val, v->str_val_len); } break; @@ -1270,9 +1280,13 @@ void handle_command_error(struct st_command *command, uint error, int i; if (command->abort_on_error) - die("command \"%.*s\" failed with error: %u my_errno: %d errno: %d", + { + report_or_die("command \"%.*s\" failed with error: %u my_errno: %d " + "errno: %d", command->first_word_len, command->query, error, my_errno, sys_errno); + return; + } i= match_expected_error(command, error, NULL); @@ -1285,14 +1299,17 @@ void handle_command_error(struct st_command *command, uint error, DBUG_VOID_RETURN; } if (command->expected_errors.count > 0) - die("command \"%.*s\" failed with wrong error: %u my_errno: %d errno: %d", - command->first_word_len, command->query, error, my_errno, sys_errno); + report_or_die("command \"%.*s\" failed with wrong error: %u " + "my_errno: %d errno: %d", + command->first_word_len, command->query, error, my_errno, + sys_errno); } else if (command->expected_errors.err[0].type == ERR_ERRNO && command->expected_errors.err[0].code.errnum != 0) { /* Error code we wanted was != 0, i.e. not an expected success */ - die("command \"%.*s\" succeeded - should have failed with errno %d...", + report_or_die("command \"%.*s\" succeeded - should have failed with " + "errno %d...", command->first_word_len, command->query, command->expected_errors.err[0].code.errnum); } @@ -1437,50 +1454,59 @@ static void cleanup_and_exit(int exit_code) exit(exit_code); } -void print_file_stack() +size_t print_file_stack(char *s, const char *end) { + char *start= s; struct st_test_file* err_file= cur_file; if (err_file == file_stack) - return; + return 0; for (;;) { err_file--; - fprintf(stderr, "included from %s at line %d:\n", - err_file->file_name, err_file->lineno); + s+= my_snprintf(s, end - s, "included from %s at line %d:\n", + err_file->file_name, err_file->lineno); if (err_file == file_stack) break; } + return s - start; +} + + +static void make_error_message(char *buf, size_t len, const char *fmt, va_list args) +{ + char *s= buf, *end= buf + len; + s+= my_snprintf(s, end - s, "mysqltest: "); + if (cur_file && cur_file != file_stack) + { + s+= my_snprintf(s, end - s, "In included file \"%s\": \n", + cur_file->file_name); + s+= print_file_stack(s, end); + } + + if (start_lineno > 0) + s+= my_snprintf(s, end -s, "At line %u: ", start_lineno); + if (!fmt) + fmt= "unknown error"; + + s+= my_vsnprintf(s, end - s, fmt, args); + s+= my_snprintf(s, end -s, "\n", start_lineno); } void die(const char *fmt, ...) { - static int dying= 0; + char buff[DIE_BUFF_SIZE]; va_list args; - DBUG_ENTER("die"); - DBUG_PRINT("enter", ("start_lineno: %d", start_lineno)); + va_start(args, fmt); + make_error_message(buff, sizeof(buff), fmt, args); + really_die(buff); +} +void really_die(const char *msg) +{ + static int dying= 0; fflush(stdout); - /* Print the error message */ - fprintf(stderr, "mysqltest: "); - if (cur_file && cur_file != file_stack) - { - 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) - { - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - } - else - fprintf(stderr, "unknown error"); - fprintf(stderr, "\n"); + fprintf(stderr, "%s", msg); fflush(stderr); /* @@ -1504,6 +1530,28 @@ void die(const char *fmt, ...) cleanup_and_exit(1); } +void report_or_die(const char *fmt, ...) +{ + va_list args; + DBUG_ENTER("report_or_die"); + + char buff[DIE_BUFF_SIZE]; + + va_start(args, fmt); + make_error_message(buff, sizeof(buff), fmt, args); + va_end(args); + + if (opt_continue_on_error) + { + /* Just log the error and continue */ + replace_dynstr_append(&ds_res, buff); + error_count++; + DBUG_VOID_RETURN; + } + + really_die(buff); +} + void abort_not_supported_test(const char *fmt, ...) { @@ -1516,7 +1564,10 @@ void abort_not_supported_test(const char *fmt, ...) file_stack->file_name); fprintf(stderr, "Detected in file %s at line %d\n", cur_file->file_name, cur_file->lineno); - print_file_stack(); + + char buff[DIE_BUFF_SIZE]; + print_file_stack(buff, buff + sizeof(buff)); + fprintf(stderr, "%s", buff); /* Print error message */ va_start(args, fmt); @@ -1648,7 +1699,10 @@ static int run_command(char* cmd, DBUG_PRINT("enter", ("cmd: %s", cmd)); if (!(res_file= popen(cmd, "r"))) - die("popen(\"%s\", \"r\") failed", cmd); + { + report_or_die("popen(\"%s\", \"r\") failed", cmd); + return -1; + } while (fgets(buf, sizeof(buf), res_file)) { @@ -1748,7 +1802,10 @@ static int diff_check(const char *diff_name) if (!(res_file= popen(buf, "r"))) die("popen(\"%s\", \"r\") failed", buf); - /* if diff is not present, nothing will be in stdout to increment have_diff */ + /* + if diff is not present, nothing will be in stdout to increment + have_diff + */ if (fgets(buf, sizeof(buf), res_file)) have_diff= 1; @@ -2061,7 +2118,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname) void check_result() { - const char* mess= "Result content mismatch\n"; + const char *mess= 0; DBUG_ENTER("check_result"); DBUG_ASSERT(result_file_name); @@ -2069,9 +2126,13 @@ void check_result() switch (compare_files(log_file.file_name(), result_file_name)) { case RESULT_OK: - break; /* ok */ + if (!error_count) + break; /* ok */ + mess= "Got errors while running test"; + /* Fallthrough */ case RESULT_LENGTH_MISMATCH: - mess= "Result length mismatch\n"; + if (!mess) + mess= "Result length mismatch\n"; /* Fallthrough */ case RESULT_CONTENT_MISMATCH: { @@ -2081,6 +2142,10 @@ void check_result() */ char reject_file[FN_REFLEN]; size_t reject_length; + + if (!mess) + mess= "Result content mismatch\n"; + dirname_part(reject_file, result_file_name, &reject_length); if (access(reject_file, W_OK) == 0) @@ -2180,8 +2245,8 @@ static int strip_surrounding(char* str, char c1, char c2) static void strip_parentheses(struct st_command *command) { if (strip_surrounding(command->first_argument, '(', ')')) - die("%.*s - argument list started with '%c' must be ended with '%c'", - command->first_word_len, command->query, '(', ')'); + die("%.*s - argument list started with '%c' must be ended with '%c'", + command->first_word_len, command->query, '(', ')'); } @@ -2500,6 +2565,19 @@ void var_query_set(VAR *var, const char *query, const char** query_end) DBUG_ENTER("var_query_set"); LINT_INIT(res); + if (!mysql) + { + struct st_command command; + memset(&command, 0, sizeof(command)); + command.query= (char*)query; + command.first_word_len= (*query_end - query); + command.first_argument= command.query + command.first_word_len; + command.end= (char*)*query_end; + command.abort_on_error= 1; /* avoid uninitialized variables */ + handle_no_active_connection(&command, cur_con, &ds_res); + DBUG_VOID_RETURN; + } + /* Only white space or ) allowed past ending ` */ while (end > query && *end != '`') { @@ -2518,8 +2596,8 @@ void var_query_set(VAR *var, const char *query, const char** query_end) if (mysql_real_query(mysql, ds_query.str, ds_query.length)) { - handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql), - mysql_sqlstate(mysql), &ds_res); + handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), &ds_res); /* If error was acceptable, return empty string */ dynstr_free(&ds_query); eval_expr(var, "", 0); @@ -2527,7 +2605,12 @@ void var_query_set(VAR *var, const char *query, const char** query_end) } if (!(res= mysql_store_result(mysql))) - die("Query '%s' didn't return a result set", ds_query.str); + { + report_or_die("Query '%s' didn't return a result set", ds_query.str); + dynstr_free(&ds_query); + eval_expr(var, "", 0); + return; + } dynstr_free(&ds_query); if ((row= mysql_fetch_row(res)) && row[0]) @@ -2674,6 +2757,12 @@ void var_set_query_get_value(struct st_command *command, VAR *var) DBUG_ENTER("var_set_query_get_value"); LINT_INIT(res); + if (!mysql) + { + handle_no_active_connection(command, cur_con, &ds_res); + DBUG_VOID_RETURN; + } + strip_parentheses(command); DBUG_PRINT("info", ("query: %s", command->query)); check_command_args(command, command->first_argument, query_get_value_args, @@ -2696,16 +2785,23 @@ void var_set_query_get_value(struct st_command *command, VAR *var) /* Run the query */ if (mysql_real_query(mysql, ds_query.str, ds_query.length)) { - handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql), - mysql_sqlstate(mysql), &ds_res); + handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql), + mysql_sqlstate(mysql), &ds_res); /* If error was acceptable, return empty string */ dynstr_free(&ds_query); + dynstr_free(&ds_col); eval_expr(var, "", 0); DBUG_VOID_RETURN; } if (!(res= mysql_store_result(mysql))) - die("Query '%s' didn't return a result set", ds_query.str); + { + report_or_die("Query '%s' didn't return a result set", ds_query.str); + dynstr_free(&ds_query); + dynstr_free(&ds_col); + eval_expr(var, "", 0); + return; + } { /* Find column number from the given column name */ @@ -2725,8 +2821,11 @@ void var_set_query_get_value(struct st_command *command, VAR *var) if (col_no == -1) { mysql_free_result(res); - die("Could not find column '%s' in the result of '%s'", - ds_col.str, ds_query.str); + report_or_die("Could not find column '%s' in the result of '%s'", + ds_col.str, ds_query.str); + dynstr_free(&ds_query); + dynstr_free(&ds_col); + return; } DBUG_PRINT("info", ("Found column %d with name '%s'", i, fields[i].name)); @@ -2834,6 +2933,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, command.first_word_len= len; command.first_argument= command.query + len; command.end= (char*)*p_end; + command.abort_on_error= 1; /* avoid uninitialized variables */ var_set_query_get_value(&command, v); DBUG_VOID_RETURN; } @@ -3165,7 +3265,10 @@ void do_exec(struct st_command *command) while (*cmd && my_isspace(charset_info, *cmd)) cmd++; if (!*cmd) - die("Missing argument in exec"); + { + report_or_die("Missing argument in exec"); + return; + } command->last_argument= command->end; init_dynamic_string(&ds_cmd, 0, command->query_len+256, 256); @@ -3197,10 +3300,12 @@ void do_exec(struct st_command *command) DBUG_PRINT("info", ("Executing '%s' as '%s'", command->first_argument, ds_cmd.str)); - if (!(res_file= my_popen(&ds_cmd, "r")) && command->abort_on_error) + if (!(res_file= my_popen(&ds_cmd, "r"))) { dynstr_free(&ds_cmd); - die("popen(\"%s\", \"r\") failed", command->first_argument); + if (command->abort_on_error) + report_or_die("popen(\"%s\", \"r\") failed", command->first_argument); + return; } ds_result= &ds_res; @@ -3237,11 +3342,12 @@ void do_exec(struct st_command *command) if (command->abort_on_error) { - log_msg("exec of '%s' failed, error: %d, status: %d, errno: %d", - ds_cmd.str, error, status, errno); + report_or_die("exec of '%s' failed, error: %d, status: %d, errno: %d\n" + "Output from before failure:\n%s\n", + ds_cmd.str, error, status, errno, + ds_res.str); dynstr_free(&ds_cmd); - die("command \"%s\" failed\n\nOutput from before failure:\n%s\n", - command->first_argument, ds_res.str); + return; } DBUG_PRINT("info", @@ -3256,8 +3362,8 @@ void do_exec(struct st_command *command) { dynstr_free(&ds_cmd); if (command->expected_errors.count > 0) - die("command \"%s\" failed with wrong error: %d", - command->first_argument, status); + report_or_die("command \"%s\" failed with wrong error: %d", + command->first_argument, status); } } else if (command->expected_errors.err[0].type == ERR_ERRNO && @@ -3267,8 +3373,10 @@ void do_exec(struct st_command *command) log_msg("exec of '%s failed, error: %d, errno: %d", ds_cmd.str, error, errno); dynstr_free(&ds_cmd); - die("command \"%s\" succeeded - should have failed with errno %d...", - command->first_argument, command->expected_errors.err[0].code.errnum); + report_or_die("command \"%s\" succeeded - should have failed with " + "errno %d...", + command->first_argument, + command->expected_errors.err[0].code.errnum); } dynstr_free(&ds_cmd); @@ -3302,7 +3410,8 @@ int do_modify_var(struct st_command *command, const char *p= command->first_argument; VAR* v; if (!*p) - die("Missing argument to %.*s", command->first_word_len, command->query); + die("Missing argument to %.*s", command->first_word_len, + command->query); if (*p != '$') die("The argument to %.*s must be a variable (start with $)", command->first_word_len, command->query); @@ -3368,7 +3477,10 @@ void do_system(struct st_command *command) DBUG_ENTER("do_system"); if (strlen(command->first_argument) == 0) - die("Missing arguments to system, nothing to do!"); + { + report_or_die("Missing arguments to system, nothing to do!"); + return; + } init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256); @@ -3389,12 +3501,14 @@ void do_system(struct st_command *command) if (my_system(&ds_cmd)) { if (command->abort_on_error) - die("system command '%s' failed", command->first_argument); - - /* If ! abort_on_error, log message and continue */ - dynstr_append(&ds_res, "system command '"); - replace_dynstr_append(&ds_res, command->first_argument); - dynstr_append(&ds_res, "' failed\n"); + report_or_die("system command '%s' failed", command->first_argument); + else + { + /* If ! abort_on_error, log message and continue */ + dynstr_append(&ds_res, "system command '"); + replace_dynstr_append(&ds_res, command->first_argument); + dynstr_append(&ds_res, "' failed\n"); + } } command->last_argument= command->end; @@ -3941,12 +4055,12 @@ void read_until_delimiter(DYNAMIC_STRING *ds, No characters except \n are allowed on the same line as the command */ - die("Trailing characters found after command"); + report_or_die("Trailing characters found after command"); } if (feof(cur_file->file)) - die("End of file encountered before '%s' delimiter was found", - ds_delimiter->str); + report_or_die("End of file encountered before '%s' delimiter was found", + ds_delimiter->str); if (match_delimiter(c, ds_delimiter->str, ds_delimiter->length)) { @@ -4350,8 +4464,13 @@ void do_perl(struct st_command *command) /* Format the "perl " command */ my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path); - if (!(res_file= popen(buf, "r")) && command->abort_on_error) - die("popen(\"%s\", \"r\") failed", buf); + if (!(res_file= popen(buf, "r"))) + { + if (command->abort_on_error) + die("popen(\"%s\", \"r\") failed", buf); + dynstr_free(&ds_delimiter); + return; + } while (fgets(buf, sizeof(buf), res_file)) { @@ -4506,14 +4625,14 @@ void do_sync_with_master2(struct st_command *command, long offset) information is not initialized, the arguments are incorrect, or an error has occured */ - die("%.*s failed: '%s' returned NULL "\ + die("%.*s failed: '%s' returned NULL " \ "indicating slave SQL thread failure", command->first_word_len, command->query, query_buf); } if (result == -1) - die("%.*s failed: '%s' returned -1 "\ + die("%.*s failed: '%s' returned -1 " \ "indicating timeout after %d seconds", command->first_word_len, command->query, query_buf, timeout); else @@ -4808,7 +4927,8 @@ int do_sleep(struct st_command *command, my_bool real_sleep) while (my_isspace(charset_info, *p)) p++; if (!*p) - die("Missing argument to %.*s", command->first_word_len, command->query); + die("Missing argument to %.*s", command->first_word_len, + command->query); sleep_start= p; /* Check that arg starts with a digit, not handled by my_strtod */ if (!my_isdigit(charset_info, *sleep_start)) @@ -4880,16 +5000,21 @@ int query_get_string(MYSQL* mysql, const char* query, MYSQL_ROW row; if (mysql_query(mysql, query)) - die("'%s' failed: %d %s", query, - mysql_errno(mysql), mysql_error(mysql)); + { + report_or_die("'%s' failed: %d %s", query, + mysql_errno(mysql), mysql_error(mysql)); + return 1; + } if ((res= mysql_store_result(mysql)) == NULL) - die("Failed to store result: %d %s", - mysql_errno(mysql), mysql_error(mysql)); + { + report_or_die("Failed to store result: %d %s", + mysql_errno(mysql), mysql_error(mysql)); + return 1; + } if ((row= mysql_fetch_row(res)) == NULL) { mysql_free_result(res); - ds= 0; return 1; } init_dynamic_string(ds, (row[column] ? row[column] : "NULL"), ~0, 32); @@ -5161,7 +5286,7 @@ void do_get_errcodes(struct st_command *command) while (*p && p != end) { if (!my_isdigit(charset_info, *p)) - die("Invalid argument to error: '%s' - "\ + die("Invalid argument to error: '%s' - " \ "the errno may only consist of digits[0-9]", command->first_argument); p++; @@ -6084,7 +6209,7 @@ void do_block(enum block_cmd cmd, struct st_command* command) eval_expr(&v2, curr_ptr, &expr_end); if ((operand!=EQ_OP && operand!=NE_OP) && ! (v.is_int && v2.is_int)) - die ("Only == and != are supported for string values"); + die("Only == and != are supported for string values"); /* Now we overwrite the first variable with 0 or 1 (for false or true) */ @@ -6442,7 +6567,7 @@ int read_line(char *buf, int size) *p++= c; } } - die("The input buffer is too small for this query.x\n" \ + die("The input buffer is too small for this query.x\n" \ "check your query or increase MAX_QUERY and recompile"); DBUG_RETURN(0); } @@ -6675,6 +6800,12 @@ static struct my_option my_long_options[] = {"compress", 'C', "Use the compressed server/client protocol.", &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"continue-on-error", 0, + "Continue test even if we got an error. " + "This is mostly useful when testing a storage engine to see what from a test file it can execute, " + "or to find all syntax errors in a newly created big test file", + &opt_continue_on_error, &opt_continue_on_error, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"cursor-protocol", 0, "Use cursors for prepared statements.", &cursor_protocol, &cursor_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -7006,7 +7137,8 @@ int parse_args(int argc, char **argv) { /* Check that the result file exists */ if (result_file_name && access(result_file_name, F_OK) != 0) - die("The specified result file '%s' does not exist", result_file_name); + die("The specified result file '%s' does not exist", + result_file_name); } return 0; @@ -7333,8 +7465,8 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt, } if (error != MYSQL_NO_DATA) - die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: error: %d", - error); + die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: " + "error: %d", error); if (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA) die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: %d %s", mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); @@ -7481,6 +7613,22 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql) } +/* + Handle situation where query is sent but there is no active connection + (e.g directly after disconnect). + + We emulate MySQL-compatible behaviour of sending something on a closed + connection. +*/ +static void handle_no_active_connection(struct st_command *command, + struct st_connection *cn, DYNAMIC_STRING *ds) +{ + handle_error(command, 2006, "MySQL server has gone away", "000000", ds); + cn->pending= FALSE; + var_set_errno(2006); +} + + /* Run query using MySQL C API @@ -7507,11 +7655,7 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (!mysql) { - /* Emulate old behaviour of sending something on a closed connection */ - handle_error(command, 2006, "MySQL server has gone away", - "000000", ds); - cn->pending= FALSE; - var_set_errno(2006); + handle_no_active_connection(command, cn, ds); DBUG_VOID_RETURN; } @@ -7666,7 +7810,8 @@ static int match_expected_error(struct st_command *command, NULL is quite likely, but not in conjunction with a SQL-state expect! */ if (unlikely(err_sqlstate == NULL)) - die("expecting a SQL-state (%s) from query '%s' which cannot produce one...", + die("expecting a SQL-state (%s) from query '%s' which cannot " + "produce one...", command->expected_errors.err[i].code.sqlstate, command->query); if (strncmp(command->expected_errors.err[i].code.sqlstate, @@ -7720,7 +7865,11 @@ void handle_error(struct st_command *command, } if (command->abort_on_error) - die("query '%s' failed: %d: %s", command->query, err_errno, err_error); + { + report_or_die("query '%s' failed: %d: %s", command->query, err_errno, + err_error); + DBUG_VOID_RETURN; + } DBUG_PRINT("info", ("expected_errors.count: %d", command->expected_errors.count)); @@ -7766,13 +7915,15 @@ void handle_error(struct st_command *command, if (command->expected_errors.count > 0) { if (command->expected_errors.err[0].type == ERR_ERRNO) - die("query '%s' failed with wrong errno %d: '%s', instead of %d...", - command->query, err_errno, err_error, - command->expected_errors.err[0].code.errnum); + report_or_die("query '%s' failed with wrong errno %d: '%s', instead of " + "%d...", + command->query, err_errno, err_error, + command->expected_errors.err[0].code.errnum); else - die("query '%s' failed with wrong sqlstate %s: '%s', instead of %s...", - command->query, err_sqlstate, err_error, - command->expected_errors.err[0].code.sqlstate); + report_or_die("query '%s' failed with wrong sqlstate %s: '%s', " + "instead of %s...", + command->query, err_sqlstate, err_error, + command->expected_errors.err[0].code.sqlstate); } revert_properties(); @@ -7799,15 +7950,17 @@ void handle_no_error(struct st_command *command) command->expected_errors.err[0].code.errnum != 0) { /* Error code we wanted was != 0, i.e. not an expected success */ - die("query '%s' succeeded - should have failed with errno %d...", - command->query, command->expected_errors.err[0].code.errnum); + report_or_die("query '%s' succeeded - should have failed with errno %d...", + command->query, command->expected_errors.err[0].code.errnum); } else if (command->expected_errors.err[0].type == ERR_SQLSTATE && strcmp(command->expected_errors.err[0].code.sqlstate,"00000") != 0) { /* SQLSTATE we wanted was != "00000", i.e. not an expected success */ - die("query '%s' succeeded - should have failed with sqlstate %s...", - command->query, command->expected_errors.err[0].code.sqlstate); + report_or_die("query '%s' succeeded - should have failed with " + "sqlstate %s...", + command->query, + command->expected_errors.err[0].code.sqlstate); } DBUG_VOID_RETURN; } @@ -8105,10 +8258,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) DBUG_ENTER("run_query"); if (cn->pending && (flags & QUERY_SEND_FLAG)) - die ("Cannot run query on connection between send and reap"); + die("Cannot run query on connection between send and reap"); if (!(flags & QUERY_SEND_FLAG) && !cn->pending) - die ("Cannot reap on a connection without pending send"); + die("Cannot reap on a connection without pending send"); init_dynamic_string(&ds_warnings, NULL, 0, 256); ds_warn= &ds_warnings; @@ -8293,13 +8446,14 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) if (sp_created) { if (util_query(mysql, "DROP PROCEDURE mysqltest_tmp_sp ")) - die("Failed to drop sp: %d: %s", mysql_errno(mysql), mysql_error(mysql)); + report_or_die("Failed to drop sp: %d: %s", mysql_errno(mysql), + mysql_error(mysql)); } if (view_created) { if (util_query(mysql, "DROP VIEW mysqltest_tmp_v ")) - die("Failed to drop view: %d: %s", + report_or_die("Failed to drop view: %d: %s", mysql_errno(mysql), mysql_error(mysql)); } @@ -8463,9 +8617,10 @@ void get_command_type(struct st_command* command) else { /* -- "comment" that didn't contain a mysqltest command */ - die("Found line beginning with -- that didn't contain "\ - "a valid mysqltest command, check your syntax or "\ + report_or_die("Found line beginning with -- that didn't contain " \ + "a valid mysqltest command, check your syntax or " \ "use # if you intended to write a comment"); + command->type= Q_COMMENT; } } @@ -9190,7 +9345,7 @@ int main(int argc, char **argv) if (parsing_disabled == 0) parsing_disabled= 1; else - die("Parsing is already disabled"); + report_or_die("Parsing is already disabled"); break; case Q_ENABLE_PARSING: /* @@ -9200,7 +9355,7 @@ int main(int argc, char **argv) if (parsing_disabled == 1) parsing_disabled= 0; else - die("Parsing is already enabled"); + report_or_die("Parsing is already enabled"); break; case Q_DIE: /* Abort test with error code and error message */ @@ -9404,7 +9559,8 @@ void do_get_replace_column(struct st_command *command) if (!(column_number= atoi(to)) || column_number > MAX_COLUMNS) die("Wrong column number to replace_column in '%s'", command->query); if (!*from) - die("Wrong number of arguments to replace_column in '%s'", command->query); + die("Wrong number of arguments to replace_column in '%s'", + command->query); to= get_string(&buff, &from, command); my_free(replace_column[column_number-1]); replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE)); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake new file mode 100644 index 00000000000..8e70af6c5a9 --- /dev/null +++ b/cmake/cpack_rpm.cmake @@ -0,0 +1,129 @@ +IF(RPM) + +SET(CPACK_GENERATOR "RPM") +SET(CPACK_RPM_PACKAGE_DEBUG 1) +SET(INSTALL_LAYOUT "RPM") +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7) + +SET(CPACK_RPM_COMPONENT_INSTALL ON) + +SET(CPACK_COMPONENT_SERVER_GROUP "server") +SET(CPACK_COMPONENT_MANPAGESSERVER_GROUP "server") +SET(CPACK_COMPONENT_INIFILES_GROUP "server") +SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "server") +SET(CPACK_COMPONENT_SUPPORTFILES_GROUP "server") +SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "devel") +SET(CPACK_COMPONENT_MANPAGESDEVELOPMENT_GROUP "devel") +SET(CPACK_COMPONENT_TEST_GROUP "test") +SET(CPACK_COMPONENT_MANPAGESTEST_GROUP "test") +SET(CPACK_COMPONENT_CLIENT_GROUP "client") +SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client") +SET(CPACK_COMPONENT_README_GROUP "server") +SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared") +SET(CPACK_COMPONENT_COMMON_GROUP "common") +SET(CPACK_COMPONENT_COMPAT_GROUP "compat") +SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts + SupportFiles Development ManPagesDevelopment + ManPagesTest Readme ManPagesClient Test + Common Client SharedLibraries) + +SET(CPACK_RPM_PACKAGE_NAME "MariaDB") +SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") + +SET(CPACK_RPM_PACKAGE_RELEASE 1) # FIX: add distribution name here +SET(CPACK_RPM_PACKAGE_LICENSE "GPL") +SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) +SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") +SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org") +SET(CPACK_RPM_PACKAGE_SUMMARY "MariaDB: a very fast and robust SQL database server") +SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY} + +It is GPL v2 licensed, which means you can use the it free of charge under the +conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/). + +MariaDB documentation can be found at http://kb.askmonty.org/ +MariaDB bug reports should be submitted through https://mariadb.atlassian.net/ + +") + +SET(CPACK_RPM_SPEC_MORE_DEFINE " +%define mysql_vendor ${CPACK_PACKAGE_VENDOR} +%define mysqlversion ${MYSQL_NO_DASH_VERSION} +%define mysqldatadir /var/lib/mysql +%define mysqld_user mysql +%define mysqld_group mysql +") + +# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html +# both /etc and /etc/init.d should be ignored as of 2.8.7 +# only /etc/init.d as of 2.8.8 +# and eventually this hack should go away completely +SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE} +%define ignore \# +") + +SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common") + +SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d") + +SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client") +SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client") + +# this is a workaround for CPackRPM.cmake (as of 2.8.8) bug. +# If a package group does not specify OBSOLETES/REQUIRES the values of the +# previous (alphabetically) group will apply. +SET(CPACK_RPM_common_PACKAGE_OBSOLETES "MySQL-common") +SET(CPACK_RPM_common_PACKAGE_PROVIDES "MariaDB-common") + +SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-devel") +SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel") + +SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MySQL-server MySQL-OurDelta-server") +SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server") +SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) +SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh) +SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh) + +SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared") +SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION}) libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION})") +SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) +SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) + +SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test") +SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test") + +# workaround for lots of perl dependencies added by rpmbuild +SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_misc.pl)") + +# If we want to build build MariaDB-shared-compat, +# extract compat libraries from MariaDB-shared-5.3 rpm +FILE(GLOB compat_rpm RELATIVE ${CMAKE_SOURCE_DIR} + "${CMAKE_SOURCE_DIR}/../MariaDB-shared-5.3.*.rpm") +IF (compat_rpm) + MESSAGE("Using ${compat_rpm} to build MariaDB-compat") + INSTALL(CODE "EXECUTE_PROCESS( + COMMAND rpm2cpio ${CMAKE_SOURCE_DIR}/${compat_rpm} + COMMAND cpio --extract --make-directories */libmysqlclient*.so.* - + WORKING_DIRECTORY \$ENV{DESTDIR}) + EXECUTE_PROCESS( + COMMAND chmod -R a+rX . + WORKING_DIRECTORY \$ENV{DESTDIR})" + COMPONENT Compat) + SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} Compat) + + # RHEL6/CentOS6 install Postfix by default, and it requires + # libmysqlclient.so.16 that pulls in mysql-libs-5.1.x + # And the latter conflicts with our rpms. + # Make sure that for these distribuions all our rpms require + # MariaDB-compat, that will replace mysql-libs-5.1 + IF(RPM MATCHES "(rhel|centos)6") + SET(CPACK_RPM_common_PACKAGE_REQUIRES "MariaDB-compat") + ENDIF() +ENDIF(compat_rpm) + +SET(CPACK_RPM_compat_PACKAGE_REQUIRES "/bin/sh") # to mask CPACK_RPM_PACKAGE_REQUIRES +SET(CPACK_RPM_compat_PACKAGE_PROVIDES "mysql-libs = 5.3.5") # exact version doesn't matter as long as it greater than 5.1 +SET(CPACK_RPM_compat_PACKAGE_OBSOLETES "mysql-libs < 5.3.5") + +ENDIF(RPM) + diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 76e78e8b72f..3ad6da5d433 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -41,6 +41,7 @@ # - INSTALL_BINDIR (directory with client executables and scripts) # - INSTALL_SBINDIR (directory with mysqld) # - INSTALL_SCRIPTDIR (several scripts, rarely used) +# - INSTALL_SYSCONFDIR (config files. Usually /etc or nothing) # # - INSTALL_LIBDIR (directory with client end embedded libraries) # - INSTALL_PLUGINDIR (directory for plugins) @@ -60,23 +61,23 @@ # # - INSTALL_MYSQLDATADIR (data directory) # +# - INSTALL_UNIX_ADDRDIR (path to mysql.sock) +# # When changing this page, _please_ do not forget to update public Wiki # http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths IF(NOT INSTALL_LAYOUT) - SET(DEFAULT_INSTALL_LAYOUT "STANDALONE") + SET(INSTALL_LAYOUT "STANDALONE") ENDIF() -SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}" +SET(INSTALL_LAYOUT "${INSTALL_LAYOUT}" CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) RPM DEB SVR4") IF(UNIX) IF(INSTALL_LAYOUT MATCHES "RPM") SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT MATCHES "DEB") - SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}") - # This is required to avoid "cpack -GDEB" default of prefix=/usr - SET(CPACK_SET_DESTDIR ON) + SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT MATCHES "SVR4") SET(default_prefix "/opt/mysql/mysql") ELSE() @@ -92,10 +93,6 @@ IF(UNIX) MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." " Choose between ${VALID_INSTALL_LAYOUTS}" ) ENDIF() - - SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" - CACHE PATH "config directory (for my.cnf)") - MARK_AS_ADVANCED(SYSCONFDIR) ENDIF() # @@ -131,12 +128,14 @@ SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") SET(INSTALL_MYSQLDATADIR_STANDALONE "data") SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_STANDALONE "/tmp/mysql.sock") # # RPM layout # SET(INSTALL_BINDIR_RPM "bin") SET(INSTALL_SBINDIR_RPM "sbin") SET(INSTALL_SCRIPTDIR_RPM "bin") +SET(INSTALL_SYSCONFDIR_RPM "/etc") # IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") SET(INSTALL_LIBDIR_RPM "lib64") @@ -148,8 +147,8 @@ ENDIF() # SET(INSTALL_INCLUDEDIR_RPM "include/mysql") # -#SET(INSTALL_DOCDIR_RPM unset - installed directly by RPM) -#SET(INSTALL_DOCREADMEDIR_RPM unset - installed directly by RPM) +SET(INSTALL_DOCDIR_RPM "share/doc/${CPACK_SOURCE_PACKAGE_FILE_NAME}") +SET(INSTALL_DOCREADMEDIR_RPM "share/doc/${CPACK_SOURCE_PACKAGE_FILE_NAME}") SET(INSTALL_INFODIR_RPM "share/info") SET(INSTALL_MANDIR_RPM "share/man") # @@ -162,6 +161,8 @@ SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql") SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_RPM ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock") + # # DEB layout # @@ -188,6 +189,7 @@ SET(INSTALL_SUPPORTFILESDIR_DEB "support-files") SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") # # SVR4 layout # @@ -214,6 +216,7 @@ SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files") SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_SVR4 ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_SVR "/tmp/mysql.sock") # Clear cached variables if install layout was changed IF(OLD_INSTALL_LAYOUT) @@ -226,9 +229,14 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") # Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR # will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE # layout is chosen) -FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN - INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST) +FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF + INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST UNIX_ADDR) SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} CACHE STRING "${var} installation directory" ${FORCE}) MARK_AS_ADVANCED(INSTALL_${var}DIR) ENDFOREACH() + +IF(NOT MYSQL_UNIX_ADDR) + SET(MYSQL_UNIX_ADDR ${INSTALL_UNIX_ADDRDIR}) +ENDIF() + diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index cf9b1882715..9c9ab8cca3b 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -19,6 +19,15 @@ INCLUDE(CheckCCompilerFlag) MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS) SET(MY_MAINTAINER_WARNINGS "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing") + + CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers" + HAVE_NO_MISSING_FIELD_INITIALIZERS) + + IF (HAVE_NO_MISSING_FIELD_INITIALIZERS) + SET(MY_MAINTAINER_WARNINGS + "${MY_MAINTAINER_WARNINGS} -Wno-missing-field-initializers") + ENDIF() + CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAVE_DECLARATION_AFTER_STATEMENT) IF(HAVE_DECLARATION_AFTER_STATEMENT) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 5f60cb68101..e6b9d3e7edf 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -80,15 +80,10 @@ ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT) SET(MYSQL_TCP_PORT_DEFAULT "0") ENDIF() - -IF(NOT MYSQL_UNIX_ADDR) - SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock") -ENDIF() IF(NOT COMPILATION_COMMENT) SET(COMPILATION_COMMENT "Source distribution") ENDIF() - INCLUDE(package_name) IF(NOT CPACK_PACKAGE_FILE_NAME) GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME) @@ -104,7 +99,6 @@ ENDIF() SET(CPACK_PACKAGE_CONTACT "MariaDB team ") SET(CPACK_PACKAGE_VENDOR "Monty Program AB") SET(CPACK_SOURCE_GENERATOR "TGZ") -INCLUDE(cpack_source_ignore_files) # Defintions for windows version resources SET(PRODUCTNAME "MariaDB Server") @@ -126,10 +120,12 @@ ENDIF() IF(MSVC) # Tiny version is used to identify the build, it can be set with cmake -DTINY_VERSION= # to bzr revno for example (in the CI builds) - SET(TINY_VERSION "0" CACHE INTERNAL "") + IF(NOT TINY_VERSION) + SET(TINY_VERSION "0") + ENDIF() GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - + SET(FILETYPE VFT_APP) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) @@ -137,7 +133,7 @@ IF(MSVC) SET(FILETYPE VFT_DLL) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) - + FUNCTION(ADD_VERSION_INFO target target_type sources_var) IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE") SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index 9bc7d944da2..27afe679f25 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -23,6 +23,15 @@ # The below was used for really old versions of FreeBSD, roughly: before 5.1.9 # ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) +# Find libexecinfo (library that contains backtrace_symbols etc) +INCLUDE_DIRECTORIES(/usr/local/include) +SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} /usr/local/include ) +SET(ENV{LIB} "$ENV{LIB}:/usr/local/lib") +FIND_LIBRARY(EXECINFO NAMES execinfo) +IF(EXECINFO) + SET(LIBEXECINFO ${EXECINFO}) +ENDIF() + # Use atomic builtins IF(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 7952c351e2f..1e7f83ec227 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -211,15 +211,7 @@ MACRO(MYSQL_ADD_PLUGIN) SET(ARG_COMPONENT Server) ENDIF() MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT}) - INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug COMPONENT ${ARG_COMPONENT}) - # Add installed files to list for RPMs - FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files - "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n" - "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n") - # For internal testing in PB2, append collections files - IF(DEFINED ENV{PB2WORKDIR}) - PLUGIN_APPEND_COLLECTIONS(${plugin}) - ENDIF() + #INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug COMPONENT ${ARG_COMPONENT}) ELSE() IF(WITHOUT_${plugin}) # Update cache variable diff --git a/config.h.cmake b/config.h.cmake index d03ad91189c..5f1614993c3 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -150,6 +150,7 @@ #cmakedefine HAVE_FCNTL 1 #cmakedefine HAVE_FCONVERT 1 #cmakedefine HAVE_FDATASYNC 1 +#cmakedefine HAVE_DECL_FDATASYNC 1 #cmakedefine HAVE_FESETROUND 1 #cmakedefine HAVE_FINITE 1 #cmakedefine HAVE_FP_EXCEPT 1 diff --git a/configure.cmake b/configure.cmake index bf2a08386ab..6191ceef378 100644 --- a/configure.cmake +++ b/configure.cmake @@ -147,7 +147,7 @@ IF(UNIX) FIND_PACKAGE(Threads) SET(CMAKE_REQUIRED_LIBRARIES - ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) + ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO}) IF(CMAKE_REQUIRED_LIBRARIES) LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) diff --git a/dbug/tests.c b/dbug/tests.c index 657ed638a5a..22a445fdeca 100644 --- a/dbug/tests.c +++ b/dbug/tests.c @@ -36,7 +36,8 @@ int func1() DBUG_RETURN(10); } -int main (int argc, char *argv[]) +int main (int argc __attribute__((unused)), + char *argv[] __attribute__((unused))) { #ifdef DBUG_OFF return 1; diff --git a/debian/additions/mariadb.cnf b/debian/additions/mariadb.cnf index 6c2d812f0cc..e3803c4aaeb 100644 --- a/debian/additions/mariadb.cnf +++ b/debian/additions/mariadb.cnf @@ -3,7 +3,7 @@ [client] # Default is Latin1, if you need UTF-8 set this (also in server section) -#default-character-set = utf8 +#character-set-server = utf8 [mysqld] # @@ -11,7 +11,7 @@ # # Default is Latin1, if you need UTF-8 set all this (also in client section) # -#default-character-set = utf8 -#default-collation = utf8_general_ci +#character-set-server = utf8 +#collation-server = utf8_general_ci #character_set_server = utf8 #collation_server = utf8_general_ci diff --git a/debian/libmariadbclient-dev.files b/debian/libmariadbclient-dev.files index f75f049ec00..8f56a3065d5 100644 --- a/debian/libmariadbclient-dev.files +++ b/debian/libmariadbclient-dev.files @@ -1,6 +1,5 @@ usr/bin/mysql_config -usr/include/mysql/*.h -usr/include/mysql/psi/*.h +usr/include/mysql usr/lib/libmysqlclient.a usr/lib/libmysqlclient_r.a usr/lib/libmysqlservices.a diff --git a/debian/libmariadbclient-dev.links b/debian/libmariadbclient-dev.links index 0481d1a0020..0076791dcfa 100644 --- a/debian/libmariadbclient-dev.links +++ b/debian/libmariadbclient-dev.links @@ -1,2 +1,2 @@ -usr/lib/libmysqlclient.so.16 usr/lib/libmysqlclient.so -usr/lib/libmysqlclient_r.so.16 usr/lib/libmysqlclient_r.so +usr/lib/libmysqlclient.so.18 usr/lib/libmysqlclient.so +usr/lib/libmysqlclient_r.so.18 usr/lib/libmysqlclient_r.so diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index d7e6cf61983..f8f71b00743 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -72,7 +72,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") ENDIF() ENDIF() -MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Junk) +MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server) TARGET_LINK_LIBRARIES(replace mysys) IF(UNIX) MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) @@ -80,6 +80,6 @@ IF(UNIX) MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c) TARGET_LINK_LIBRARIES(resolve_stack_dump mysys) - MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c) + MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client) TARGET_LINK_LIBRARIES(mysql_waitpid mysys) ENDIF() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 3046c3f7614..a90238dbd42 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -14,17 +14,18 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA SET(HEADERS_GEN_CONFIGURE -${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h -${CMAKE_CURRENT_BINARY_DIR}/my_config.h -${CMAKE_CURRENT_BINARY_DIR}/mysqld_ername.h -${CMAKE_CURRENT_BINARY_DIR}/mysqld_error.h -${CMAKE_CURRENT_BINARY_DIR}/sql_state.h + mysql_version.h + my_config.h + mysqld_ername.h + mysqld_error.h + sql_state.h ) SET(HEADERS mysql.h mysql_com.h mysql_time.h + ma_dyncol.h my_list.h my_alloc.h typelib.h @@ -33,6 +34,7 @@ SET(HEADERS my_sys.h my_xml.h mysql_embed.h + my_decimal_limits.h my_pthread.h decimal.h errmsg.h @@ -49,8 +51,19 @@ SET(HEADERS m_ctype.h my_attribute.h my_compiler.h - ${HEADERS_GEN_CONFIGURE} ) INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development) +FOREACH(f ${HEADERS_GEN_CONFIGURE}) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) +ENDFOREACH(f) INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development FILES_MATCHING PATTERN "*.h") + +STRING(REPLACE "." "\\." EXCL_RE "${HEADERS};${HEADERS_GEN_CONFIGURE}") +STRING(REPLACE ";" "|" EXCL_RE "${EXCL_RE}") + +INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development + FILES_MATCHING PATTERN "*.h" + PATTERN CMakeFiles EXCLUDE + PATTERN mysql EXCLUDE + REGEX "\\./(${EXCL_RE}$)" EXCLUDE) diff --git a/include/maria.h b/include/maria.h index 404ce98dafd..cb2f92e8a35 100644 --- a/include/maria.h +++ b/include/maria.h @@ -24,7 +24,6 @@ extern "C" { #include #include #include -#include "../storage/maria/ma_pagecache.h" #include "my_compare.h" #include "ft_global.h" #include @@ -268,7 +267,6 @@ extern my_bool maria_flush, maria_single_user, maria_page_checksums; extern my_bool maria_delay_key_write; extern my_off_t maria_max_temp_length; extern ulong maria_bulk_insert_tree_size, maria_data_pointer_size; -extern PAGECACHE maria_pagecache_var, *maria_pagecache; extern MY_TMPDIR *maria_tmpdir; /* This is used to check if a symlink points into the mysql data home, @@ -353,69 +351,6 @@ typedef struct st_maria_bit_buff uint error; } MARIA_BIT_BUFF; - -typedef struct st_maria_sort_info -{ - /* sync things */ - mysql_mutex_t mutex; - mysql_cond_t cond; - MARIA_HA *info, *new_info; - HA_CHECK *param; - char *buff; - SORT_KEY_BLOCKS *key_block, *key_block_end; - SORT_FT_BUF *ft_buf; - my_off_t filelength, dupp, buff_length; - pgcache_page_no_t page; - ha_rows max_records; - uint current_key, total_keys; - uint got_error, threads_running; - myf myf_rw; - enum data_file_type new_data_file_type, org_data_file_type; -} MARIA_SORT_INFO; - -typedef struct st_maria_sort_param -{ - pthread_t thr; - IO_CACHE read_cache, tempfile, tempfile_for_exceptions; - DYNAMIC_ARRAY buffpek; - MARIA_BIT_BUFF bit_buff; /* For parallel repair of packrec. */ - - MARIA_KEYDEF *keyinfo; - MARIA_SORT_INFO *sort_info; - HA_KEYSEG *seg; - uchar **sort_keys; - uchar *rec_buff; - void *wordlist, *wordptr; - MEM_ROOT wordroot; - uchar *record; - MY_TMPDIR *tmpdir; - - /* - The next two are used to collect statistics, see maria_update_key_parts for - description. - */ - ulonglong unique[HA_MAX_KEY_SEG+1]; - ulonglong notnull[HA_MAX_KEY_SEG+1]; - - MARIA_RECORD_POS pos,max_pos,filepos,start_recpos, current_filepos; - uint key, key_length,real_key_length,sortbuff_size; - uint maxbuffers, keys, find_length, sort_keys_length; - my_bool fix_datafile, master; - my_bool calc_checksum; /* calculate table checksum */ - size_t rec_buff_size; - - int (*key_cmp)(struct st_maria_sort_param *, const void *, const void *); - int (*key_read)(struct st_maria_sort_param *, uchar *); - int (*key_write)(struct st_maria_sort_param *, const uchar *); - void (*lock_in_memory)(HA_CHECK *); - int (*write_keys)(struct st_maria_sort_param *, register uchar **, - uint , struct st_buffpek *, IO_CACHE *); - uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); - int (*write_key)(struct st_maria_sort_param *, IO_CACHE *,uchar *, - uint, uint); -} MARIA_SORT_PARAM; - - /* functions in maria_check */ void maria_chk_init(HA_CHECK *param); void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info); @@ -443,7 +378,6 @@ int maria_filecopy(HA_CHECK *param, File to, File from, my_off_t start, my_off_t length, const char *type); int maria_movepoint(MARIA_HA *info, uchar *record, my_off_t oldpos, my_off_t newpos, uint prot_key); -int maria_write_data_suffix(MARIA_SORT_INFO *sort_info, my_bool fix_datafile); int maria_test_if_almost_full(MARIA_HA *info); int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename); int maria_disable_indexes(MARIA_HA *info); @@ -456,10 +390,6 @@ my_bool maria_test_if_sort_rep(MARIA_HA *info, ha_rows rows, ulonglong key_map, int maria_init_bulk_insert(MARIA_HA *info, ulong cache_size, ha_rows rows); void maria_flush_bulk_insert(MARIA_HA *info, uint inx); void maria_end_bulk_insert(MARIA_HA *info); -int maria_assign_to_pagecache(MARIA_HA *info, ulonglong key_map, - PAGECACHE *key_cache); -void maria_change_pagecache(PAGECACHE *old_key_cache, - PAGECACHE *new_key_cache); int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves); void maria_versioning(MARIA_HA *info, my_bool versioning); void maria_ignore_trids(MARIA_HA *info); diff --git a/include/my_base.h b/include/my_base.h index 4edecf63d18..905e4535360 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - reserved +/* Copyright (c) 2000, 2012, 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,8 +10,9 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ + /* This file includes constants used with all databases */ @@ -459,10 +459,11 @@ enum ha_base_keytype { #define HA_ERR_INDEX_COL_TOO_LONG 178 /* Index column length exceeds limit */ #define HA_ERR_INDEX_CORRUPT 179 /* Index corrupted */ #define HA_ERR_UNDO_REC_TOO_BIG 180 /* Undo log record too big */ -#define HA_ERR_ROW_NOT_VISIBLE 181 -#define HA_ERR_ABORTED_BY_USER 182 -#define HA_ERR_DISK_FULL 183 -#define HA_ERR_LAST 183 /* Copy of last error nr */ +#define HA_ERR_TABLE_IN_FK_CHECK 181 /* Table being used in foreign key check */ +#define HA_ERR_ROW_NOT_VISIBLE 182 +#define HA_ERR_ABORTED_BY_USER 183 +#define HA_ERR_DISK_FULL 184 +#define HA_ERR_LAST 184 /* Copy of last error nr */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_global.h b/include/my_global.h index 8170ce381af..a5fa57dbfe3 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1429,6 +1429,10 @@ static inline char *dlerror(void) /* Length of decimal number represented by INT64. */ #define MY_INT64_NUM_DECIMAL_DIGITS 21 +#ifdef __cplusplus +#include /* should be included before min/max macros */ +#endif + /* Define some useful general macros (should be done after all headers). */ #if !defined(max) #define max(a, b) ((a) > (b) ? (a) : (b)) diff --git a/include/probes_mysql.h b/include/probes_mysql.h index cc47c59b62d..6d44b972cb3 100644 --- a/include/probes_mysql.h +++ b/include/probes_mysql.h @@ -18,28 +18,8 @@ #define PROBES_MYSQL_H - #if defined(HAVE_DTRACE) && !defined(DISABLE_DTRACE) - -#ifdef __linux__ -/* - On Linux, generated probes header may include C++ header - which conflicts with min and max macros from my_global.h . - To fix, temporarily undefine the macros. -*/ -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max -#endif - #include "probes_mysql_dtrace.h" - -#ifdef __linux__ -#pragma pop_macro("min") -#pragma pop_macro("max") -#endif - #else /* no dtrace */ #include "probes_mysql_nodtrace.h" #endif diff --git a/include/mysql/thread_pool_priv.h b/include/thread_pool_priv.h similarity index 100% rename from include/mysql/thread_pool_priv.h rename to include/thread_pool_priv.h diff --git a/include/violite.h b/include/violite.h index c8d459d931b..a026038bb0e 100644 --- a/include/violite.h +++ b/include/violite.h @@ -59,6 +59,9 @@ Vio* vio_new_win32shared_memory(HANDLE handle_file_map, #define HANDLE void * #endif /* __WIN__ */ +/* backport from 5.6 where it is part of PSI, not vio_*() */ +int mysql_socket_shutdown(my_socket mysql_socket, int how); + void vio_delete(Vio* vio); int vio_close(Vio* vio); void vio_reset(Vio* vio, enum enum_vio_type type, diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index f08159da20a..c40beb5f9a1 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -134,7 +134,7 @@ FOREACH(LIB ${LIBS}) ENDFOREACH() MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} - OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Embedded) + OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Development) # Visual Studio users need debug static library IF(MSVC) @@ -148,7 +148,7 @@ ENDIF() IF(NOT DISABLE_SHARED) MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${CLIENT_API_FUNCTIONS} - COMPONENT Embedded) + COMPONENT Server) IF(UNIX) # Name the shared library, handle versioning (provides same api as client # library hence the same version) diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index e607f3c685a..146e51d79c7 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -26,7 +26,7 @@ ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -UMYSQL_CLIENT) MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc ../../client/mysql.cc ../../client/readline.cc - COMPONENT Test) + COMPONENT Client) TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver) IF(UNIX) TARGET_LINK_LIBRARIES(mysql_embedded ${MY_READLINE_LIBRARY}) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 1ba54350883..b454fc0d2e0 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -344,6 +344,8 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) set_stmt_errmsg(stmt, net); DBUG_RETURN(1); } + else if (stmt->mysql->status == MYSQL_STATUS_GET_RESULT) + stmt->mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT; DBUG_RETURN(0); } diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 4987a5bee61..d7ef1fae0bf 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Monty Program 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 @@ -13,26 +13,26 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# Copy man pages -FILE(GLOB MAN1_FILES *.1) -FILE(GLOB MAN1_EXCLUDE make_win_bin_dist.1) -FILE(GLOB MAN1_NDB ndb*.1) -FILE(GLOB MAN8_FILES *.8) -FILE(GLOB MAN8_NDB ndb*.8) -IF(MAN1_FILES) - IF(MAN1_EXCLUDE) - LIST(REMOVE_ITEM MAN1_FILES ${MAN1_EXCLUDE}) - ENDIF() - IF(MAN1_NDB) - LIST(REMOVE_ITEM MAN1_FILES ${MAN1_NDB}) - ENDIF() - INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1 - COMPONENT ManPages) -ENDIF() -IF(MAN8_FILES) - IF(MAN8_NDB) - LIST(REMOVE_ITEM MAN8_FILES ${MAN8_NDB}) - ENDIF() - INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8 - COMPONENT ManPages) -ENDIF() +SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 + myisamlog.1 myisampack.1 mysql.server.1 + mysql_convert_table_format.1 mysql_fix_extensions.1 + mysql_fix_privilege_tables.1 mysql_install_db.1 + mysql_secure_installation.1 mysql_setpermission.1 + mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_zap.1 + mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1 + mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 + resolveip.1) +SET(MAN8_SERVER mysqld.8 mysqlmanager.8) +SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1 + mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1 + mysqldump.1 mysqlimport.1 mysqlshow.1 mysqlslap.1) +SET(MAN1_DEVEL mysql_config.1) +SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1 + mysqltest_embedded.1 mysql_client_test_embedded.1) + +INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer) +INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer) +INSTALL(FILES ${MAN1_CLIENT} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesClient) +INSTALL(FILES ${MAN1_DEVEL} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesDevelopment) +INSTALL(FILES ${MAN1_TEST} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesTest) + diff --git a/mysql-test/extra/rpl_tests/rpl_row_basic.test b/mysql-test/extra/rpl_tests/rpl_row_basic.test index 7812ff6339f..c7570de3aba 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_basic.test +++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test @@ -2,17 +2,19 @@ # Basic tests of row-level logging # ---disable_query_log ---disable_result_log -# Add suppression for expected warning(s) in error log -call mtr.add_suppression("Can't find record in 't.'"); ---enable_query_log ---enable_result_log - # # First we test tables with only an index. # +#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS +#Testing command counters -BEFORE +#Storing the before counts of Slave +connection slave; +let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1); +let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1); +let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1); +let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1); + connection master; eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ; SELECT * FROM t1; @@ -47,6 +49,32 @@ SELECT * FROM t1 ORDER BY C1,C2; sync_slave_with_master; SELECT * FROM t1 ORDER BY C1,C2; +#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS +#Testing command counters -AFTER +#Storing the after counts of Slave +connection slave; +let $slave_com_commit_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1); +let $slave_com_insert_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1); +let $slave_com_delete_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1); +let $slave_com_update_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1); + +#Commit count check +--let $assert_text= Counter for COM_COMMIT is consistent with the number of actual commits +--let $assert_cond= $slave_com_commit_after - $slave_com_commit_before = 4 +--source include/assert.inc +#Insert count check +--let $assert_text= Counter for COM_INSERT is consistent with the number of actual inserts +--let $assert_cond= $slave_com_insert_after - $slave_com_insert_before = 2 +--source include/assert.inc +#Delete count check +--let $assert_text= Counter for COM_DELETE is consistent with the number of actual deletes +--let $assert_cond= $slave_com_delete_after - $slave_com_delete_before = 1 +--source include/assert.inc +#Update count check +--let $assert_text= Counter for COM_UPDATE is consistent with the number of actual updates +--let $assert_cond= $slave_com_update_after - $slave_com_update_before = 1 +--source include/assert.inc + # Testing update with a condition that does not match any rows, but # which has a match for the index. connection master; diff --git a/mysql-test/include/have_32bit_ulong.inc b/mysql-test/include/have_32bit_ulong.inc deleted file mode 100644 index 0323b8a9888..00000000000 --- a/mysql-test/include/have_32bit_ulong.inc +++ /dev/null @@ -1,16 +0,0 @@ -# Created by Horst Hunger 2008-04-15 -# see also have_64bit_ulong.inc - ---disable_query_log ---disable_warnings -let $save = `SELECT @@pseudo_thread_id`; -SET @@pseudo_thread_id = 4294967296; -let $mach32 = `SELECT @@pseudo_thread_id <= 4294967295`; -eval SET @@pseudo_thread_id = $save; ---enable_warnings ---enable_query_log -if (!$mach32) -{ - skip Need a 32 bit unsigned long; -} - diff --git a/mysql-test/include/have_64bit_ulong.inc b/mysql-test/include/have_64bit_ulong.inc deleted file mode 100644 index 529ab225e4f..00000000000 --- a/mysql-test/include/have_64bit_ulong.inc +++ /dev/null @@ -1,14 +0,0 @@ -# Created by Horst Hunger 2008-04-15 -# see also have_32bit_ulong.inc - ---disable_query_log -let $save = `SELECT @@pseudo_thread_id`; -SET @@pseudo_thread_id = 4294967296; -let $mach64 = `SELECT @@pseudo_thread_id > 4294967295`; -eval SET @@pseudo_thread_id = $save; ---enable_query_log -if (!$mach64) -{ - skip Need a 64 unsigned long ; -} - diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc index e84b8622cdb..ffe8d7f1eb1 100644 --- a/mysql-test/include/icp_tests.inc +++ b/mysql-test/include/icp_tests.inc @@ -874,3 +874,21 @@ show status like "Handler_icp%"; DROP TABLE t1; +# +# MDEV-308 lp:1008516 - Failing assertion: templ->mysql_col_len == len +# +create table t1 (a int,b char(5),primary key (a), key (b(1))); +insert into t1 values ('a','b'); +select 1 from t1 where a and b >= 'aa'; +drop table t1; + +--echo # +--echo # Bug#58015 "Assert in row_sel_field_store_in_mysql_format +--echo # when running innodb_mrr_icp test" +--echo # + +create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b)); +insert into t1 values ('',1); +select 1 from t1 where b <= 1 and a <> ''; +drop table t1; + diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index fd695d1129f..ebe7af3641d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -78,7 +78,8 @@ BEGIN { use lib "lib"; -use Cwd; +use Cwd ; +use Cwd 'realpath'; use Getopt::Long; use My::File::Path; # Patched version of File::Path use File::Basename; @@ -163,11 +164,14 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG'}; my $DEFAULT_SUITES= join(',', map { "$_-" } qw( main + archive binlog + csv federated funcs_1 funcs_2 handler + heap innodb maria optimizer_unfixed_bugs @@ -226,7 +230,7 @@ my %opts_extern; sub using_extern { return (keys %opts_extern > 0);}; our $opt_fast= 0; -our $opt_force; +our $opt_force= 0; our $opt_mem= $ENV{'MTR_MEM'}; our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'}; @@ -1037,8 +1041,14 @@ sub ignore_option { # Setup any paths that are $opt_vardir related sub set_vardir { my ($vardir)= @_; - - $opt_vardir= $vardir; + if(IS_WINDOWS) + { + $opt_vardir= $vardir; + } + else + { + $opt_vardir= realpath($vardir); + } $path_vardir_trace= $opt_vardir; # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/... @@ -1126,7 +1136,7 @@ sub command_line_setup { 'defaults-extra-file=s' => \&collect_option, # Control what test suites or cases to run - 'force' => \$opt_force, + 'force+' => \$opt_force, 'with-ndbcluster-only' => \&collect_option, 'include-ndbcluster' => \$opt_include_ndbcluster, 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster, @@ -5846,6 +5856,11 @@ sub start_mysqltest ($) { mtr_add_arg($args, "%s", $_) for @args_saved; } + if ($opt_force > 1) + { + mtr_add_arg($args, "--continue-on-error"); + } + my $suite = $tinfo->{suite}; if ($suite->{parent}) { mtr_add_arg($args, "--overlay-dir=%s/", $suite->{dir}); @@ -6275,7 +6290,11 @@ Options to control directories to use Options to control what test suites or cases to run - force Continue to run the suite after failure + force Continue after a failure. When specified once, a + failure in a test file will abort this test file, and + the execution will continue from the next test file. + When specified twice, execution will continue executing + the failed test file from the next command. with-ndbcluster-only Run only tests that include "ndb" in the filename skip-ndb[cluster] Skip all tests that need cluster. Default. include-ndb[cluster] Enable all tests that need cluster diff --git a/mysql-test/r/aborted_clients.result b/mysql-test/r/aborted_clients.result new file mode 100644 index 00000000000..7111a0c98db --- /dev/null +++ b/mysql-test/r/aborted_clients.result @@ -0,0 +1,10 @@ +FLUSH STATUS; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients'; +VARIABLE_VALUE +0 +KILL CONNECTION_ID(); +ERROR 70100: Connection was killed +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients'; +VARIABLE_VALUE +1 +FLUSH STATUS; diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index d21e78428c5..30b4ff11227 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -516,3 +516,25 @@ pk 1 18446744073709551614 DROP TABLE t1; +CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk)); +insert into t1 values((1<<63)+1); +insert into t1 values(null); +select last_insert_id(); +last_insert_id() +9223372036854775810 +select * from t1; +pk +9223372036854775809 +9223372036854775810 +drop table t1; +CREATE TABLE t1 (pk BIGINT AUTO_INCREMENT, PRIMARY KEY (pk)); +insert into t1 values(-5); +insert into t1 values(null); +select last_insert_id(); +last_insert_id() +1 +select * from t1; +pk +-5 +1 +drop table t1; diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result new file mode 100644 index 00000000000..317070ca08e --- /dev/null +++ b/mysql-test/r/blackhole.result @@ -0,0 +1,11 @@ +# +# Bug #11880012: INDEX_SUBQUERY, BLACKHOLE, +# HANG IN PREPARING WITH 100% CPU USAGE +# +CREATE TABLE t1(a INT NOT NULL); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE TABLE t2 (a INT UNSIGNED, b INT, UNIQUE KEY (a, b)) ENGINE=BLACKHOLE; +SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2); +1 +DROP TABLE t1, t2; +End of 5.5 tests diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index a1eba2701f3..23417b16698 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -728,6 +728,15 @@ length(CONVERT(repeat('a',2048), CHAR(2049))) Warnings: Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated SET @@GLOBAL.max_allowed_packet=default; +# +# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET) +# +CREATE TABLE t1 (a VARCHAR(50)); +SELECT a FROM t1 +WHERE CAST(a as BINARY)=x'62736D697468' +AND CAST(a AS BINARY)=x'65736D697468'; +a +DROP TABLE t1; End of 5.1 tests select cast("2101-00-01 02:03:04" as datetime); cast("2101-00-01 02:03:04" as datetime) diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index a43a4d383ac..09eaf9855b0 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -257,3 +257,27 @@ connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO) DROP USER mysqltest_up1@'%'; DROP USER mysqltest_up2@'%'; +# +# BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore +# +create table t1 (via int); +alter table t1 add key(via); +drop table t1; +create table t1 (col1 int); +alter table t1 add via int not null; +drop table t1; +drop procedure if exists p1; +create procedure p1(x int) +foo: loop +if x = 0 then +leave foo; +end if; +select 'test'; +set x = x-1; +end loop foo| +call p1(2); +test +test +test +test +drop procedure p1; diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 32081c13376..86b95e94a81 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -2044,6 +2044,77 @@ a drop table t1,t2; set optimizer_switch=@save968720_optimizer_switch; # +# LP BUG#978847 Server crashes in Item_ref::real_item on +# INSERT .. SELECT with FROM subquery and derived_merge=ON +SET @save978847_optimizer_switch=@@optimizer_switch; +SET optimizer_switch = 'derived_merge=on'; +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES (2,1),(3,2); +select * from t1; +a b +2 1 +3 2 +INSERT INTO t1 SELECT * FROM +( SELECT * FROM t1 ) AS alias; +select * from t1; +a b +2 1 +3 2 +2 1 +3 2 +prepare stmt1 from 'INSERT INTO t1 SELECT SQL_BIG_RESULT * FROM + ( SELECT * FROM t1 ) AS alias'; +execute stmt1; +select * from t1; +a b +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +execute stmt1; +select * from t1; +a b +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +2 1 +3 2 +drop table t1; +set optimizer_switch=@save978847_optimizer_switch; +# +# LP bug998516 Server hangs on INSERT .. SELECT with derived_merge, +# FROM subquery, UNION +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (3),(4); +INSERT INTO t1 SELECT * FROM ( SELECT * FROM t1 ) AS alias UNION SELECT * FROM t2; +select * from t1; +a +1 +2 +1 +2 +3 +4 +drop table t1,t2; +# # end of 5.3 tests # set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 24ace7eb849..8560e6176c4 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -146,3 +146,17 @@ ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))' # # End Bug#57882 # +CREATE TABLE t1 (a INT); +CREATE TABLE t2(a INT PRIMARY KEY, b INT); +SELECT '' AS b FROM t1 GROUP BY VALUES(b); +ERROR 42S22: Unknown column '' in 'VALUES() function' +REPLACE t2(b) SELECT '' AS b FROM t1 GROUP BY VALUES(b); +ERROR 42S22: Unknown column '' in 'VALUES() function' +UPDATE t2 SET a=(SELECT '' AS b FROM t1 GROUP BY VALUES(b)); +ERROR 42S22: Unknown column '' in 'VALUES() function' +INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE +b=(SELECT '' AS b FROM t1 GROUP BY VALUES(b)); +ERROR 42S22: Unknown column '' in 'VALUES() function' +INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE +b=(SELECT VALUES(a)+2 FROM t1); +DROP TABLE t1, t2; diff --git a/mysql-test/r/flush-innodb.result b/mysql-test/r/flush-innodb.result new file mode 100644 index 00000000000..cea4f81e2a2 --- /dev/null +++ b/mysql-test/r/flush-innodb.result @@ -0,0 +1,5 @@ +FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT; +UNLOCK TABLES; +CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB; +INSERT INTO t1 VALUES ( REPEAT('i',1048576) ); +DROP TABLE t1; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 0f50f913ab3..c067ff02574 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -692,8 +692,10 @@ PREPARE stmt FROM WHERE t1.f1 GROUP BY t1.f1))'; EXECUTE stmt; 1 +1 EXECUTE stmt; 1 +1 DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result index 71f1c6faef0..00baa5f990a 100644 --- a/mysql-test/r/func_group_innodb.result +++ b/mysql-test/r/func_group_innodb.result @@ -146,6 +146,19 @@ count(*) min(7) max(7) 0 NULL NULL drop table t1m, t1i, t2m, t2i; # +# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN +# +CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT, +KEY(b, c, a(765))) ENGINE=INNODB; +INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0); +SELECT MIN(c) FROM t1 GROUP BY b; +MIN(c) +0 +EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range NULL b 263 NULL 4 Using index for group-by +DROP TABLE t1; +# # Bug #57954: BIT_AND function returns incorrect results when # semijoin=on CREATE TABLE c ( diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 3d5ca1805b7..c7f548ae2bc 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -217,3 +217,20 @@ foo Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' Warning 1292 Truncated incorrect DOUBLE value: 'a' +# +# LP bug#998321 Simple query with IF expression causes an +# assertion abort (see also mysql Bug#12620084) +# +SELECT if(0, (SELECT min('hello')), NULL); +if(0, (SELECT min('hello')), NULL) +NULL +SELECT if(1, (SELECT min('hello')), NULL); +if(1, (SELECT min('hello')), NULL) +hello +SELECT if(0, NULL, (SELECT min('hello'))); +if(0, NULL, (SELECT min('hello'))) +hello +SELECT if(1, NULL, (SELECT min('hello'))); +if(1, NULL, (SELECT min('hello'))) +NULL +End of 5.2 tests diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result index 1cd72d0c178..3b07be3930a 100644 --- a/mysql-test/r/gis-precise.result +++ b/mysql-test/r/gis-precise.result @@ -434,3 +434,21 @@ ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGON SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') ); ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19, 1 +select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3)); +ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3)) +POLYGON((3.999999999999999 6.999999999999998,4 7,3.999999999999999 6.999999999999998)) +SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, + -2.910427500435995 0.727606875108998, + -0.910427500435995 8.727606875108998, + 7.664100588675687 1.503849116986468, + 1.664100588675687 -2.496150883013531, + 0.0 -3.0 +))' ), 3 ))); +ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0, + -2.910427500435995 0.727606875108998, + -0.910427500435995 8.727606875108998, + 7.664100588675687 1.503849116986468, + 1.664100588675687 -2.496150883013531, + 0.0 -3.0 +))' ), +136 diff --git a/mysql-test/r/gis-rt-precise.result b/mysql-test/r/gis-rt-precise.result index 4519dcb6d19..3f4f014fb78 100644 --- a/mysql-test/r/gis-rt-precise.result +++ b/mysql-test/r/gis-rt-precise.result @@ -20,7 +20,17 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range g g 34 NULL 8 Using where SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); fid AsText(g) +1 LINESTRING(150 150,150 150) +3 LINESTRING(148 148,152 152) +4 LINESTRING(147 147,153 153) +5 LINESTRING(146 146,154 154) +6 LINESTRING(145 145,155 155) +7 LINESTRING(144 144,156 156) +8 LINESTRING(143 143,157 157) +9 LINESTRING(142 142,158 158) +10 LINESTRING(141 141,159 159) 11 LINESTRING(140 140,160 160) +2 LINESTRING(149 149,151 151) DROP TABLE t1; CREATE TABLE t1 ( fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -45,5 +55,8 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 40))')); fid AsText(g) +46 LINESTRING(51 41,60 50) +56 LINESTRING(41 41,50 50) +45 LINESTRING(51 51,60 60) DROP TABLE t1; End of 5.5 tests. diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result index a1c3f274ed3..26787366358 100644 --- a/mysql-test/r/gis-rtree.result +++ b/mysql-test/r/gis-rtree.result @@ -170,7 +170,17 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range g g 34 NULL 8 Using where SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); fid AsText(g) +1 LINESTRING(150 150,150 150) +3 LINESTRING(148 148,152 152) +4 LINESTRING(147 147,153 153) +5 LINESTRING(146 146,154 154) +6 LINESTRING(145 145,155 155) +7 LINESTRING(144 144,156 156) +8 LINESTRING(143 143,157 157) +9 LINESTRING(142 142,158 158) +10 LINESTRING(141 141,159 159) 11 LINESTRING(140 140,160 160) +2 LINESTRING(149 149,151 151) DROP TABLE t1; CREATE TABLE t2 ( fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -295,6 +305,10 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); fid AsText(g) +46 LINESTRING(51 41,60 50) +56 LINESTRING(41 41,50 50) +45 LINESTRING(51 51,60 60) +55 LINESTRING(41 51,50 60) DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))); SELECT count(*) FROM t2; count(*) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 83db8bf34af..ca48177b1b5 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1430,6 +1430,19 @@ count(*) DROP DATABASE gis_ogs; USE test; # +# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +# +SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); +ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) +NULL +# +# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +# GEOMETRY FUNCTION ARGUMENTS +# +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); +ERROR 22007: Illegal non geometric '' value found during parsing +End of 5.1 tests +# # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE # CREATE TABLE g1 diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index cffed9529d6..222977e5106 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1976,6 +1976,133 @@ Warning 1292 Truncated incorrect DOUBLE value: 'g' Warning 1292 Truncated incorrect DOUBLE value: 'v' SET SESSION SQL_MODE=default; drop table t1; +# +# LP bug#967242 Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE +# +CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('x'); +CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(4, 'd'),(8, 'g'),(3, 'x'),(3, 'f'), +(0, 'p'),(3, 'j'),(8, 'c'); +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +rand() + 1 > 0 OR +a = t2_1.c +GROUP BY zzz; +zzz +0 +3 +4 +8 +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +1 > 0 OR +a = t2_1.c +GROUP BY zzz; +zzz +0 +3 +4 +8 +SELECT t2_1.b as zzz +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +t2_1.b + 1 > 0 OR +a = t2_1.c +GROUP BY zzz; +zzz +0 +3 +4 +8 +SET @save_optimizer_switch967242=@@optimizer_switch; +SET optimizer_switch = 'in_to_exists=on'; +SELECT t2_1.b +FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2 +ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c ) +WHERE +( SELECT COUNT(*) FROM t2 ) IS NOT NULL +OR a = t2_1.c +GROUP BY t2_1.b; +b +0 +3 +4 +8 +SET optimizer_switch=@save_optimizer_switch967242; +drop table t1, t2; +# +# Bug#12578908: SELECT SQL_BUFFER_RESULT OUTPUTS TOO MANY +# ROWS WHEN GROUP IS OPTIMIZED AWAY +# +CREATE TABLE t1 (col1 int, col2 int) ; +INSERT INTO t1 VALUES (10,1),(11,7); +CREATE TABLE t2 (col1 int, col2 int) ; +INSERT INTO t2 VALUES (10,8); + +EXPLAIN SELECT SQL_BUFFER_RESULT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 system NULL NULL NULL NULL 1 Using temporary +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT SQL_BUFFER_RESULT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; +col2 +8 + +EXPLAIN SELECT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 system NULL NULL NULL NULL 1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; +col2 +8 + +DROP TABLE t1,t2; +# +# BUG#12640437: USING SQL_BUFFER_RESULT RESULTS IN A +# DIFFERENT QUERY OUTPUT +# +CREATE TABLE t1 ( +a int, +b varchar(1), +KEY (b,a) +); +INSERT INTO t1 VALUES (1,NULL),(0,'a'); + +EXPLAIN SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range b b 9 NULL 2 Using where; Using index for group-by; Using temporary + +SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; +MIN(a) b +0 a + +EXPLAIN SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range b b 9 NULL 2 Using where; Using index for group-by + +SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; +MIN(a) b +0 a + +DROP TABLE t1; +# +# LP bug#993726 Wrong result from a query with ALL subquery predicate in WHERE +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (0); +SELECT 1 FROM t1 WHERE 1 > ALL(SELECT 1 FROM t1 WHERE a!=0); +1 +1 +SELECT max(1) FROM t1 WHERE a!=0; +max(1) +NULL +drop table t1; # End of 5.2 tests # # lp:872702: Crash in add_ref_to_table_cond() when grouping by a PK diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result index dcea3c186b6..a415b12f92d 100644 --- a/mysql-test/r/handlersocket.result +++ b/mysql-test/r/handlersocket.result @@ -1,13 +1,14 @@ install plugin handlersocket soname 'handlersocket.so'; -select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'; +select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'; plugin_name handlersocket plugin_version 1.0 plugin_status ACTIVE plugin_type DAEMON plugin_library handlersocket.so -plugin_library_version 0.0 +plugin_library_version 1.3 plugin_author higuchi dot akira at dena dot jp -plugin_license -plugin_maturity Unknown -plugin_auth_version Unknown +plugin_description Direct access into InnoDB +plugin_license BSD +plugin_maturity Beta +plugin_auth_version 1.0 uninstall plugin handlersocket; diff --git a/mysql-test/r/in_datetime_241.result b/mysql-test/r/in_datetime_241.result new file mode 100644 index 00000000000..2c5b4bd8db1 --- /dev/null +++ b/mysql-test/r/in_datetime_241.result @@ -0,0 +1,5 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( a DATE ); +SELECT * FROM t1 WHERE ( SELECT a FROM t1 ) IN ('2012-04-25','2012-04-26'); +a +DROP TABLE t1; diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 50b0147b6ad..e5025acc998 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -745,4 +745,36 @@ WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref i,v i 5 const 2 Using where DROP TABLE t1; +# +# BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +pk int auto_increment, +zone_id int, +modified tinyint, +primary key(pk), +key (zone_id), +key (modified) +) engine=innodb; +insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D; +update t1 set zone_id=487, modified=9 where pk=7259; +update t1 set zone_id=487, modified=9 where pk=7260; +update t1 set zone_id=830, modified=9 where pk=8434; +update t1 set zone_id=830, modified=9 where pk=8435; +update t1 set zone_id=830, modified=9 where pk=8436; +update t1 set zone_id=830, modified=9 where pk=8437; +select * from t1 where t1.zone_id=830 AND modified=9; +pk zone_id modified +8434 830 9 +8435 830 9 +8436 830 9 +8437 830 9 +begin; +DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9; +commit; +select * from t1 where t1.zone_id=830 AND modified=9; +pk zone_id modified +drop table t0, t1; set optimizer_switch= @optimizer_switch_save; diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result index c1d3fa3445d..54ad9ecafad 100644 --- a/mysql-test/r/innodb_icp.result +++ b/mysql-test/r/innodb_icp.result @@ -835,6 +835,22 @@ Variable_name Value Handler_icp_attempts 2 Handler_icp_match 1 DROP TABLE t1; +create table t1 (a int,b char(5),primary key (a), key (b(1))); +insert into t1 values ('a','b'); +Warnings: +Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 +select 1 from t1 where a and b >= 'aa'; +1 +drop table t1; +# +# Bug#58015 "Assert in row_sel_field_store_in_mysql_format +# when running innodb_mrr_icp test" +# +create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b)); +insert into t1 values ('',1); +select 1 from t1 where b <= 1 and a <> ''; +1 +drop table t1; # # BUG#920132: Assert trx->n_active_thrs == 1 failed at que0que.c line 1050 # diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index 0892ce7794a..6471a2f8bbd 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -3221,7 +3221,7 @@ explain select t1.a, count(t2.p) as count from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index; Using temporary; Using filesort 1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan select t1.a, count(t2.p) as count from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a; @@ -4274,7 +4274,7 @@ pk int NOT NULL, i int NOT NULL, v varchar(1) NOT NULL, PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2 (v,i) ) COLLATE latin1_bin; INSERT INTO t1 VALUES -(10,8,'v'), (11,8,'f'), (12,5,'v'), (13,8,'s'), (14,8,'a'), +(10,8,'v'), (11,8,'f'), (13,8,'s'), (14,8,'a'), (15,6,'p'), (16,7,'z'), (17,2,'a'), (18,5,'h'), (19,7,'h'), (25,3,'m'), (26,5,'a'), (27,9,'n'), (28,1,'d'), (29,107,'a'); INSERT INTO t1 VALUES @@ -4327,7 +4327,7 @@ SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL idx1 NULL NULL NULL 20 Using temporary; Using filesort +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort 1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t2.v FROM t1, t2, t3 @@ -4345,9 +4345,9 @@ SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL idx1 NULL NULL NULL 20 Using temporary; Using filesort +1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort 1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 45 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join) SELECT t2.v FROM t1, t2, t3 WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100 GROUP BY t2.v ORDER BY t1.pk,t2.v; diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index ebe8255fd8b..f16b38772a6 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1855,6 +1855,30 @@ f1 f1 f2 DROP TABLE t1,t2; End of 5.1 tests # +# LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery +# predicate in WHERE condition. +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(9); +CREATE TABLE t2(b INT); +INSERT INTO t2 VALUES(8); +CREATE TABLE t3(c INT); +INSERT INTO t3 VALUES(3); +SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7); +b c +NULL 3 +SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7); +c b +3 NULL +SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7); +b c +NULL 3 +SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7); +c b +3 NULL +drop table t1,t2,t3; +End of 5.2 tests +# # LP bug #813447: LEFT JOIN with single-row inner table and # a subquery in ON expression # @@ -1872,7 +1896,7 @@ SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where 1 DROP TABLE t1,t2,t3; diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 3d0e4cbfc79..a4aaaf6085d 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1866,6 +1866,30 @@ f1 f1 f2 DROP TABLE t1,t2; End of 5.1 tests # +# LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery +# predicate in WHERE condition. +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(9); +CREATE TABLE t2(b INT); +INSERT INTO t2 VALUES(8); +CREATE TABLE t3(c INT); +INSERT INTO t3 VALUES(3); +SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7); +b c +NULL 3 +SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7); +c b +3 NULL +SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7); +b c +NULL 3 +SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7); +c b +3 NULL +drop table t1,t2,t3; +End of 5.2 tests +# # LP bug #813447: LEFT JOIN with single-row inner table and # a subquery in ON expression # @@ -1883,7 +1907,7 @@ SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 1 100.00 Using where -2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where 1 DROP TABLE t1,t2,t3; diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index f438a3884eb..1a6f8534cc2 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -320,22 +320,22 @@ TRUNCATE TABLE mysql.slow_log; CREATE TABLE t1 (a INT); CREATE TABLE t2 (b INT, PRIMARY KEY (b)); INSERT INTO t2 VALUES (3),(4); -INSERT INTO t1 VALUES (1+sleep(.01)),(2); -INSERT INTO t1 SELECT b+sleep(.01) from t2; -UPDATE t1 SET a=a+sleep(.01) WHERE a>2; -UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC; -UPDATE t2 set b=b+sleep(.01) limit 1; -UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2); -DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2; +INSERT INTO t1 VALUES (1+sleep(.02)),(2); +INSERT INTO t1 SELECT b+sleep(.02) from t2; +UPDATE t1 SET a=a+sleep(.02) WHERE a>2; +UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC; +UPDATE t2 set b=b+sleep(.02) limit 1; +UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2); +DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2; SELECT rows_examined,sql_text FROM mysql.slow_log; rows_examined sql_text -0 INSERT INTO t1 VALUES (1+sleep(.01)),(2) -2 INSERT INTO t1 SELECT b+sleep(.01) from t2 -4 UPDATE t1 SET a=a+sleep(.01) WHERE a>2 -8 UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC -1 UPDATE t2 set b=b+sleep(.01) limit 1 -4 UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2) -6 DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2 +0 INSERT INTO t1 VALUES (1+sleep(.02)),(2) +2 INSERT INTO t1 SELECT b+sleep(.02) from t2 +4 UPDATE t1 SET a=a+sleep(.02) WHERE a>2 +8 UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC +1 UPDATE t2 set b=b+sleep(.02) limit 1 +4 UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2) +6 DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2 DROP TABLE t1,t2; TRUNCATE TABLE mysql.slow_log; # end of bug#49756 diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result index a8355db55e0..bc7ebf9c439 100644 --- a/mysql-test/r/myisam_icp.result +++ b/mysql-test/r/myisam_icp.result @@ -165,7 +165,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY ts DESC LIMIT 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where DROP TABLE t1; # @@ -839,6 +839,22 @@ Variable_name Value Handler_icp_attempts 2 Handler_icp_match 1 DROP TABLE t1; +create table t1 (a int,b char(5),primary key (a), key (b(1))); +insert into t1 values ('a','b'); +Warnings: +Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 +select 1 from t1 where a and b >= 'aa'; +1 +drop table t1; +# +# Bug#58015 "Assert in row_sel_field_store_in_mysql_format +# when running innodb_mrr_icp test" +# +create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b)); +insert into t1 values ('',1); +select 1 from t1 where b <= 1 and a <> ''; +1 +drop table t1; drop table if exists t0, t1, t1i, t1m; # # BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed @@ -914,4 +930,23 @@ Warning 1292 Truncated incorrect DOUBLE value: 'c' Warning 1292 Truncated incorrect DOUBLE value: 'c' SET optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2,t3,t4; +# +# BUG#1000051: Query with simple join and ORDER BY takes thousands times longer when run with ICP +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, col int, filler char(100), key(a, col)); +insert into t1 select A.a + 10*B.a, 1234, 'filler' from t0 A, t0 B, t0 C; +set @tmp_10000051= @@optimizer_switch; +set optimizer_switch='mrr=off'; +# Must not use ICP: +explain select * from t1 where a between 5 and 8 order by a desc, col desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 5 NULL 39 Using where +set optimizer_switch= @tmp_10000051; +# Must not use ICP: +explain select * from t1 where a=3 and col > 500 order by a desc, col desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 10 NULL 10 Using where +drop table t0, t1; set optimizer_switch=@myisam_icp_tmp; diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result index 9defe1d6093..069c9182de2 100644 --- a/mysql-test/r/mysqlslap.result +++ b/mysql-test/r/mysqlslap.result @@ -241,3 +241,13 @@ mysql performance_schema test DROP DATABASE bug58090; +# +# Bug #11766072 - 59107: MYSQLSLAP CRASHES IF STARTED WITH NO ARGUMENTS ON WINDOWS +# +Benchmark + Average number of seconds to run all queries: TIME seconds + Minimum number of seconds to run all queries: TIME seconds + Maximum number of seconds to run all queries: TIME seconds + Number of clients running queries: 1 + Average number of queries per client: 0 + diff --git a/mysql-test/r/mysqltest_cont_on_error.result b/mysql-test/r/mysqltest_cont_on_error.result new file mode 100644 index 00000000000..eaa17028f8d --- /dev/null +++ b/mysql-test/r/mysqltest_cont_on_error.result @@ -0,0 +1,7 @@ +select error; +mysqltest: At line 1: query 'select error' failed: 1054: Unknown column 'error' in 'field list' +SELECT ERROR; +mysqltest: At line 1: query 'SELECT ERROR' failed: 1054: Unknown column 'ERROR' in 'field list' +SELECT 2; +2 +2 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index ce0926c6bc1..27131438d16 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3940,3 +3940,107 @@ Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 deallocate prepare st; drop table t1; +# +# LP bug#993459 Execution of PS for a query with GROUP BY +# returns wrong result (see also mysql bug#13805127) +# +PREPARE s1 FROM +" +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2 +"; + +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE @x = 1 +UNION +SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +c1 c2 count(c3) +2012-03-01 01:00:00 3 1 +2012-03-01 01:99345900:00 2 1 +2012-03-01 02:00:00 3 1 + +EXECUTE s1; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 + +SET @x = 2; +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE @x = 1 +UNION +SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:00:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 + +EXECUTE s1; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 + +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE @x = 1 +UNION +SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:00:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 + +EXECUTE s1; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 +DEALLOCATE PREPARE s1; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index d9cb2d99020..2dd89d0e4bb 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -442,9 +442,11 @@ show global variables like "query_cache_min_res_unit"; Variable_name Value query_cache_min_res_unit 4096 set GLOBAL query_cache_min_res_unit=1001; +Warnings: +Warning 1292 Truncated incorrect query_cache_min_res_unit value: '1001' show global variables like "query_cache_min_res_unit"; Variable_name Value -query_cache_min_res_unit 1008 +query_cache_min_res_unit 1000 create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index fead8c2b82b..1ffe2b86f70 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -75,18 +75,16 @@ connection default; set global read_only=1; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction unlock tables ; -send set global read_only=1; set global read_only=1; -connection con1; -select @@global.read_only; -@@global.read_only -0 -unlock tables ; select @@global.read_only; @@global.read_only 1 +connection con1; +select @@global.read_only; +@@global.read_only +1 +unlock tables ; connection default; -reap; connection default; set global read_only=0; BEGIN; diff --git a/mysql-test/r/read_only_innodb.result b/mysql-test/r/read_only_innodb.result index 45005b41da8..1e041395d3c 100644 --- a/mysql-test/r/read_only_innodb.result +++ b/mysql-test/r/read_only_innodb.result @@ -43,6 +43,15 @@ a 1 COMMIT; UNLOCK TABLES; +connection con1; +lock table t1 read; +connection default; +set global read_only=1; +connection con1; +unlock tables; +connection default; +SET GLOBAL read_only=0; +UNLOCK TABLES; DROP TABLE t1; DROP USER test@localhost; echo End of 5.1 tests diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 3533001ccec..30d5ca00bc0 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -5291,3 +5291,15 @@ DROP TABLE t1; DROP VIEW view_t1; # End of test BUG#63020 SET optimizer_switch=@save_optimizer_switch; +# +# LP bug#994275 Assertion `real->type() == Item::FIELD_ITEM' failed +# in add_not_null_conds(JOIN*) with JOIN, ZEROFILL column, PK +# +CREATE TABLE t1 ( a INT(6) ZEROFILL ); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 ( b INT PRIMARY KEY ); +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM t1, t2 WHERE a=3 AND a=b; +a b +drop table t1,t2; +End of 5.3 tests diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index a5416eb6718..a9c74afdd9c 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -5302,6 +5302,18 @@ DROP TABLE t1; DROP VIEW view_t1; # End of test BUG#63020 SET optimizer_switch=@save_optimizer_switch; +# +# LP bug#994275 Assertion `real->type() == Item::FIELD_ITEM' failed +# in add_not_null_conds(JOIN*) with JOIN, ZEROFILL column, PK +# +CREATE TABLE t1 ( a INT(6) ZEROFILL ); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 ( b INT PRIMARY KEY ); +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM t1, t2 WHERE a=3 AND a=b; +a b +drop table t1,t2; +End of 5.3 tests set join_cache_level=default; show variables like 'join_cache_level'; Variable_name Value diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index 3533001ccec..30d5ca00bc0 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -5291,3 +5291,15 @@ DROP TABLE t1; DROP VIEW view_t1; # End of test BUG#63020 SET optimizer_switch=@save_optimizer_switch; +# +# LP bug#994275 Assertion `real->type() == Item::FIELD_ITEM' failed +# in add_not_null_conds(JOIN*) with JOIN, ZEROFILL column, PK +# +CREATE TABLE t1 ( a INT(6) ZEROFILL ); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 ( b INT PRIMARY KEY ); +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM t1, t2 WHERE a=3 AND a=b; +a b +drop table t1,t2; +End of 5.3 tests diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index d52318c6c5b..05f9000bb33 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -7807,3 +7807,45 @@ Warnings: Error 1424 Recursive stored functions and triggers are not allowed. Error 1305 FUNCTION test.f1 does not exist DROP FUNCTION f1; +# ------------------------------------------------------------------ +# -- End of 5.1 tests +# ------------------------------------------------------------------ +# +# LP bug#993459 Execution of PS for a query with GROUP BY +# returns wrong result (see also mysql bug#13805127) +# +CREATE PROCEDURE p1(x INT UNSIGNED) +BEGIN +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE x = 1 +UNION +SELECT 2 FROM dual WHERE x = 1 OR x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:00:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2 +; +END| + +CALL p1(1); +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 +CALL p1(2); +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +CALL p1(1); +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 +DROP PROCEDURE p1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 29b8c41e515..235d211840f 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1320,7 +1320,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1330,7 +1330,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -3100,7 +3100,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -4585,7 +4585,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -5597,6 +5597,15 @@ SELECT 1 FROM ERROR 21000: Operand should contain 1 column(s) DROP TABLE t1; # +# Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY +# +CREATE TABLE t1(a TIME NOT NULL); +INSERT INTO t1 VALUES ('00:00:32'); +SELECT 1 FROM t1 WHERE a > +(SELECT timestamp(a) AS a FROM t1); +1 +DROP TABLE t1; +# # No BUG#, a case brought from 5.2's innodb_mysql_lock.test # create table t1 (i int not null primary key); @@ -5716,7 +5725,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6521,5 +6530,64 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; +# +# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table, +# HAVING, UNION in subquery +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (7),(0); +CREATE TABLE t2 (b INT); +EXPLAIN +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +f1 f2 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 82360f9fe9f..617d2e9e592 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -649,7 +649,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; not_in NULL @@ -671,7 +671,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; not_in NULL @@ -679,7 +679,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; not_in 1 @@ -687,7 +687,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; not_in NULL @@ -695,7 +695,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; not_in NULL @@ -703,7 +703,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; not_in NULL @@ -719,28 +719,28 @@ EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in; not_in NULL @@ -748,21 +748,21 @@ EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in; not_in NULL @@ -770,7 +770,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in; not_in 1 @@ -778,7 +778,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in; not_in NULL @@ -786,7 +786,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in; not_in NULL @@ -794,7 +794,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in; not_in NULL @@ -835,7 +835,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -857,7 +857,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -865,7 +865,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; not_in 1 @@ -873,7 +873,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; not_in NULL @@ -881,7 +881,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -889,7 +889,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -905,28 +905,28 @@ EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -934,21 +934,21 @@ EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10); f1 f2 EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -956,7 +956,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in; not_in 1 @@ -964,7 +964,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in; not_in NULL @@ -972,7 +972,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -980,7 +980,7 @@ EXPLAIN SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan +2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Rowid-ordered scan SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in; not_in NULL @@ -1233,7 +1233,7 @@ EXPLAIN SELECT i FROM t1 WHERE (1) NOT IN (SELECT i FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 index_subquery k k 5 const 2 Using index +2 SUBQUERY t2 index_subquery k k 5 const 2 Using index DROP TABLE t2; DROP TABLE t1; # @@ -1252,7 +1252,7 @@ GROUP BY f9; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9 @@ -1269,7 +1269,7 @@ ORDER BY f9; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where -3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT COUNT(f3) FROM t1 WHERE t2.f1) AS f9 @@ -1287,7 +1287,7 @@ GROUP BY f9; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT t2.f1 FROM t1 limit 1) AS f9 @@ -1304,7 +1304,7 @@ ORDER BY f9; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 SELECT COUNT(t2.f3), (SELECT t2.f1 FROM t1 limit 1) AS f9 @@ -1387,7 +1387,7 @@ EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used 4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1397,7 +1397,7 @@ EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v1 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used 4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1408,7 +1408,7 @@ EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED t1 system NULL NULL NULL NULL 1 4 UNION t2 system NULL NULL NULL NULL 1 NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1428,7 +1428,7 @@ EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v2 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED t1 system NULL NULL NULL NULL 1 4 UNION t2 system NULL NULL NULL NULL 1 NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1440,7 +1440,7 @@ EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used 4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1450,7 +1450,7 @@ EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v1 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used 4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1461,7 +1461,7 @@ EXPLAIN SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED t1 system NULL NULL NULL NULL 1 4 UNION t2 system NULL NULL NULL NULL 1 NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1471,7 +1471,7 @@ EXPLAIN SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED t1 system NULL NULL NULL NULL 1 4 UNION t2 system NULL NULL NULL NULL 1 NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1481,7 +1481,7 @@ EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v2 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY ALL NULL NULL NULL NULL 2 Using where 3 DERIVED t1 system NULL NULL NULL NULL 1 4 UNION t2 system NULL NULL NULL NULL 1 NULL UNION RESULT ALL NULL NULL NULL NULL NULL @@ -1632,8 +1632,8 @@ EXPLAIN SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 ref_or_null f10 f10 10 const,const 2 Using where; Using index +2 SUBQUERY t3 system NULL NULL NULL NULL 1 +2 SUBQUERY t2 ref_or_null f10 f10 10 const,const 2 Using where; Using index SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10); f4 drop table t1,t2,t3; @@ -2014,6 +2014,21 @@ ERROR 21000: Subquery returns more than 1 row DROP TABLE t2; ERROR 42S02: Unknown table 't2' DROP TABLE t1; +# +# LP BUG#1000649 EXPLAIN shows incorrectly a non-correlated constant IN subquery is correlated +# +create table ten (a int); +insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int); +insert into t1 select a,a,a from ten; +create table five (a int, b int, c int); +insert into five select a,a,a from ten limit 5; +set @@optimizer_switch='semijoin=on,in_to_exists=on,materialization=off'; +explain select * from t1 where 33 in (select b from five) or c > 11; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where +2 SUBQUERY five ALL NULL NULL NULL NULL 5 Using where +drop table ten, t1, five; set optimizer_switch=@subselect4_tmp; SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result index 60faea8853f..5ee56b25fee 100644 --- a/mysql-test/r/subselect_innodb.result +++ b/mysql-test/r/subselect_innodb.result @@ -259,6 +259,66 @@ Warnings: Warning 1292 Incorrect datetime value: '0' DROP TABLE t1; # +# Bug #11766300 59387: FAILING ASSERTION: CURSOR->POS_STATE == 1997660512 (BTR_PCUR_IS_POSITIONE +# +CREATE TABLE t1 (a INT) ENGINE=INNODB; +INSERT INTO t1 VALUES (0); +CREATE TABLE t2 (d BINARY(2), PRIMARY KEY (d(1)), UNIQUE KEY (d)) ENGINE=INNODB; +SELECT 1 FROM t1 WHERE NOT EXISTS +(SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d); +1 +1 +EXPLAIN SELECT 1 FROM t1 WHERE NOT EXISTS +(SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 Using where +2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY,d d 2 func 1 Using where +3 DEPENDENT SUBQUERY t2 index NULL d 2 NULL 1 Using where; Using index +DROP TABLE t2; +CREATE TABLE t2 (b INT, c INT, UNIQUE KEY (b), UNIQUE KEY (b, c )) ENGINE=INNODB; +INSERT INTO t2 VALUES (1, 1); +SELECT 1 FROM t1 +WHERE a != (SELECT 1 FROM t2 WHERE a <=> b OR a > '' AND 6 = 7 ORDER BY b, c); +1 +DROP TABLE t1, t2; +# +# Bug #13639204 64111: CRASH ON SELECT SUBQUERY WITH NON UNIQUE +# INDEX +# +CREATE TABLE t1 ( +id int +) ENGINE=InnoDB; +INSERT INTO t1 (id) VALUES (11); +CREATE TABLE t2 ( +t1_id int, +position int, +KEY t1_id (t1_id), +KEY t1_id_position (t1_id,position) +) ENGINE=InnoDB; +EXPLAIN SELECT +(SELECT position FROM t2 +WHERE t2.t1_id = t1.id +ORDER BY t2.t1_id , t2.position +LIMIT 10,1 +) AS maxkey +FROM t1 +LIMIT 1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 ref t1_id,t1_id_position t1_id_position 5 test.t1.id 1 Using where; Using index +SELECT +(SELECT position FROM t2 +WHERE t2.t1_id = t1.id +ORDER BY t2.t1_id , t2.position +LIMIT 10,1 +) AS maxkey +FROM t1 +LIMIT 1; +maxkey +NULL +DROP TABLE t1,t2; +End of 5.1 tests +# # lp:827416 Crash in select_describe() on EXPLAIN with DISTINCT in nested subqueries # CREATE TABLE t3 ( b int) ENGINE=InnoDB; @@ -316,4 +376,19 @@ GROUP BY 1 MAX( f1 ) NULL drop table t1, t2, t3; +# +# LP BUG#1006231 crash in select_describe +# +create table t1(a1 int) ENGINE=InnoDB; +insert into t1 values (1); +explain +select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 1 +2 SUBQUERY t1 ALL NULL NULL NULL NULL 1 +3 SUBQUERY t1 ALL NULL NULL NULL NULL 1 Using temporary; Using filesort +select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1)); +1 +1 +drop table t1; set optimizer_switch=@subselect_innodb_tmp; diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index 86442df1e8b..78472e99326 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -1163,7 +1163,7 @@ set @@optimizer_switch='materialization=off,in_to_exists=on'; explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); min(a1) NULL @@ -1182,7 +1182,7 @@ set @@optimizer_switch='materialization=off,in_to_exists=on'; explain select min(a1) from t1 where 7 in (select b1 from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select min(a1) from t1 where 7 in (select b1 from t2); min(a1) NULL @@ -1190,7 +1190,7 @@ NULL explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; min(a1) NULL @@ -1986,6 +1986,19 @@ y z DROP VIEW v2; DROP TABLE t1, t2; +# +# BUG#1000269: Wrong result (extra rows) with semijoin+materialization, IN subqueries, join_cache_level>0 +# +CREATE TABLE t1 (a1 VARCHAR(1), a2 VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('b','b'),('e','e'); +CREATE TABLE t2 (b1 VARCHAR(1), b2 VARCHAR(1), KEY(b1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('v','v'),('s','s'),('l','l'), ('y','y'),('c','c'),('i','i'); +SELECT * FROM t1, t2 WHERE b1 IN ( SELECT b2 FROM t2 WHERE b1 > 'o' ) AND ( b1 < 'l' OR a1 IN ('b','c') ); +a1 a2 b1 b2 +b b v v +b b s s +b b y y +DROP TABLE t1,t2; # This must be at the end: set optimizer_switch=@subselect_sj_mat_tmp; set join_cache_level=@save_join_cache_level; @@ -2234,7 +2247,7 @@ EXPLAIN EXTENDED SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL b 5 NULL 2 100.00 Using index -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1003 select max(`test`.`t1`.`b`) AS `max_res` from `test`.`t1` where <9>((9,(select `test`.`t2`.`a` from `test`.`t2` where (9 = `test`.`t2`.`a`)))) DROP TABLE t1,t2; diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result index 96f904c722c..ca4aa57417e 100644 --- a/mysql-test/r/subselect_mat_cost_bugs.result +++ b/mysql-test/r/subselect_mat_cost_bugs.result @@ -124,7 +124,7 @@ FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1 WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables SELECT t1.* FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1 WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 ); diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index e8086b53ead..b08148f8057 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -1327,7 +1327,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1337,7 +1337,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -3106,7 +3106,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -4529,13 +4529,13 @@ SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 select 1 AS `1` from `test`.`t1` where <1>((1,(select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` having (1 = (min(`test`.`t1`.`a`)))))) EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 select 1 AS `1` from `test`.`t1` where <1>((1,(select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = (min(`test`.`t1`.`a`)))))) SET join_cache_level=@save_join_cache_level; @@ -4587,7 +4587,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -5599,6 +5599,15 @@ SELECT 1 FROM ERROR 21000: Operand should contain 1 column(s) DROP TABLE t1; # +# Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY +# +CREATE TABLE t1(a TIME NOT NULL); +INSERT INTO t1 VALUES ('00:00:32'); +SELECT 1 FROM t1 WHERE a > +(SELECT timestamp(a) AS a FROM t1); +1 +DROP TABLE t1; +# # No BUG#, a case brought from 5.2's innodb_mysql_lock.test # create table t1 (i int not null primary key); @@ -5717,7 +5726,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6520,6 +6529,65 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; +# +# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table, +# HAVING, UNION in subquery +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (7),(0); +CREATE TABLE t2 (b INT); +EXPLAIN +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +f1 f2 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set optimizer_switch=default; diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 12b1e45c92c..36d03d8db77 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -1323,7 +1323,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1333,7 +1333,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -3102,7 +3102,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -4525,13 +4525,13 @@ SET join_cache_level=0; EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary Warnings: Note 1003 select 1 AS `1` from `test`.`t1` where (1,(select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a` having (1 = (min(`test`.`t1`.`a`))))) EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1003 select 1 AS `1` from `test`.`t1` where (1,(select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (1 = (min(`test`.`t1`.`a`))))) SET join_cache_level=@save_join_cache_level; @@ -4583,7 +4583,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -5595,6 +5595,15 @@ SELECT 1 FROM ERROR 21000: Operand should contain 1 column(s) DROP TABLE t1; # +# Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY +# +CREATE TABLE t1(a TIME NOT NULL); +INSERT INTO t1 VALUES ('00:00:32'); +SELECT 1 FROM t1 WHERE a > +(SELECT timestamp(a) AS a FROM t1); +1 +DROP TABLE t1; +# # No BUG#, a case brought from 5.2's innodb_mysql_lock.test # create table t1 (i int not null primary key); @@ -5713,7 +5722,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6516,6 +6525,65 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; +# +# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table, +# HAVING, UNION in subquery +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (7),(0); +CREATE TABLE t2 (b INT); +EXPLAIN +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +f1 f2 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index b9a4f9b23a9..7fcacfda470 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -1326,7 +1326,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1336,7 +1336,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -3106,7 +3106,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -4591,7 +4591,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -5603,6 +5603,15 @@ SELECT 1 FROM ERROR 21000: Operand should contain 1 column(s) DROP TABLE t1; # +# Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY +# +CREATE TABLE t1(a TIME NOT NULL); +INSERT INTO t1 VALUES ('00:00:32'); +SELECT 1 FROM t1 WHERE a > +(SELECT timestamp(a) AS a FROM t1); +1 +DROP TABLE t1; +# # No BUG#, a case brought from 5.2's innodb_mysql_lock.test # create table t1 (i int not null primary key); @@ -5722,7 +5731,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6527,6 +6536,65 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; +# +# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table, +# HAVING, UNION in subquery +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (7),(0); +CREATE TABLE t2 (b INT); +EXPLAIN +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +f1 f2 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set optimizer_switch=default; diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index ad6d61e9ec9..405261c9ec6 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -1323,7 +1323,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` INSERT INTO t1 (pseudo) VALUES ('test1'); @@ -1333,7 +1333,7 @@ SELECT 0 IN (SELECT 1 FROM t1 a); EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: Note 1003 select (0,(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)` drop table t1; @@ -3102,7 +3102,7 @@ ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY r eq_ref PRIMARY PRIMARY 4 const 1 Using where -2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition +2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; @@ -4583,7 +4583,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) FROM t1 WHERE a = 230; MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b) -NULL 0 +NULL NULL DROP TABLE t1, st1, st2; # # Bug #48709: Assertion failed in sql_select.cc:11782: @@ -5595,6 +5595,15 @@ SELECT 1 FROM ERROR 21000: Operand should contain 1 column(s) DROP TABLE t1; # +# Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY +# +CREATE TABLE t1(a TIME NOT NULL); +INSERT INTO t1 VALUES ('00:00:32'); +SELECT 1 FROM t1 WHERE a > +(SELECT timestamp(a) AS a FROM t1); +1 +DROP TABLE t1; +# # No BUG#, a case brought from 5.2's innodb_mysql_lock.test # create table t1 (i int not null primary key); @@ -5713,7 +5722,7 @@ WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where SELECT b FROM t1 WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a ) GROUP BY b; @@ -6516,6 +6525,65 @@ INSERT INTO t1 VALUES (1); SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 ); a drop table t1; +# +# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in +# main query and implicit grouping +# +CREATE TABLE t1 (f1 int) engine=MyISAM; +INSERT INTO t1 VALUES (7),(8); +CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM; +INSERT INTO t2 VALUES (3,'f'); +EXPLAIN +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 NULL +EXPLAIN +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 +SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +EXPLAIN +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 1 +EXPLAIN +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3; +COUNT(f1) f4 +0 0 +drop table t1,t2; +# +# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table, +# HAVING, UNION in subquery +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (7),(0); +CREATE TABLE t2 (b INT); +EXPLAIN +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7; +f1 f2 +drop table t1,t2; # return optimizer switch changed in the beginning of this test set optimizer_switch=@subselect_tmp; set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_partial_match.result b/mysql-test/r/subselect_partial_match.result index 4e37b831326..9dc2b44fd30 100644 --- a/mysql-test/r/subselect_partial_match.result +++ b/mysql-test/r/subselect_partial_match.result @@ -879,7 +879,7 @@ EXPLAIN SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2); c 0 @@ -888,7 +888,7 @@ EXPLAIN SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 2 -2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2); c 0 @@ -913,7 +913,7 @@ set @@optimizer_switch='in_to_exists=on,materialization=off'; EXPLAIN SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where +2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 ); f3 5 diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result index ca834b21df5..660137affec 100644 --- a/mysql-test/r/subselect_sj.result +++ b/mysql-test/r/subselect_sj.result @@ -2671,4 +2671,100 @@ a DEALLOCATE PREPARE pstmt; DROP VIEW v1; DROP TABLE t1, t2; +# +# BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF +# +set @tmp_jcl_978479= @@join_cache_level; +set join_cache_level=0; +set @tmp_os_978479= @@optimizer_switch; +set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off'; +# Part#1: make sure EXPLAIN is using LooseScan: +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES +(4,0),(6,8),(3,1),(5,8),(3,9),(2,4), +(2,6),(9,1),(5,4),(7,7),(5,4); +CREATE ALGORITHM=TEMPTABLE +VIEW v1 AS SELECT * FROM t1; +# This will use LooseScan: +EXPLAIN +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY ref key0 key0 5 test.t1_1.a 2 Start temporary +1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 Using where; End temporary +3 DERIVED t1 ALL NULL NULL NULL NULL 11 +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +a b a b +3 1 9 1 +5 8 4 0 +3 9 9 1 +2 4 6 8 +2 4 4 0 +2 6 6 8 +2 6 4 0 +5 4 4 0 +7 7 7 7 +5 4 4 0 +DROP VIEW v1; +DROP TABLE t1; +set @@join_cache_level= @tmp_jcl_978479; +set @@optimizer_switch= @tmp_os_978479; +# +# BUG#998236: Assertion failure or valgrind errors at best_access_path ... +# +CREATE TABLE t1 (a1 VARCHAR(3), a2 VARCHAR(35), KEY(a1,a2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('USA','Arvada'),('USA','Athens'),('USA','Atlanta'),('USA','Augusta'), +('USA','Aurora'),('USA','Aurora'),('USA','Austin'),('USA','Bakersfield'), +('USA','Baltimore'),('USA','Baton'),('USA','Beaumont'),('USA','Bellevue'), +('USA','Berkeley'),('USA','Billings'),('USA','Birmingham'),('USA','Boise'), +('USA','Boston'),('USA','Boulder'),('USA','Bridgeport'),('USA','Brockton'), +('USA','Brownsville'),('USA','Buffalo'),('USA','Burbank'),('USA','Cambridge'), +('USA','Cape'),('USA','Carrollton'),('USA','Carson'),('USA','Cary'), +('USA','Cedar'),('USA','Chandler'),('USA','Charleston'),('USA','Charlotte'), +('USA','Chattanooga'),('USA','Chesapeake'),('USA','Chicago'),('USA','Chula'), +('USA','Cincinnati'),('USA','Citrus'),('USA','Clarksville'),('USA','Clearwater'), +('USA','Cleveland'),('USA','Colorado'),('USA','Columbia'),('USA','Columbus'), +('USA','Columbus'),('USA','Compton'),('USA','Concord'),('USA','Coral'), +('USA','Corona'),('USA','Corpus'),('USA','Costa'),('USA','Dallas'),('USA','Daly'), +('USA','Davenport'),('USA','Dayton'),('USA','Denver'),('USA','DesMoines'), +('USA','Detroit'),('USA','Downey'),('USA','Durham'),('USA','East'),('USA','ElCajon'), +('USA','ElMonte'),('USA','ElPaso'),('USA','Elgin'),('USA','Elizabeth'), +('USA','Erie'),('USA','Escondido'),('USA','Eugene'),('USA','Evansville'), +('USA','Fairfield'),('USA','Fall'),('USA','Fayetteville'),('USA','Flint'), +('USA','Fontana'),('USA','FortCollins'),('USA','FortLauderdale'),('USA','FortWayne'), +('USA','FortWorth'),('USA','Fremont'),('USA','Fresno'),('USA','Fullerton'), +('USA','Gainesville'),('USA','GardenGrove'),('USA','Garland'),('USA','Gary'), +('USA','Gilbert'),('USA','Glendale'),('USA','Glendale'),('USA','GrandPrairie'), +('USA','GrandRapids'),('USA','Green Bay'),('USA','Greensboro'),('USA','Hampton'), +('USA','Hartford'),('USA','Hayward'),('USA','Henderson'),('USA','Hialeah'), +('USA','Inglewood'),('USA','Livonia'); +CREATE TABLE t3 (c1 VARCHAR(3), c2 VARCHAR(16), PRIMARY KEY (c1,c2)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('USA','Chinese'), ('USA','English'); +CREATE TABLE t2 (b1 INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1); +SELECT alias1.a1 AS field1 +FROM t1 AS alias1, t1 AS alias2 +WHERE alias1.a2 IN ( SELECT a1 FROM t1, t2 ) +AND alias1.a1 IS NULL +AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 ) +GROUP BY field1; +field1 +DROP TABLE t1,t3,t2; +# +# BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(7); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (4),(6); +SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b +FROM t2 +WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 ) +GROUP BY b +HAVING t1sum <> 1; +t1sum b +DROP TABLE t1, t2; set optimizer_switch=@subselect_sj_tmp; diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result index 19f3baac5f2..aa7ad59fda3 100644 --- a/mysql-test/r/subselect_sj_jcl6.result +++ b/mysql-test/r/subselect_sj_jcl6.result @@ -2685,6 +2685,102 @@ a DEALLOCATE PREPARE pstmt; DROP VIEW v1; DROP TABLE t1, t2; +# +# BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF +# +set @tmp_jcl_978479= @@join_cache_level; +set join_cache_level=0; +set @tmp_os_978479= @@optimizer_switch; +set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off'; +# Part#1: make sure EXPLAIN is using LooseScan: +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES +(4,0),(6,8),(3,1),(5,8),(3,9),(2,4), +(2,6),(9,1),(5,4),(7,7),(5,4); +CREATE ALGORITHM=TEMPTABLE +VIEW v1 AS SELECT * FROM t1; +# This will use LooseScan: +EXPLAIN +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where +1 PRIMARY ref key0 key0 5 test.t1_1.a 2 Start temporary +1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 Using where; End temporary +3 DERIVED t1 ALL NULL NULL NULL NULL 11 +SELECT * FROM t1 AS t1_1, t1 AS t1_2 +WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 ); +a b a b +3 1 9 1 +5 8 4 0 +3 9 9 1 +2 4 6 8 +2 4 4 0 +2 6 6 8 +2 6 4 0 +5 4 4 0 +7 7 7 7 +5 4 4 0 +DROP VIEW v1; +DROP TABLE t1; +set @@join_cache_level= @tmp_jcl_978479; +set @@optimizer_switch= @tmp_os_978479; +# +# BUG#998236: Assertion failure or valgrind errors at best_access_path ... +# +CREATE TABLE t1 (a1 VARCHAR(3), a2 VARCHAR(35), KEY(a1,a2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('USA','Arvada'),('USA','Athens'),('USA','Atlanta'),('USA','Augusta'), +('USA','Aurora'),('USA','Aurora'),('USA','Austin'),('USA','Bakersfield'), +('USA','Baltimore'),('USA','Baton'),('USA','Beaumont'),('USA','Bellevue'), +('USA','Berkeley'),('USA','Billings'),('USA','Birmingham'),('USA','Boise'), +('USA','Boston'),('USA','Boulder'),('USA','Bridgeport'),('USA','Brockton'), +('USA','Brownsville'),('USA','Buffalo'),('USA','Burbank'),('USA','Cambridge'), +('USA','Cape'),('USA','Carrollton'),('USA','Carson'),('USA','Cary'), +('USA','Cedar'),('USA','Chandler'),('USA','Charleston'),('USA','Charlotte'), +('USA','Chattanooga'),('USA','Chesapeake'),('USA','Chicago'),('USA','Chula'), +('USA','Cincinnati'),('USA','Citrus'),('USA','Clarksville'),('USA','Clearwater'), +('USA','Cleveland'),('USA','Colorado'),('USA','Columbia'),('USA','Columbus'), +('USA','Columbus'),('USA','Compton'),('USA','Concord'),('USA','Coral'), +('USA','Corona'),('USA','Corpus'),('USA','Costa'),('USA','Dallas'),('USA','Daly'), +('USA','Davenport'),('USA','Dayton'),('USA','Denver'),('USA','DesMoines'), +('USA','Detroit'),('USA','Downey'),('USA','Durham'),('USA','East'),('USA','ElCajon'), +('USA','ElMonte'),('USA','ElPaso'),('USA','Elgin'),('USA','Elizabeth'), +('USA','Erie'),('USA','Escondido'),('USA','Eugene'),('USA','Evansville'), +('USA','Fairfield'),('USA','Fall'),('USA','Fayetteville'),('USA','Flint'), +('USA','Fontana'),('USA','FortCollins'),('USA','FortLauderdale'),('USA','FortWayne'), +('USA','FortWorth'),('USA','Fremont'),('USA','Fresno'),('USA','Fullerton'), +('USA','Gainesville'),('USA','GardenGrove'),('USA','Garland'),('USA','Gary'), +('USA','Gilbert'),('USA','Glendale'),('USA','Glendale'),('USA','GrandPrairie'), +('USA','GrandRapids'),('USA','Green Bay'),('USA','Greensboro'),('USA','Hampton'), +('USA','Hartford'),('USA','Hayward'),('USA','Henderson'),('USA','Hialeah'), +('USA','Inglewood'),('USA','Livonia'); +CREATE TABLE t3 (c1 VARCHAR(3), c2 VARCHAR(16), PRIMARY KEY (c1,c2)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('USA','Chinese'), ('USA','English'); +CREATE TABLE t2 (b1 INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1); +SELECT alias1.a1 AS field1 +FROM t1 AS alias1, t1 AS alias2 +WHERE alias1.a2 IN ( SELECT a1 FROM t1, t2 ) +AND alias1.a1 IS NULL +AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 ) +GROUP BY field1; +field1 +DROP TABLE t1,t3,t2; +# +# BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(7); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (4),(6); +SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b +FROM t2 +WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 ) +GROUP BY b +HAVING t1sum <> 1; +t1sum b +DROP TABLE t1, t2; set optimizer_switch=@subselect_sj_tmp; # # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index dc1d9b407fd..e3f73d3993b 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -1198,7 +1198,7 @@ set @@optimizer_switch='materialization=off,in_to_exists=on'; explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found +2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1); min(a1) NULL @@ -1207,7 +1207,7 @@ set @@optimizer_switch='semijoin=off'; explain select min(a1) from t1 where 7 in (select b1 from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select min(a1) from t1 where 7 in (select b1 from t2); min(a1) NULL @@ -1224,7 +1224,7 @@ NULL explain select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system NULL NULL NULL NULL 1 -2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4; min(a1) NULL @@ -2026,6 +2026,19 @@ y z DROP VIEW v2; DROP TABLE t1, t2; +# +# BUG#1000269: Wrong result (extra rows) with semijoin+materialization, IN subqueries, join_cache_level>0 +# +CREATE TABLE t1 (a1 VARCHAR(1), a2 VARCHAR(1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('b','b'),('e','e'); +CREATE TABLE t2 (b1 VARCHAR(1), b2 VARCHAR(1), KEY(b1)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('v','v'),('s','s'),('l','l'), ('y','y'),('c','c'),('i','i'); +SELECT * FROM t1, t2 WHERE b1 IN ( SELECT b2 FROM t2 WHERE b1 > 'o' ) AND ( b1 < 'l' OR a1 IN ('b','c') ); +a1 a2 b1 b2 +b b v v +b b s s +b b y y +DROP TABLE t1,t2; # This must be at the end: set optimizer_switch=@subselect_sj_mat_tmp; set join_cache_level=@save_join_cache_level; diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 69cd9792299..63b3304641b 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -570,6 +570,27 @@ id select_type table type possible_keys key key_len ref rows Extra # as that violates the "no interleaving of outer join nests" rule. DROP TABLE t1,t2,t3,t4,t5; # +# BUG#997747: Assertion `join->best_read < ((double)1.79..5e+308L)' +# failed in greedy_search with LEFT JOINs and unique keys +# +CREATE TABLE t1 (a1 INT); +CREATE TABLE t2 (b1 INT); +CREATE TABLE t3 (c1 INT, UNIQUE KEY(c1)); +CREATE TABLE t4 (d1 INT, UNIQUE KEY(d1)); +CREATE TABLE t5 (e1 INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (2),(3); +INSERT INTO t3 VALUES (3),(4); +INSERT INTO t4 VALUES (4),(5); +INSERT INTO t5 VALUES (5),(6); +SELECT a1 FROM t1 LEFT JOIN t2 LEFT JOIN t3 LEFT JOIN t4 +ON c1 = d1 ON d1 = b1 ON a1 = b1 +LEFT JOIN t5 ON a1 = e1 ; +a1 +1 +2 +DROP TABLE t1,t2,t3,t4,t5; +# # BUG#884184: Wrong result with RIGHT JOIN + derived_merge # CREATE TABLE t1 (a int(11), b varchar(1)) ; diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 8d069477f3e..41f590400ea 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -21,6 +21,12 @@ name cdate note name1 1998-01-01 note01 name2 1998-01-01 note01 drop table t1,t2; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1); +SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL; +a +1 +DROP TABLE t1; CREATE TABLE t1 ( datum DATE ); INSERT INTO t1 VALUES ( "2000-1-1" ); INSERT INTO t1 VALUES ( "2000-1-2" ); @@ -333,3 +339,17 @@ select @a; @a 0111-01-01 # +# +# BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed +# +create table t1(a date,key(a)); +insert into t1 values ('2012-01-01'),('2012-02-02'); +explain +select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1_0 ref a a 4 const 0 Using where; Using index +1 SIMPLE t2 index NULL a 4 NULL 2 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t1 index NULL a 4 NULL 2 Using index; Using join buffer (incremental, BNL join) +select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1; +1 +drop table t1; diff --git a/mysql-test/r/update_ignore_216.result b/mysql-test/r/update_ignore_216.result new file mode 100644 index 00000000000..4abc1eae06e --- /dev/null +++ b/mysql-test/r/update_ignore_216.result @@ -0,0 +1,9 @@ +CREATE TABLE t1 ( a INT, b CHAR(3) ); +INSERT INTO t1 VALUES ( 1, 'foo' ); +CREATE TABLE t2 ( c CHAR(3), d INT ); +INSERT INTO t2 VALUES ( 'foo', 1 ); +UPDATE IGNORE t1, t2 SET b = 'bar', c = 'bar' + WHERE a != ( SELECT 1 UNION SELECT 2 ); +Warnings: +Warning 1242 Subquery returns more than 1 row +DROP TABLE t1, t2; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 3bf8a6a7126..accb88b7f15 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -485,4 +485,10 @@ f1 f2 1 4 DROP TRIGGER trg1; DROP TABLE t1; +# +# Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT +# SAME USER VARIABLE = CRASH +# +SET @bug12408412=1; +SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; End of 5.5 tests diff --git a/mysql-test/r/archive-big.result b/mysql-test/suite/archive/archive-big.result similarity index 100% rename from mysql-test/r/archive-big.result rename to mysql-test/suite/archive/archive-big.result diff --git a/mysql-test/t/archive-big.test b/mysql-test/suite/archive/archive-big.test similarity index 100% rename from mysql-test/t/archive-big.test rename to mysql-test/suite/archive/archive-big.test diff --git a/mysql-test/r/archive.result b/mysql-test/suite/archive/archive.result similarity index 100% rename from mysql-test/r/archive.result rename to mysql-test/suite/archive/archive.result diff --git a/mysql-test/t/archive.test b/mysql-test/suite/archive/archive.test similarity index 100% rename from mysql-test/t/archive.test rename to mysql-test/suite/archive/archive.test diff --git a/mysql-test/r/archive_bitfield.result b/mysql-test/suite/archive/archive_bitfield.result similarity index 100% rename from mysql-test/r/archive_bitfield.result rename to mysql-test/suite/archive/archive_bitfield.result diff --git a/mysql-test/t/archive_bitfield.test b/mysql-test/suite/archive/archive_bitfield.test similarity index 100% rename from mysql-test/t/archive_bitfield.test rename to mysql-test/suite/archive/archive_bitfield.test diff --git a/mysql-test/r/archive_debug.result b/mysql-test/suite/archive/archive_debug.result similarity index 100% rename from mysql-test/r/archive_debug.result rename to mysql-test/suite/archive/archive_debug.result diff --git a/mysql-test/t/archive_debug.test b/mysql-test/suite/archive/archive_debug.test similarity index 100% rename from mysql-test/t/archive_debug.test rename to mysql-test/suite/archive/archive_debug.test diff --git a/mysql-test/r/archive_gis.result b/mysql-test/suite/archive/archive_gis.result similarity index 100% rename from mysql-test/r/archive_gis.result rename to mysql-test/suite/archive/archive_gis.result diff --git a/mysql-test/t/archive_gis.test b/mysql-test/suite/archive/archive_gis.test similarity index 100% rename from mysql-test/t/archive_gis.test rename to mysql-test/suite/archive/archive_gis.test diff --git a/mysql-test/r/archive_plugin.result b/mysql-test/suite/archive/archive_plugin.result similarity index 100% rename from mysql-test/r/archive_plugin.result rename to mysql-test/suite/archive/archive_plugin.result diff --git a/mysql-test/t/archive_plugin.test b/mysql-test/suite/archive/archive_plugin.test similarity index 100% rename from mysql-test/t/archive_plugin.test rename to mysql-test/suite/archive/archive_plugin.test diff --git a/mysql-test/r/mysqlhotcopy_archive.result b/mysql-test/suite/archive/mysqlhotcopy_archive.result similarity index 100% rename from mysql-test/r/mysqlhotcopy_archive.result rename to mysql-test/suite/archive/mysqlhotcopy_archive.result diff --git a/mysql-test/t/mysqlhotcopy_archive.test b/mysql-test/suite/archive/mysqlhotcopy_archive.test similarity index 100% rename from mysql-test/t/mysqlhotcopy_archive.test rename to mysql-test/suite/archive/mysqlhotcopy_archive.test diff --git a/mysql-test/r/partition_archive.result b/mysql-test/suite/archive/partition_archive.result similarity index 100% rename from mysql-test/r/partition_archive.result rename to mysql-test/suite/archive/partition_archive.result diff --git a/mysql-test/t/partition_archive.test b/mysql-test/suite/archive/partition_archive.test similarity index 100% rename from mysql-test/t/partition_archive.test rename to mysql-test/suite/archive/partition_archive.test diff --git a/mysql-test/suite/archive/suite.pm b/mysql-test/suite/archive/suite.pm new file mode 100644 index 00000000000..eb2ff9f8e26 --- /dev/null +++ b/mysql-test/suite/archive/suite.pm @@ -0,0 +1,9 @@ +package My::Suite::Archive; + +@ISA = qw(My::Suite); + +return ("Need Archive engine" unless $ENV{HA_ARCHIVE_SO} or + $::mysqld_variables{'archive'} eq "ON"); + +bless { }; + diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 2f994e9f5fc..2cc1ebdd2d7 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -2678,6 +2678,8 @@ CREATE TABLE replace_table (a INT, b INT, PRIMARY KEY(a)); INSERT INTO replace_table values (1,1),(2,2); CREATE TABLE update_table (a INT, b INT, PRIMARY KEY(a)); INSERT INTO update_table values (1,1),(2,2); +CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY); +INSERT INTO insert_2_keys values (1, 1); INSERT IGNORE INTO insert_table SELECT * FROM filler_table; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave. @@ -2701,10 +2703,15 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc CREATE TEMPORARY TABLE temp1 (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * FROM filler_table; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave. +INSERT INTO insert_2_keys VALUES (1, 2) +ON DUPLICATE KEY UPDATE a=VALUES(a)+10, b=VALUES(b)+10; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe DROP TABLE filler_table; DROP TABLE insert_table; DROP TABLE update_table; DROP TABLE replace_table; DROP TABLE create_ignore_test; DROP TABLE create_replace_test; +DROP TABLE insert_2_keys; "End of tests" diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index 3353855fd0c..2de84a58875 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -17,6 +17,7 @@ # - CREATE TABLE [IGNORE/REPLACE] SELECT # - INSERT IGNORE...SELECT # - UPDATE IGNORE +# - INSERT... ON DUPLICATE KEY UPDATE on a table with two UNIQUE KEYS # # Note that statements that use stored functions, stored procedures, # triggers, views, or prepared statements that invoke unsafe @@ -715,6 +716,9 @@ DROP TABLE t1; #UPDATE IGNORE #CREATE TABLE... IGNORE SELECT #CREATE TABLE... REPLACE SELECT +# +###BUG 11765650 - 58637: MARK UPDATES THAT DEPEND ON ORDER OF TWO KEYS UNSAFE +#INSERT.... ON DUP KEY UPDATE on a table with more than one UNIQUE KEY #setup tables CREATE TABLE filler_table (a INT, b INT); @@ -724,6 +728,8 @@ CREATE TABLE replace_table (a INT, b INT, PRIMARY KEY(a)); INSERT INTO replace_table values (1,1),(2,2); CREATE TABLE update_table (a INT, b INT, PRIMARY KEY(a)); INSERT INTO update_table values (1,1),(2,2); +CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY); +INSERT INTO insert_2_keys values (1, 1); #INSERT IGNORE... SELECT INSERT IGNORE INTO insert_table SELECT * FROM filler_table; @@ -741,6 +747,10 @@ CREATE TABLE create_replace_test (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * #temporary tables should not throw the warning. CREATE TEMPORARY TABLE temp1 (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * FROM filler_table; +#INSERT.... ON DUP KEY UPDATE on a table with more than one UNIQUE KEY +INSERT INTO insert_2_keys VALUES (1, 2) + ON DUPLICATE KEY UPDATE a=VALUES(a)+10, b=VALUES(b)+10; + ###clean up DROP TABLE filler_table; DROP TABLE insert_table; @@ -748,5 +758,6 @@ DROP TABLE update_table; DROP TABLE replace_table; DROP TABLE create_ignore_test; DROP TABLE create_replace_test; +DROP TABLE insert_2_keys; --echo "End of tests" diff --git a/mysql-test/r/csv.result b/mysql-test/suite/csv/csv.result similarity index 100% rename from mysql-test/r/csv.result rename to mysql-test/suite/csv/csv.result diff --git a/mysql-test/t/csv.test b/mysql-test/suite/csv/csv.test similarity index 100% rename from mysql-test/t/csv.test rename to mysql-test/suite/csv/csv.test diff --git a/mysql-test/r/csv_alter_table.result b/mysql-test/suite/csv/csv_alter_table.result similarity index 100% rename from mysql-test/r/csv_alter_table.result rename to mysql-test/suite/csv/csv_alter_table.result diff --git a/mysql-test/t/csv_alter_table.test b/mysql-test/suite/csv/csv_alter_table.test similarity index 100% rename from mysql-test/t/csv_alter_table.test rename to mysql-test/suite/csv/csv_alter_table.test diff --git a/mysql-test/r/csv_not_null.result b/mysql-test/suite/csv/csv_not_null.result similarity index 100% rename from mysql-test/r/csv_not_null.result rename to mysql-test/suite/csv/csv_not_null.result diff --git a/mysql-test/t/csv_not_null.test b/mysql-test/suite/csv/csv_not_null.test similarity index 100% rename from mysql-test/t/csv_not_null.test rename to mysql-test/suite/csv/csv_not_null.test diff --git a/mysql-test/r/heap.result b/mysql-test/suite/heap/heap.result similarity index 100% rename from mysql-test/r/heap.result rename to mysql-test/suite/heap/heap.result diff --git a/mysql-test/t/heap.test b/mysql-test/suite/heap/heap.test similarity index 100% rename from mysql-test/t/heap.test rename to mysql-test/suite/heap/heap.test diff --git a/mysql-test/r/heap_auto_increment.result b/mysql-test/suite/heap/heap_auto_increment.result similarity index 100% rename from mysql-test/r/heap_auto_increment.result rename to mysql-test/suite/heap/heap_auto_increment.result diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/suite/heap/heap_auto_increment.test similarity index 100% rename from mysql-test/t/heap_auto_increment.test rename to mysql-test/suite/heap/heap_auto_increment.test diff --git a/mysql-test/r/heap_btree.result b/mysql-test/suite/heap/heap_btree.result similarity index 100% rename from mysql-test/r/heap_btree.result rename to mysql-test/suite/heap/heap_btree.result diff --git a/mysql-test/t/heap_btree.test b/mysql-test/suite/heap/heap_btree.test similarity index 100% rename from mysql-test/t/heap_btree.test rename to mysql-test/suite/heap/heap_btree.test diff --git a/mysql-test/r/heap_hash.result b/mysql-test/suite/heap/heap_hash.result similarity index 100% rename from mysql-test/r/heap_hash.result rename to mysql-test/suite/heap/heap_hash.result diff --git a/mysql-test/t/heap_hash.test b/mysql-test/suite/heap/heap_hash.test similarity index 100% rename from mysql-test/t/heap_hash.test rename to mysql-test/suite/heap/heap_hash.test diff --git a/mysql-test/suite/innodb/r/innodb_bug13635833.result b/mysql-test/suite/innodb/r/innodb_bug13635833.result new file mode 100644 index 00000000000..6a505bc94f2 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug13635833.result @@ -0,0 +1,45 @@ +SET DEBUG_SYNC='reset'; +create table t1 (f1 integer, key k1 (f1)) engine=innodb; +create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb; +create table t3 (f2 int, key(f2)) engine=innodb; +insert into t1 values (10); +insert into t2 values (10, 20); +insert into t3 values (20); +alter table t2 add constraint c1 foreign key (f1) +references t1(f1) on update cascade; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL, + KEY `k1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f1` int(11) DEFAULT NULL, + `f2` int(11) DEFAULT NULL, + KEY `f1` (`f1`), + KEY `f2` (`f2`), + CONSTRAINT `c1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `f2` int(11) DEFAULT NULL, + KEY `f2` (`f2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL update_can_proceed + WAIT_FOR dict_unfreeze'; +alter table t2 add constraint z1 foreign key (f2) +references t3(f2) on update cascade; +SET DEBUG_SYNC='innodb_row_update_for_mysql_begin + WAIT_FOR update_can_proceed'; +SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze + WAIT_FOR foreign_free_cache'; +update ignore t1 set f1 = 20; +ERROR HY000: Error on rename of './test/t2' to '#sql2-temporary' (errno: 181) +SET DEBUG_SYNC='now SIGNAL foreign_free_cache'; +drop table t2; +drop table t1; +drop table t3; +SET DEBUG_SYNC='reset'; diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index a1782ea5f6e..2b3d24551c7 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -2365,8 +2365,8 @@ select_type SIMPLE table t1 type index possible_keys NULL -key PRIMARY -key_len 4 +key b +key_len 10 ref NULL rows 10 Extra Using index @@ -2652,7 +2652,7 @@ select_type SIMPLE table t1 type index possible_keys NULL -key PRIMARY +key b key_len 8 ref NULL rows 3 diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index cea9055b873..46a2e210c6a 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -1,5 +1,10 @@ -- source include/have_innodb.inc +if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in XtraDB 1.0.17-13.0 or earlier +} + let $MYSQLD_DATADIR= `select @@datadir`; let $per_table=`select @@innodb_file_per_table`; diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test index e3026ac505b..97ae56f933b 100644 --- a/mysql-test/suite/innodb/t/innodb-lock.test +++ b/mysql-test/suite/innodb/t/innodb-lock.test @@ -1,5 +1,10 @@ --source include/have_innodb.inc +if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in XtraDB 1.0.17-13.0 or earlier +} + # # Check and select innodb lock type # diff --git a/mysql-test/suite/innodb/t/innodb_bug13635833.test b/mysql-test/suite/innodb/t/innodb_bug13635833.test new file mode 100644 index 00000000000..4bab6d09f89 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug13635833.test @@ -0,0 +1,69 @@ +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/not_embedded.inc + +if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`) +{ + --skip Not fixed in XtraDB 1.1.8-24.1 or earlier +} + +SET DEBUG_SYNC='reset'; + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +create table t1 (f1 integer, key k1 (f1)) engine=innodb; +create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb; +create table t3 (f2 int, key(f2)) engine=innodb; + +insert into t1 values (10); +insert into t2 values (10, 20); +insert into t3 values (20); + +alter table t2 add constraint c1 foreign key (f1) + references t1(f1) on update cascade; + +show create table t1; +show create table t2; +show create table t3; + +SET DEBUG_SYNC='innodb_rename_table_ready SIGNAL update_can_proceed + WAIT_FOR dict_unfreeze'; + +--send +alter table t2 add constraint z1 foreign key (f2) + references t3(f2) on update cascade; + +connect (thr2,localhost,root,,); +connection thr2; + +SET DEBUG_SYNC='innodb_row_update_for_mysql_begin + WAIT_FOR update_can_proceed'; +SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze + WAIT_FOR foreign_free_cache'; + +--send +update ignore t1 set f1 = 20; + +connection default; +--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/ +--error ER_ERROR_ON_RENAME +reap; + +SET DEBUG_SYNC='now SIGNAL foreign_free_cache'; + +connection thr2; +reap; +disconnect thr2; +--source include/wait_until_disconnected.inc + +connection default; + +drop table t2; +drop table t1; +drop table t3; + +# Wait till we reached the initial number of concurrent sessions +--source include/wait_until_count_sessions.inc + +SET DEBUG_SYNC='reset'; diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test index fcef3196845..e479b8d6b82 100755 --- a/mysql-test/suite/innodb/t/innodb_bug60196.test +++ b/mysql-test/suite/innodb/t/innodb_bug60196.test @@ -41,6 +41,7 @@ INSERT INTO Bug_60196 VALUES (99, 1); SELECT * FROM bug_60196_FK1; SELECT * FROM bug_60196_FK2; +--sorted_result SELECT * FROM bug_60196; --echo # Stop server @@ -77,6 +78,7 @@ SELECT * FROM Bug_60196; INSERT INTO Bug_60196 VALUES (2, 1); INSERT INTO Bug_60196 VALUES (2, 2); INSERT INTO Bug_60196 VALUES (2, 3); +--sorted_result SELECT * FROM Bug_60196; --echo diff --git a/mysql-test/suite/maria/t/compat_aliases-master.opt b/mysql-test/suite/maria/compat_aliases-master.opt similarity index 100% rename from mysql-test/suite/maria/t/compat_aliases-master.opt rename to mysql-test/suite/maria/compat_aliases-master.opt diff --git a/mysql-test/suite/maria/r/group_commit.result b/mysql-test/suite/maria/group_commit.result similarity index 100% rename from mysql-test/suite/maria/r/group_commit.result rename to mysql-test/suite/maria/group_commit.result diff --git a/mysql-test/suite/maria/t/group_commit.test b/mysql-test/suite/maria/group_commit.test similarity index 100% rename from mysql-test/suite/maria/t/group_commit.test rename to mysql-test/suite/maria/group_commit.test diff --git a/mysql-test/r/maria_icp.result b/mysql-test/suite/maria/icp.result similarity index 97% rename from mysql-test/r/maria_icp.result rename to mysql-test/suite/maria/icp.result index feca63402a4..a8756a4a6f1 100644 --- a/mysql-test/r/maria_icp.result +++ b/mysql-test/suite/maria/icp.result @@ -167,7 +167,7 @@ WHERE ts BETWEEN '0000-00-00' AND '2010-00-01 00:00:00' ORDER BY ts DESC LIMIT 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using index condition +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where DROP TABLE t1; # @@ -841,5 +841,21 @@ Variable_name Value Handler_icp_attempts 2 Handler_icp_match 1 DROP TABLE t1; +create table t1 (a int,b char(5),primary key (a), key (b(1))); +insert into t1 values ('a','b'); +Warnings: +Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 +select 1 from t1 where a and b >= 'aa'; +1 +drop table t1; +# +# Bug#58015 "Assert in row_sel_field_store_in_mysql_format +# when running innodb_mrr_icp test" +# +create table t1 (a char(2) charset utf8,b double, primary key (a(1)),key (b)); +insert into t1 values ('',1); +select 1 from t1 where b <= 1 and a <> ''; +1 +drop table t1; set storage_engine= @save_storage_engine; set optimizer_switch=@maria_icp_tmp; diff --git a/mysql-test/t/maria_icp.test b/mysql-test/suite/maria/icp.test similarity index 100% rename from mysql-test/t/maria_icp.test rename to mysql-test/suite/maria/icp.test diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result new file mode 100644 index 00000000000..101347c7d4c --- /dev/null +++ b/mysql-test/suite/maria/lock.result @@ -0,0 +1,29 @@ +drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +CREATE TABLE t1 (i INT) ENGINE=Aria; +CREATE TABLE t2 (i INT) ENGINE=Aria; +LOCK TABLE t1 WRITE, t2 WRITE; +DROP TABLE t1; +UNLOCK TABLES; +DROP TABLE t2; +CREATE TABLE t1 (i INT) ENGINE=Aria; +CREATE TABLE t2 (i INT) ENGINE=Aria; +LOCK TABLE t1 WRITE, t2 WRITE; +FLUSH TABLE t1; +select * from t1; +i +unlock tables; +drop table t1,t2; +CREATE TABLE t1 (i INT) ENGINE=Aria; +CREATE TABLE t2 (i INT) ENGINE=Aria; +LOCK TABLE t1 WRITE, t2 WRITE; +repair table t1 use_frm; +Table Op Msg_type Msg_text +test.t1 repair status OK +select * from t1; +i +drop table t2; +unlock tables; +drop table t1; diff --git a/mysql-test/suite/maria/lock.test b/mysql-test/suite/maria/lock.test new file mode 100644 index 00000000000..6116f0b5f08 --- /dev/null +++ b/mysql-test/suite/maria/lock.test @@ -0,0 +1,44 @@ +# +# Testing of potential problems in Aria with locking +# + +-- source include/have_maria.inc + +drop table if exists t1,t2; + +# +# Test for Bug#973039 +# Assertion `share->in_trans == 0' failed in maria_close on DROP TABLE +# under LOCK +# + +# Test DROP TABLE + +CREATE TABLE t1 (i INT) ENGINE=Aria; +CREATE TABLE t2 (i INT) ENGINE=Aria; +LOCK TABLE t1 WRITE, t2 WRITE; +# Also fails with FLUSH TABLE t1 and with REPAIR TABLE t1 USE_FRM +DROP TABLE t1; +UNLOCK TABLES; +DROP TABLE t2; + +#Test FLUSH TABLE + +CREATE TABLE t1 (i INT) ENGINE=Aria; +CREATE TABLE t2 (i INT) ENGINE=Aria; +LOCK TABLE t1 WRITE, t2 WRITE; +FLUSH TABLE t1; +select * from t1; +unlock tables; +drop table t1,t2; + +# Test REPAIR ... USE_FRM and unlock tables last + +CREATE TABLE t1 (i INT) ENGINE=Aria; +CREATE TABLE t2 (i INT) ENGINE=Aria; +LOCK TABLE t1 WRITE, t2 WRITE; +repair table t1 use_frm; +select * from t1; +drop table t2; +unlock tables; +drop table t1; diff --git a/mysql-test/suite/maria/r/locking.result b/mysql-test/suite/maria/locking.result similarity index 100% rename from mysql-test/suite/maria/r/locking.result rename to mysql-test/suite/maria/locking.result diff --git a/mysql-test/suite/maria/t/locking.test b/mysql-test/suite/maria/locking.test similarity index 100% rename from mysql-test/suite/maria/t/locking.test rename to mysql-test/suite/maria/locking.test diff --git a/mysql-test/suite/maria/r/maria-autozerofill.result b/mysql-test/suite/maria/maria-autozerofill.result similarity index 100% rename from mysql-test/suite/maria/r/maria-autozerofill.result rename to mysql-test/suite/maria/maria-autozerofill.result diff --git a/mysql-test/suite/maria/t/maria-autozerofill.test b/mysql-test/suite/maria/maria-autozerofill.test similarity index 100% rename from mysql-test/suite/maria/t/maria-autozerofill.test rename to mysql-test/suite/maria/maria-autozerofill.test diff --git a/mysql-test/suite/maria/r/maria-big.result b/mysql-test/suite/maria/maria-big.result similarity index 100% rename from mysql-test/suite/maria/r/maria-big.result rename to mysql-test/suite/maria/maria-big.result diff --git a/mysql-test/suite/maria/t/maria-big.test b/mysql-test/suite/maria/maria-big.test similarity index 100% rename from mysql-test/suite/maria/t/maria-big.test rename to mysql-test/suite/maria/maria-big.test diff --git a/mysql-test/suite/maria/r/maria-big2.result b/mysql-test/suite/maria/maria-big2.result similarity index 100% rename from mysql-test/suite/maria/r/maria-big2.result rename to mysql-test/suite/maria/maria-big2.result diff --git a/mysql-test/suite/maria/t/maria-big2.test b/mysql-test/suite/maria/maria-big2.test similarity index 100% rename from mysql-test/suite/maria/t/maria-big2.test rename to mysql-test/suite/maria/maria-big2.test diff --git a/mysql-test/suite/maria/r/maria-connect.result b/mysql-test/suite/maria/maria-connect.result similarity index 100% rename from mysql-test/suite/maria/r/maria-connect.result rename to mysql-test/suite/maria/maria-connect.result diff --git a/mysql-test/suite/maria/t/maria-connect.test b/mysql-test/suite/maria/maria-connect.test similarity index 100% rename from mysql-test/suite/maria/t/maria-connect.test rename to mysql-test/suite/maria/maria-connect.test diff --git a/mysql-test/suite/maria/t/maria-gis-recovery.opt b/mysql-test/suite/maria/maria-gis-recovery.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-gis-recovery.opt rename to mysql-test/suite/maria/maria-gis-recovery.opt diff --git a/mysql-test/suite/maria/r/maria-gis-recovery.result b/mysql-test/suite/maria/maria-gis-recovery.result similarity index 100% rename from mysql-test/suite/maria/r/maria-gis-recovery.result rename to mysql-test/suite/maria/maria-gis-recovery.result diff --git a/mysql-test/suite/maria/t/maria-gis-recovery.test b/mysql-test/suite/maria/maria-gis-recovery.test similarity index 100% rename from mysql-test/suite/maria/t/maria-gis-recovery.test rename to mysql-test/suite/maria/maria-gis-recovery.test diff --git a/mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result similarity index 99% rename from mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result rename to mysql-test/suite/maria/maria-gis-rtree-dynamic.result index 843e5ae3d37..f4593f2f10a 100644 --- a/mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result +++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result @@ -306,6 +306,10 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); fid AsText(g) +45 LINESTRING(51 51,60 60) +46 LINESTRING(51 41,60 50) +55 LINESTRING(41 51,50 60) +56 LINESTRING(41 41,50 50) DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))))); SELECT count(*) FROM t2; count(*) diff --git a/mysql-test/suite/maria/t/maria-gis-rtree-dynamic.test b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test similarity index 100% rename from mysql-test/suite/maria/t/maria-gis-rtree-dynamic.test rename to mysql-test/suite/maria/maria-gis-rtree-dynamic.test diff --git a/mysql-test/suite/maria/r/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result similarity index 99% rename from mysql-test/suite/maria/r/maria-gis-rtree-trans.result rename to mysql-test/suite/maria/maria-gis-rtree-trans.result index 8ccc1f5bfdf..c4e773c7e0a 100644 --- a/mysql-test/suite/maria/r/maria-gis-rtree-trans.result +++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result @@ -306,6 +306,10 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); fid AsText(g) +45 LINESTRING(51 51,60 60) +46 LINESTRING(51 41,60 50) +55 LINESTRING(41 51,50 60) +56 LINESTRING(41 41,50 50) DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))))); SELECT count(*) FROM t2; count(*) diff --git a/mysql-test/suite/maria/t/maria-gis-rtree-trans.test b/mysql-test/suite/maria/maria-gis-rtree-trans.test similarity index 100% rename from mysql-test/suite/maria/t/maria-gis-rtree-trans.test rename to mysql-test/suite/maria/maria-gis-rtree-trans.test diff --git a/mysql-test/suite/maria/r/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result similarity index 99% rename from mysql-test/suite/maria/r/maria-gis-rtree.result rename to mysql-test/suite/maria/maria-gis-rtree.result index 9945daae75e..430f240d83e 100644 --- a/mysql-test/suite/maria/r/maria-gis-rtree.result +++ b/mysql-test/suite/maria/maria-gis-rtree.result @@ -306,6 +306,10 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT fid, AsText(g) FROM t2 WHERE Within(g, GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); fid AsText(g) +45 LINESTRING(51 51,60 60) +46 LINESTRING(51 41,60 50) +55 LINESTRING(41 51,50 60) +56 LINESTRING(41 41,50 50) DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))))); SELECT count(*) FROM t2; count(*) diff --git a/mysql-test/suite/maria/t/maria-gis-rtree.test b/mysql-test/suite/maria/maria-gis-rtree.test similarity index 100% rename from mysql-test/suite/maria/t/maria-gis-rtree.test rename to mysql-test/suite/maria/maria-gis-rtree.test diff --git a/mysql-test/suite/maria/r/maria-mvcc.result b/mysql-test/suite/maria/maria-mvcc.result similarity index 100% rename from mysql-test/suite/maria/r/maria-mvcc.result rename to mysql-test/suite/maria/maria-mvcc.result diff --git a/mysql-test/suite/maria/t/maria-mvcc.test b/mysql-test/suite/maria/maria-mvcc.test similarity index 100% rename from mysql-test/suite/maria/t/maria-mvcc.test rename to mysql-test/suite/maria/maria-mvcc.test diff --git a/mysql-test/suite/maria/r/maria-no-logging.result b/mysql-test/suite/maria/maria-no-logging.result similarity index 100% rename from mysql-test/suite/maria/r/maria-no-logging.result rename to mysql-test/suite/maria/maria-no-logging.result diff --git a/mysql-test/suite/maria/t/maria-no-logging.test b/mysql-test/suite/maria/maria-no-logging.test similarity index 100% rename from mysql-test/suite/maria/t/maria-no-logging.test rename to mysql-test/suite/maria/maria-no-logging.test diff --git a/mysql-test/suite/maria/r/maria-page-checksum.result b/mysql-test/suite/maria/maria-page-checksum.result similarity index 100% rename from mysql-test/suite/maria/r/maria-page-checksum.result rename to mysql-test/suite/maria/maria-page-checksum.result diff --git a/mysql-test/suite/maria/t/maria-page-checksum.test b/mysql-test/suite/maria/maria-page-checksum.test similarity index 100% rename from mysql-test/suite/maria/t/maria-page-checksum.test rename to mysql-test/suite/maria/maria-page-checksum.test diff --git a/mysql-test/suite/maria/r/maria-partitioning.result b/mysql-test/suite/maria/maria-partitioning.result similarity index 88% rename from mysql-test/suite/maria/r/maria-partitioning.result rename to mysql-test/suite/maria/maria-partitioning.result index 840c7c0b3b4..bcb88626ff7 100644 --- a/mysql-test/suite/maria/r/maria-partitioning.result +++ b/mysql-test/suite/maria/maria-partitioning.result @@ -28,3 +28,7 @@ insert into t1 values (2); select * from t2 left join t1 on (t2.a=t1.a) where t2.a='bbb'; a a drop table t1,t2; +CREATE TABLE t1 ( i INT ) ENGINE=Aria +PARTITION BY HASH(i) PARTITIONS 2; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +drop table t1; diff --git a/mysql-test/suite/maria/t/maria-partitioning.test b/mysql-test/suite/maria/maria-partitioning.test similarity index 85% rename from mysql-test/suite/maria/t/maria-partitioning.test rename to mysql-test/suite/maria/maria-partitioning.test index 612c44be57e..446cfed770b 100644 --- a/mysql-test/suite/maria/t/maria-partitioning.test +++ b/mysql-test/suite/maria/maria-partitioning.test @@ -34,6 +34,15 @@ insert into t1 values (2); select * from t2 left join t1 on (t2.a=t1.a) where t2.a='bbb'; drop table t1,t2; +# +# LP:990187 +# Assertion `share->reopen == 1' failed at maria_extra on ADD PARTITION +# +CREATE TABLE t1 ( i INT ) ENGINE=Aria + PARTITION BY HASH(i) PARTITIONS 2; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +drop table t1; + # Set defaults back --disable_result_log --disable_query_log diff --git a/mysql-test/suite/maria/r/maria-preload.result b/mysql-test/suite/maria/maria-preload.result similarity index 100% rename from mysql-test/suite/maria/r/maria-preload.result rename to mysql-test/suite/maria/maria-preload.result diff --git a/mysql-test/suite/maria/t/maria-preload.test b/mysql-test/suite/maria/maria-preload.test similarity index 100% rename from mysql-test/suite/maria/t/maria-preload.test rename to mysql-test/suite/maria/maria-preload.test diff --git a/mysql-test/suite/maria/r/maria-purge.result b/mysql-test/suite/maria/maria-purge.result similarity index 100% rename from mysql-test/suite/maria/r/maria-purge.result rename to mysql-test/suite/maria/maria-purge.result diff --git a/mysql-test/suite/maria/t/maria-purge.test b/mysql-test/suite/maria/maria-purge.test similarity index 100% rename from mysql-test/suite/maria/t/maria-purge.test rename to mysql-test/suite/maria/maria-purge.test diff --git a/mysql-test/suite/maria/t/maria-recover-master.opt b/mysql-test/suite/maria/maria-recover-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recover-master.opt rename to mysql-test/suite/maria/maria-recover-master.opt diff --git a/mysql-test/suite/maria/r/maria-recover.result b/mysql-test/suite/maria/maria-recover.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recover.result rename to mysql-test/suite/maria/maria-recover.result diff --git a/mysql-test/suite/maria/t/maria-recover.test b/mysql-test/suite/maria/maria-recover.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recover.test rename to mysql-test/suite/maria/maria-recover.test diff --git a/mysql-test/suite/maria/t/maria-recovery-big-master.opt b/mysql-test/suite/maria/maria-recovery-big-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-big-master.opt rename to mysql-test/suite/maria/maria-recovery-big-master.opt diff --git a/mysql-test/suite/maria/r/maria-recovery-big.result b/mysql-test/suite/maria/maria-recovery-big.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recovery-big.result rename to mysql-test/suite/maria/maria-recovery-big.result diff --git a/mysql-test/suite/maria/t/maria-recovery-big.test b/mysql-test/suite/maria/maria-recovery-big.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-big.test rename to mysql-test/suite/maria/maria-recovery-big.test diff --git a/mysql-test/suite/maria/t/maria-recovery-bitmap-master.opt b/mysql-test/suite/maria/maria-recovery-bitmap-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-bitmap-master.opt rename to mysql-test/suite/maria/maria-recovery-bitmap-master.opt diff --git a/mysql-test/suite/maria/r/maria-recovery-bitmap.result b/mysql-test/suite/maria/maria-recovery-bitmap.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recovery-bitmap.result rename to mysql-test/suite/maria/maria-recovery-bitmap.result diff --git a/mysql-test/suite/maria/t/maria-recovery-bitmap.test b/mysql-test/suite/maria/maria-recovery-bitmap.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-bitmap.test rename to mysql-test/suite/maria/maria-recovery-bitmap.test diff --git a/mysql-test/suite/maria/t/maria-recovery-master.opt b/mysql-test/suite/maria/maria-recovery-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-master.opt rename to mysql-test/suite/maria/maria-recovery-master.opt diff --git a/mysql-test/suite/maria/t/maria-recovery-rtree-ft-master.opt b/mysql-test/suite/maria/maria-recovery-rtree-ft-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-rtree-ft-master.opt rename to mysql-test/suite/maria/maria-recovery-rtree-ft-master.opt diff --git a/mysql-test/suite/maria/r/maria-recovery-rtree-ft.result b/mysql-test/suite/maria/maria-recovery-rtree-ft.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recovery-rtree-ft.result rename to mysql-test/suite/maria/maria-recovery-rtree-ft.result diff --git a/mysql-test/suite/maria/t/maria-recovery-rtree-ft.test b/mysql-test/suite/maria/maria-recovery-rtree-ft.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery-rtree-ft.test rename to mysql-test/suite/maria/maria-recovery-rtree-ft.test diff --git a/mysql-test/suite/maria/r/maria-recovery.result b/mysql-test/suite/maria/maria-recovery.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recovery.result rename to mysql-test/suite/maria/maria-recovery.result diff --git a/mysql-test/suite/maria/t/maria-recovery.test b/mysql-test/suite/maria/maria-recovery.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery.test rename to mysql-test/suite/maria/maria-recovery.test diff --git a/mysql-test/suite/maria/t/maria-recovery2-master.opt b/mysql-test/suite/maria/maria-recovery2-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery2-master.opt rename to mysql-test/suite/maria/maria-recovery2-master.opt diff --git a/mysql-test/suite/maria/r/maria-recovery2.result b/mysql-test/suite/maria/maria-recovery2.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recovery2.result rename to mysql-test/suite/maria/maria-recovery2.result diff --git a/mysql-test/suite/maria/t/maria-recovery2.test b/mysql-test/suite/maria/maria-recovery2.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery2.test rename to mysql-test/suite/maria/maria-recovery2.test diff --git a/mysql-test/suite/maria/t/maria-recovery3-master.opt b/mysql-test/suite/maria/maria-recovery3-master.opt similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery3-master.opt rename to mysql-test/suite/maria/maria-recovery3-master.opt diff --git a/mysql-test/suite/maria/r/maria-recovery3.result b/mysql-test/suite/maria/maria-recovery3.result similarity index 100% rename from mysql-test/suite/maria/r/maria-recovery3.result rename to mysql-test/suite/maria/maria-recovery3.result diff --git a/mysql-test/suite/maria/t/maria-recovery3.test b/mysql-test/suite/maria/maria-recovery3.test similarity index 100% rename from mysql-test/suite/maria/t/maria-recovery3.test rename to mysql-test/suite/maria/maria-recovery3.test diff --git a/mysql-test/suite/maria/r/maria-ucs2.result b/mysql-test/suite/maria/maria-ucs2.result similarity index 100% rename from mysql-test/suite/maria/r/maria-ucs2.result rename to mysql-test/suite/maria/maria-ucs2.result diff --git a/mysql-test/suite/maria/t/maria-ucs2.test b/mysql-test/suite/maria/maria-ucs2.test similarity index 100% rename from mysql-test/suite/maria/t/maria-ucs2.test rename to mysql-test/suite/maria/maria-ucs2.test diff --git a/mysql-test/suite/maria/r/maria.result b/mysql-test/suite/maria/maria.result similarity index 99% rename from mysql-test/suite/maria/r/maria.result rename to mysql-test/suite/maria/maria.result index c68a8871f83..888c1c10c5e 100644 --- a/mysql-test/suite/maria/r/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -2542,8 +2542,12 @@ drop table t1; create table t1 (a int) engine=aria transactional=1; insert into t1 values (1); lock table t1 write concurrent; -delete from t1; +delete from t1 where a>0; ERROR 42000: The storage engine for the table doesn't support DELETE in WRITE CONCURRENT +delete from t1; +ERROR 42000: The storage engine for the table doesn't support TRUNCATE in WRITE CONCURRENT +truncate t1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated unlock tables; drop table t1; create table t1 (p int primary key, i int, a char(10), key k1(i), key k2(a)) diff --git a/mysql-test/suite/maria/t/maria.test b/mysql-test/suite/maria/maria.test similarity index 99% rename from mysql-test/suite/maria/t/maria.test rename to mysql-test/suite/maria/maria.test index b371394b2b3..6ebcf08d952 100644 --- a/mysql-test/suite/maria/t/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -1805,7 +1805,11 @@ insert into t1 values (1); lock table t1 write concurrent; # should be fixed with fully implemented versioning --error ER_CHECK_NOT_IMPLEMENTED +delete from t1 where a>0; +--error ER_CHECK_NOT_IMPLEMENTED delete from t1; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +truncate t1; unlock tables; drop table t1; diff --git a/mysql-test/suite/maria/r/maria2.result b/mysql-test/suite/maria/maria2.result similarity index 100% rename from mysql-test/suite/maria/r/maria2.result rename to mysql-test/suite/maria/maria2.result diff --git a/mysql-test/suite/maria/t/maria2.test b/mysql-test/suite/maria/maria2.test similarity index 100% rename from mysql-test/suite/maria/t/maria2.test rename to mysql-test/suite/maria/maria2.test diff --git a/mysql-test/suite/maria/r/maria3.result b/mysql-test/suite/maria/maria3.result similarity index 100% rename from mysql-test/suite/maria/r/maria3.result rename to mysql-test/suite/maria/maria3.result diff --git a/mysql-test/suite/maria/t/maria3.test b/mysql-test/suite/maria/maria3.test similarity index 100% rename from mysql-test/suite/maria/t/maria3.test rename to mysql-test/suite/maria/maria3.test diff --git a/mysql-test/suite/maria/r/maria_notembedded.result b/mysql-test/suite/maria/maria_notembedded.result similarity index 100% rename from mysql-test/suite/maria/r/maria_notembedded.result rename to mysql-test/suite/maria/maria_notembedded.result diff --git a/mysql-test/suite/maria/t/maria_notembedded.test b/mysql-test/suite/maria/maria_notembedded.test similarity index 100% rename from mysql-test/suite/maria/t/maria_notembedded.test rename to mysql-test/suite/maria/maria_notembedded.test diff --git a/mysql-test/suite/maria/r/maria_partition.result b/mysql-test/suite/maria/maria_partition.result similarity index 100% rename from mysql-test/suite/maria/r/maria_partition.result rename to mysql-test/suite/maria/maria_partition.result diff --git a/mysql-test/suite/maria/t/maria_partition.test b/mysql-test/suite/maria/maria_partition.test similarity index 100% rename from mysql-test/suite/maria/t/maria_partition.test rename to mysql-test/suite/maria/maria_partition.test diff --git a/mysql-test/suite/maria/r/maria_showlog_error.result b/mysql-test/suite/maria/maria_showlog_error.result similarity index 100% rename from mysql-test/suite/maria/r/maria_showlog_error.result rename to mysql-test/suite/maria/maria_showlog_error.result diff --git a/mysql-test/suite/maria/t/maria_showlog_error.test b/mysql-test/suite/maria/maria_showlog_error.test similarity index 100% rename from mysql-test/suite/maria/t/maria_showlog_error.test rename to mysql-test/suite/maria/maria_showlog_error.test diff --git a/mysql-test/suite/maria/r/max_length.result b/mysql-test/suite/maria/max_length.result similarity index 100% rename from mysql-test/suite/maria/r/max_length.result rename to mysql-test/suite/maria/max_length.result diff --git a/mysql-test/suite/maria/t/max_length.test b/mysql-test/suite/maria/max_length.test similarity index 100% rename from mysql-test/suite/maria/t/max_length.test rename to mysql-test/suite/maria/max_length.test diff --git a/mysql-test/r/maria_mrr.result b/mysql-test/suite/maria/mrr.result similarity index 100% rename from mysql-test/r/maria_mrr.result rename to mysql-test/suite/maria/mrr.result diff --git a/mysql-test/t/maria_mrr.test b/mysql-test/suite/maria/mrr.test similarity index 100% rename from mysql-test/t/maria_mrr.test rename to mysql-test/suite/maria/mrr.test diff --git a/mysql-test/suite/maria/r/optimize.result b/mysql-test/suite/maria/optimize.result similarity index 100% rename from mysql-test/suite/maria/r/optimize.result rename to mysql-test/suite/maria/optimize.result diff --git a/mysql-test/suite/maria/t/optimize.test b/mysql-test/suite/maria/optimize.test similarity index 100% rename from mysql-test/suite/maria/t/optimize.test rename to mysql-test/suite/maria/optimize.test diff --git a/mysql-test/suite/maria/r/ps_maria.result b/mysql-test/suite/maria/ps_maria.result similarity index 100% rename from mysql-test/suite/maria/r/ps_maria.result rename to mysql-test/suite/maria/ps_maria.result diff --git a/mysql-test/suite/maria/t/ps_maria.test b/mysql-test/suite/maria/ps_maria.test similarity index 100% rename from mysql-test/suite/maria/t/ps_maria.test rename to mysql-test/suite/maria/ps_maria.test diff --git a/mysql-test/suite/maria/t/small_blocksize-master.opt b/mysql-test/suite/maria/small_blocksize-master.opt similarity index 100% rename from mysql-test/suite/maria/t/small_blocksize-master.opt rename to mysql-test/suite/maria/small_blocksize-master.opt diff --git a/mysql-test/suite/maria/r/small_blocksize.result b/mysql-test/suite/maria/small_blocksize.result similarity index 100% rename from mysql-test/suite/maria/r/small_blocksize.result rename to mysql-test/suite/maria/small_blocksize.result diff --git a/mysql-test/suite/maria/t/small_blocksize.test b/mysql-test/suite/maria/small_blocksize.test similarity index 100% rename from mysql-test/suite/maria/t/small_blocksize.test rename to mysql-test/suite/maria/small_blocksize.test diff --git a/mysql-test/suite/maria/truncate.result b/mysql-test/suite/maria/truncate.result new file mode 100644 index 00000000000..467e0f915dd --- /dev/null +++ b/mysql-test/suite/maria/truncate.result @@ -0,0 +1,37 @@ +CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2; +SET AUTOCOMMIT = 0; +TRUNCATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 ( i INT ) ENGINE=Aria; +CREATE TABLE t2 ( i INT ) ENGINE=Aria; +insert into t1 values(1); +lock table t1 write; +truncate table t1; +select count(*) from t1; +count(*) +0 +insert into t1 values(2); +select count(*) from t1; +count(*) +1 +truncate table t1; +select count(*) from t1; +count(*) +0 +insert into t1 values(3); +select count(*) from t1; +count(*) +1 +select * from t2; +ERROR HY000: Table 't2' was not locked with LOCK TABLES +unlock tables; +insert into t1 values(4); +select * from t1; +i +3 +4 +truncate t1; +select count(*) from t1; +count(*) +0 +drop table t1,t2; diff --git a/mysql-test/suite/maria/truncate.test b/mysql-test/suite/maria/truncate.test new file mode 100644 index 00000000000..3d6e70d9db6 --- /dev/null +++ b/mysql-test/suite/maria/truncate.test @@ -0,0 +1,47 @@ +# +# Testing of potential problems in Aria +# + +-- source include/have_maria.inc +-- source include/have_partition.inc + +--disable_warnings +--disable_query_log +drop table if exists t1,t2; +--enable_query_log +--enable_warnings + +# +# LP:997460 truncate table on partitioned Aria table fails with ER_ILLEGAL_HA +# + +CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2; +SET AUTOCOMMIT = 0; +TRUNCATE TABLE t1; +DROP TABLE t1; + +# +# Other truncate tests +# + +CREATE TABLE t1 ( i INT ) ENGINE=Aria; +CREATE TABLE t2 ( i INT ) ENGINE=Aria; +insert into t1 values(1); +lock table t1 write; +truncate table t1; +select count(*) from t1; +insert into t1 values(2); +select count(*) from t1; +truncate table t1; +select count(*) from t1; +insert into t1 values(3); +select count(*) from t1; +# Check that locking is still working +--error 1100 +select * from t2; +unlock tables; +insert into t1 values(4); +select * from t1; +truncate t1; +select count(*) from t1; +drop table t1,t2; diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result index ea738b710fd..26c6d96e786 100644 --- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result +++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result @@ -5,6 +5,8 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT, UNIQUE(b)); INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10; +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe SELECT * FROM t1; a b 1 10 diff --git a/mysql-test/suite/rpl/r/rpl_report_port.result b/mysql-test/suite/rpl/r/rpl_report_port.result index ebdd3f889f3..d9887f41ff9 100644 --- a/mysql-test/suite/rpl/r/rpl_report_port.result +++ b/mysql-test/suite/rpl/r/rpl_report_port.result @@ -1,8 +1,11 @@ include/master-slave.inc [connection master] -include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.] include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000] include/start_slave.inc [Slave restarted with the report-port set to some value] include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.] +include/rpl_restart_server.inc [server_number=2 parameters: --report-port=] +include/start_slave.inc +[Slave restarted with the report-port set to the value of slave's port number] +include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.] include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result index c864850a238..6e2415ebcd8 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result @@ -49,6 +49,10 @@ A B A I X Y X Z +include/assert.inc [Counter for COM_COMMIT is consistent with the number of actual commits] +include/assert.inc [Counter for COM_INSERT is consistent with the number of actual inserts] +include/assert.inc [Counter for COM_DELETE is consistent with the number of actual deletes] +include/assert.inc [Counter for COM_UPDATE is consistent with the number of actual updates] UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N'; SELECT * FROM t1 ORDER BY c1,c2; C1 C2 diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result index 0e00695500c..cba1b905d98 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result @@ -49,6 +49,10 @@ A B A I X Y X Z +include/assert.inc [Counter for COM_COMMIT is consistent with the number of actual commits] +include/assert.inc [Counter for COM_INSERT is consistent with the number of actual inserts] +include/assert.inc [Counter for COM_DELETE is consistent with the number of actual deletes] +include/assert.inc [Counter for COM_UPDATE is consistent with the number of actual updates] UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N'; SELECT * FROM t1 ORDER BY c1,c2; C1 C2 diff --git a/mysql-test/suite/rpl/r/rpl_row_merge_engine.result b/mysql-test/suite/rpl/r/rpl_row_merge_engine.result new file mode 100644 index 00000000000..c61167e84e0 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_merge_engine.result @@ -0,0 +1,16 @@ +include/master-slave.inc +[connection master] +CREATE TABLE t1 (a int) ENGINE=MyISAM; +CREATE TABLE t2 (a int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (2), (3); +INSERT INTO t2 VALUES (4), (5), (6); +CREATE TABLE IF NOT EXISTS t1_merge LIKE t1; +ALTER TABLE t1_merge ENGINE=MERGE UNION (t2, t1); +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +UPDATE t1_merge SET a=10 WHERE a=1; +DELETE FROM t1_merge WHERE a=10; +include/diff_tables.inc [master:test.t1, slave:test.t1] +include/diff_tables.inc [master:test.t2, slave:test.t2] +DROP TABLE t1_merge, t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index 78489449ab8..e736eb1ba12 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -324,7 +324,7 @@ call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received w let $slave_errno= ER_DUP_ENTRY --source include/wait_for_slave_sql_error.inc let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); -sleep 2; +sleep 4; let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); --echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result diff --git a/mysql-test/suite/rpl/t/rpl_report_port-slave.opt b/mysql-test/suite/rpl/t/rpl_report_port-slave.opt deleted file mode 100644 index ffe2b2e7016..00000000000 --- a/mysql-test/suite/rpl/t/rpl_report_port-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---report-port= diff --git a/mysql-test/suite/rpl/t/rpl_report_port.test b/mysql-test/suite/rpl/t/rpl_report_port.test index b1b71a2982c..379f9aed946 100644 --- a/mysql-test/suite/rpl/t/rpl_report_port.test +++ b/mysql-test/suite/rpl/t/rpl_report_port.test @@ -10,22 +10,18 @@ # #====Method==== # -# Start replication with report port not set.This will give the actual port -# number of the slave (ie. SLAVE_PORT) for the on doing SHOW SLAVE HOSTS on -# the master. -# Restart the slave server with report port set to 9000 and start the slave. +# Start replication with report port set to 9000 and restart the slave. # In this case on doing SHOW SLAVE HOSTS on the master, we get the port number # of the slave to be 9000. +# In the second case restart the slave server with report port not set. In this +# case on doing SHOW SLAVE HOSTS on the master, we get the actual port number +# of the slave (ie. SLAVE_PORT). source include/master-slave.inc; +source include/have_binlog_format_mixed.inc; connection master; ---let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1) ---let assert_text= The default value shown for the slave's port number is the actual port number of the slave. ---let assert_cond= $report_port = "$SLAVE_MYPORT" ---source include/assert.inc - # Start the server with some value being passed to the report_port=